/* 依米教学云 · 设计系统
   浅色内容区 + 可切换配色的侧栏导航。
   主题由 <html data-theme="forest|navy|graphite"> 决定，默认墨绿（forest）；
   顶栏右侧的色点切换后写入 localStorage，head 内联脚本在首屏前还原，避免闪烁。
   新增配色只需再写一个 html[data-theme="xxx"] 变量块，其它样式无需改动。 */



/* ---------------- 顶栏 ---------------- */

.appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 18px;
    background: var(--side-bg-deep);
    color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, .25);
}

.appbar__menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.appbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
}
.appbar__brand:hover { text-decoration: none; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 78%, #fff), var(--brand) 58%, var(--brand-ink));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.appbar__brand-sub {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, .55);
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, .18);
}

.appbar__spacer { flex: 1; }

.appbar__meta {
    font-size: 12px;
    color: rgba(255, 255, 255, .6);
    padding: 3px 8px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
}

.appbar__user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.appbar__user-name { font-weight: 600; color: #fff; }

.appbar__role {
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #dfeae2;
    font-size: 11.5px;
}

.link-btn {
    border: 0;
    background: none;
    color: rgba(255, 255, 255, .6);
    font-size: 12.5px;
    cursor: pointer;
    padding: 0;
}
.link-btn:hover { color: #ffc9bd; text-decoration: underline; }

.inline-form { display: inline; }

/* 顶栏配色切换：三个色点，选中项加白环 */
.theme-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
}

.theme-switch__dot {
    width: 14px;
    height: 14px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--dot);
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .25) inset;
    transition: transform .15s ease, box-shadow .15s ease;
}
.theme-switch__dot:hover { transform: scale(1.15); }
.theme-switch__dot.is-active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(255, 255, 255, .18);
}

.theme-switch__dot[data-theme-set="navy"] { --dot: #2f6bb0; }
.theme-switch__dot[data-theme-set="forest"] { --dot: #2f8a5c; }
.theme-switch__dot[data-theme-set="graphite"] { --dot: #5a626d; }

/* ---------------- 布局 ---------------- */

.shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    align-items: start;
    min-height: calc(100vh - 56px);
}

.sidebar {
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    padding: 10px 0 16px;
    background: linear-gradient(180deg, var(--side-bg), var(--side-bg-deep));
    overflow-y: auto;
}

.nav__group { margin-bottom: 10px; padding-bottom: 6px; }
.nav__group + .nav__group { border-top: 1px solid var(--side-line); padding-top: 6px; }

.nav__title {
    margin: 6px 0 4px;
    padding: 0 20px;
    font-size: 11.5px;
    letter-spacing: .06em;
    color: var(--side-title);
}

.nav__item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 1px 8px 1px 0;
    padding: 9px 12px 9px 19px;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    color: var(--side-ink);
    font-size: 13.5px;
    transition: background .15s ease, color .15s ease;
}
.nav__item:hover {
    background: var(--side-hover);
    color: var(--side-ink-strong);
    text-decoration: none;
}
.nav__item.is-active {
    background: var(--side-active);
    border-left-color: var(--accent);
    color: var(--side-ink-strong);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
/* 选中项在高亮条处补一小段光晕，让当前菜单位置更容易被扫到 */
.nav__item.is-active::before {
    content: "";
    position: absolute;
    left: -3px;
    top: 50%;
    width: 3px;
    height: 60%;
    transform: translateY(-50%);
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent);
}

.nav__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .13);
    color: var(--side-ink);
    font-size: 11px;
    font-style: normal;
}
.nav__item.is-active .nav__badge {
    background: color-mix(in srgb, var(--accent) 26%, transparent);
    color: var(--accent-ink);
}

.sidebar__foot {
    margin: 14px 16px 0;
    padding-top: 12px;
    border-top: 1px solid var(--side-line);
    font-size: 11px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .32);
}

.main {
    padding: 20px 24px 48px;
    max-width: 1400px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.page-head__title { font-size: 21px; letter-spacing: -.01em; }
.page-head__sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-head__actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------------- 卡片 ---------------- */


.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.split--aside { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }

@media (max-width: 1080px) {
    .split, .split--aside { grid-template-columns: minmax(0, 1fr); }
}






/* ---------------- 键值列表 ---------------- */

.kv { margin: 0; display: grid; gap: 8px; }
.kv > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--ink-soft); }
.kv--stack > div { grid-template-columns: 88px minmax(0, 1fr); }
.kv--inline { margin-top: 6px; padding: 8px 10px; background: #fafbfd; border-radius: 8px; }
.kv--inline > div { grid-template-columns: 64px minmax(0, 1fr); }

/* ---------------- 课时单元 ---------------- */

.units { display: grid; gap: 10px; }

.unit {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 12px 14px;
    background: #fff;
}
.unit__head { display: flex; align-items: flex-start; gap: 12px; }
.unit__no {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-top: 2px;
    border-radius: 7px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 12px;
    font-weight: 600;
}
.unit__title { flex: 1; min-width: 0; }
.unit__title p { margin: 2px 0 0; }
.unit__ops { display: flex; gap: 6px; flex-shrink: 0; }

.unit__edit { margin-top: 10px; }
.unit__edit summary,
.panel-add summary {
    cursor: pointer;
    font-size: 12.5px;
    color: var(--brand);
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}
.unit__edit summary::-webkit-details-marker,
.panel-add summary::-webkit-details-marker { display: none; }
.unit__edit summary::before,
.panel-add summary::before { content: "▸"; font-size: 10px; color: var(--muted); }
.unit__edit[open] summary::before,
.panel-add[open] summary::before { content: "▾"; }

.unit__edit form { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }

.panel-add { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.panel-add[open] summary { margin-bottom: 10px; }


.bullets { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 13px; }
.bullets li { margin-bottom: 5px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list__item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.list__title { font-weight: 600; color: var(--ink); }
.list__title:hover { color: var(--brand); text-decoration: none; }

/* ---------------- 登录 ---------------- */

.body--plain { background: linear-gradient(160deg, #f6f9ff, #eef2f9 60%, #f7f9fc); }

.centered {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.signin {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 20px 48px rgba(20, 35, 60, .1);
    padding: 26px 24px 20px;
}
.signin__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.signin__brand h1 { font-size: 19px; }
.signin__brand p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.signin__brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 18px; }
.signin__hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.signin__list { display: grid; gap: 8px; }
.signin__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--panel);
    font: inherit;
    font-size: 13.5px;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}
.signin__item:hover { border-color: var(--brand); background: var(--brand-soft); }
.signin__name { font-weight: 600; }
.signin__id { margin-left: auto; color: var(--muted); font-size: 12px;
    max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signin__foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 11.5px; }

/* 登录页：手机号 + 密码是主路径，企微扫码与开发态登录排在它下面 */
.signin__form { display: grid; gap: 12px; margin-bottom: 12px; }
.signin__submit { width: 100%; margin-top: 2px; }
.signin__wecom { display: block; width: 100%; text-align: center; text-decoration: none; }
.signin__wecom:hover { text-decoration: none; }
.signin__hint--slim { margin: 2px 0 0; font-size: 12px; line-height: 1.6; }

.signin__divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 12px;
    color: var(--muted);
    font-size: 11.5px;
}
.signin__divider::before,
.signin__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 860px) {
    .appbar__menu { display: inline-flex; }
    .appbar__brand-sub, .appbar__meta { display: none; }

    .shell { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        width: 232px;
        z-index: 25;
        transform: translateX(-100%);
        transition: transform .18s ease;
        box-shadow: var(--shadow);
    }
    .sidebar.is-open { transform: translateX(0); }

    .main { padding: 16px 14px 40px; }
    .table th, .table td { padding: 9px 12px; }
}

/* ================= 导航模块新增组件 ================= */

/* 排行条：校区 / 教师负载 */
.rank { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.rank__row { display: grid; gap: 4px; }
.rank__line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}
.rank__name { color: var(--ink); font-weight: 500; }
.rank__num { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rank__track {
    height: 6px;
    border-radius: 999px;
    background: #eef2ef;
    overflow: hidden;
}
.rank__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2f8a5b, #4faf7b);
}

/* 周课表：7 列日期卡片 */
.week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}
.week__col {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfb;
    min-height: 140px;
    overflow: hidden;
}
.week__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    background: #f4f7f4;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
}
.week__head span { font-size: 11px; color: var(--muted); font-weight: 400; }
/* 星期几这一行比日期重一点，但不染品牌色 */
.week__head .week__day { color: inherit; font-weight: 600; }
.week__col.is-today .week__head { background: var(--brand-soft); color: var(--brand-ink); }
.week__body { padding: 8px; display: grid; gap: 8px; }
.week__empty { padding: 8px; color: #b3bfb7; font-size: 12px; text-align: center; }

.lesson {
    display: block;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    border-radius: 7px;
    background: #fff;
    font-size: 12.5px;
    color: var(--ink);
    line-height: 1.45;
}
.lesson:hover { border-color: #bcd9c9; text-decoration: none; background: #fafffc; }
.lesson__time { font-weight: 600; font-variant-numeric: tabular-nums; }
.lesson__name { display: block; color: var(--ink-soft); font-size: 12px; }
.lesson__meta { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.lesson--pending { border-left-color: var(--accent); }

/* 进度条 */
.bar { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.bar__track { flex: 1; height: 6px; border-radius: 999px; background: #eef2ef; overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--brand); }
.bar__fill--warn { background: var(--accent); }
.bar__text { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 题库题目卡 */
.question-list { padding: 14px 16px; }
.question {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    background: #fff;
}
.question + .question { margin-top: 10px; }
.question__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.question__no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 12px;
    font-weight: 600;
}
.question__stem { margin: 0 0 8px; color: var(--ink); }
.question__options { display: grid; gap: 4px; margin: 0 0 8px; }
.question__option { font-size: 13px; color: var(--ink-soft); }
.question__option b { color: var(--ink); margin-right: 6px; }
.question__answer {
    margin: 0;
    padding: 7px 10px;
    border-radius: 7px;
    background: #f7faf8;
    border: 1px dashed #d6e6dc;
    color: var(--brand-ink);
    font-size: 12.5px;
}
.question__analysis { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }

/* 知识图谱 */
.knowledge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.domain { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.domain__head { padding: 12px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #f5faf7, #fff); }
.domain__name { margin: 0; font-size: 14.5px; font-weight: 650; color: var(--ink); }
.domain__sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.domain__body { padding: 10px 14px 14px; display: grid; gap: 8px; }
.point {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
}
.point__name { font-size: 13px; color: var(--ink); }
.point__sum { font-size: 11.5px; color: var(--muted); }
.point__count {
    font-size: 11.5px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    white-space: nowrap;
}
.point--empty .point__count { background: #f1f3f1; color: var(--muted); }

/* 校区切换条 */
.hero {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}
.hero__label { font-size: 12.5px; color: var(--muted); }
.hero select {
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 13.5px;
    color: var(--ink);
}
.hero__spacer { flex: 1; }

/* 紧凑表格与状态说明 */
.cell-note { font-size: 11.5px; color: var(--muted); display: block; }
.cell-note--warn { color: var(--warn); }

/* 教务编号自成一列：等宽数字、不折行，未匹配用黄字而不是整格标红 */
.org-cell-edu { white-space: nowrap; }
.org-cell-edu__miss { color: var(--warn); font-size: 12px; cursor: help; }

@media (max-width: 1200px) {
    .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 行内小输入框（审核意见等） */
.input-mini {
    width: 130px;
    padding: 4px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font: inherit;
    font-size: 12.5px;
    color: var(--ink);
    vertical-align: middle;
}
.input-mini:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent);
}

/* ---------------- 基础字典页 ---------------- */

/* 字典表：编辑区作为独立一行展开，避免把行高撑开、也避免表单挤在窄列里 */
.dict-table td { vertical-align: middle; }

.dict-edit > td {
    background: #f7f9fb;
    border-top: 0;
}

/* 表格行上的 hidden 可能被浏览器默认 display 覆盖，这里显式声明 */
.dict-edit[hidden] { display: none; }

.dict-edit__panel {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    padding: 12px 4px 14px;
}

.form-grid--inline {
    flex: 1;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
}
.form-grid--inline .form-actions { grid-column: auto; padding-top: 0; }

.dict-edit__danger {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 2px;
}

/* 年级多选（学科管理）：按学段分组的小胶囊，隐藏原生复选框 */
.grade-picker {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfd;
}

.grade-picker__group {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.grade-picker__label {
    flex: 0 0 42px;
    padding-top: 5px;
    font-size: 12px;
    color: var(--muted);
}

.grade-picker__items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.grade-picker__item {
    position: relative;
    display: inline-flex;
}

.grade-picker__item input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.grade-picker__item span {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    font-size: 12.5px;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}

.grade-picker__item span:hover {
    border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
    color: var(--brand-ink);
}

.grade-picker__item input:checked + span {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-weight: 600;
}

.grade-picker__item input:focus-visible + span {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

/* 列表里的年级标签，一行放不下就换行 */
.grade-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

@media (max-width: 1100px) {
    .dict-edit__panel { flex-direction: column; align-items: stretch; }
    .form-grid--inline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================= AI 助手与 AI/MCP 配置页 ================= */

/* 表格里的操作按钮组：窄列里换行而不是被挤成一条 */
.row-ops {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* 长地址只占一行，超出用省略号，完整值放 title */
.cell-ellipsis {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 预设/提示用的横排 chip */
.hint-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0 0 12px;
}

/* 会话列表 + 对话区：左窄右宽，窄屏堆叠 */
.chat {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.chat__side {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.chat__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 46vh;
    overflow-y: auto;
}

.chat__session {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    color: var(--ink-soft);
}
.chat__session:hover {
    background: var(--brand-soft);
    text-decoration: none;
}
.chat__session.is-active {
    background: var(--brand-soft);
    border-left-color: var(--brand);
    color: var(--brand-ink);
    font-weight: 600;
}

.chat__session-title {
    display: block;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat__side-foot {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat__main {
    display: flex;
    flex-direction: column;
    min-height: 62vh;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.chat__title {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 650;
}

.chat__stream {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    overflow-y: auto;
    max-height: 58vh;
    background: var(--bg);
}

.chat__empty {
    margin: auto;
    text-align: center;
    max-width: 520px;
}
.chat__empty-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 650;
}
.chat__prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
}
.chat__prompts .chip { cursor: pointer; border: 0; }

/* 气泡：用户靠右、助手靠左，工具调用单独一列小卡 */
.msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 78%;
}
.msg__role {
    font-size: 11.5px;
    color: var(--muted);
}
.msg__body {
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    font-size: 13.5px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}
.msg--user {
    align-self: flex-end;
    align-items: flex-end;
}
.msg--user .msg__body {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.msg--assistant .msg__body {
    background: var(--panel);
}
.msg__body--muted {
    color: var(--muted);
    font-style: italic;
}

.msg--tool {
    align-self: flex-start;
    max-width: 78%;
    padding: 6px 10px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: var(--panel);
}
.msg--tool .msg__role { color: var(--brand-ink); font-weight: 600; }
.msg__detail > summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--muted);
}
.msg__pre {
    margin: 8px 0 0;
    max-height: 260px;
    overflow: auto;
    padding: 8px 10px;
    background: var(--bg);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.composer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 18px 16px;
    border-top: 1px solid var(--line);
    background: var(--panel);
}
.composer textarea {
    width: 100%;
    resize: vertical;
    min-height: 68px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.7;
}
.composer textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand-soft);
}
.composer textarea:disabled { background: var(--bg); color: var(--muted); }
.composer__ops {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

@media (max-width: 1100px) {
    .chat { grid-template-columns: minmax(0, 1fr); }
    .chat__side { position: static; }
    .chat__stream { max-height: none; }
    .msg, .msg--tool { max-width: 100%; }
    .cell-ellipsis { max-width: 160px; }
}

/* 列多的配置表在窄屏横向滚动，避免挤成一条 */

/* ===== 云文档：云盘浏览区 ===== */
.head-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head-ops { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.head-ops__search { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.head-ops__search input[type="search"] {
    width: 190px;
    padding: 6px 10px;
    font-size: 12.5px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
.head-ops__search select {
    padding: 5px 8px;
    font-size: 12.5px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

/* 云盘目录面包屑：层级多时自动折行，不撑破卡片 */
.crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0 0 10px;
    font-size: 12.5px;
    color: var(--muted);
}
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { color: var(--line-strong); }

/* 浅底卡片：用于说明类区块，视觉上不与数据表争抢注意力 */
.plain-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.9; color: var(--ink-soft); }
.plain-list code { font-size: 12px; }

@media (max-width: 860px) {
    .head-ops { justify-content: flex-start; }
    .head-ops__search input[type="search"] { width: 100%; }
}

/* ---------------- 文件预览页（Material/Preview，独立整页，不走布局） ----------------
   原来写在页面 <style> 里，按组件层护栏挪到这里；改版式只改这一段。 */

html, body { height: 100%; }
body.pv {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
}
.pv__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
}
.pv__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pv__meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pv__ops { margin-left: auto; display: flex; align-items: center; gap: 6px; }
/* 弹层里才出现的一组操作。display: contents 让里面两颗按钮直接参与 .pv__ops 的
   flex 排布，跟「下载」保持同样的间距，不额外多一层盒子 */
.pv__embed-ops { display: contents; }
/* 窄屏里「可编辑 / 下载 / 新窗口打开 / 关闭」就占掉大半行，先牺牲大小与类型，
   文件名留个最小宽度，不然会被挤成看不见 */
@media (max-width: 720px) {
    .pv__meta { display: none; }
    .pv__name { flex: 1 1 auto; min-width: 4em; }
}
/* 手机竖屏：类型标签也让位给文件名，「可编辑」那类状态标签在 .pv__ops 里，不受影响 */
@media (max-width: 520px) {
    .pv__bar > .chip { display: none; }
}
/* 再窄就把工具条收紧一点，保证「关闭」不会被面板裁掉 */
@media (max-width: 380px) {
    .pv__bar { padding: 8px 10px; gap: 6px; }
    .pv__ops { gap: 4px; }
    .pv__ops .btn--mini { padding: 0 6px; }
}
.pv__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
}
.pv__body--center { align-items: center; }
.pv__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
}
.pv__frame { width: 100%; height: 100%; border: 0; background: #4a4f57; }
.pv__video { max-width: 100%; max-height: 100%; margin: auto; display: block; background: #000; }
.pv__audio { width: min(560px, 90%); margin: auto; }
.pv__audio-wrap { margin: auto; text-align: center; padding: 40px 0; }
.pv__audio-wrap p { color: var(--muted); margin: 6px 0 20px; }
.pv__text {
    margin: 0;
    padding: 18px 22px;
    width: 100%;
    font: 13px/1.75 Menlo, Consolas, "Cascadia Mono", monospace;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--ink);
}
.pv__docx {
    width: 100%;
    padding: 16px;
    display: flex;
    justify-content: center;
}
.pv__docx .docx-wrapper {
    background: transparent;
    padding: 0;
}
.pv__docx .docx-wrapper > section.docx {
    box-shadow: var(--shadow);
    border-radius: 4px;
    margin-bottom: 16px;
}
.pv__sheet {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px 18px;
}
.pv__tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pv__tab {
    border: 1px solid var(--line-strong);
    background: var(--panel);
    color: var(--ink-soft);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
}
.pv__tab.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.pv__grid { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.pv__grid table { border-collapse: collapse; font-size: 12px; }
.pv__grid th, .pv__grid td {
    border: 1px solid var(--line);
    padding: 4px 8px;
    white-space: nowrap;
    text-align: left;
}
.pv__grid th { background: #f5f7fa; position: sticky; top: 0; font-weight: 600; }
.pv__grid td.row-no { background: #f5f7fa; color: var(--muted); text-align: right; position: sticky; left: 0; }
.pv__state {
    margin: auto;
    max-width: 460px;
    padding: 30px 24px;
    text-align: center;
    color: var(--muted);
}
.pv__state h2 { color: var(--ink); margin-bottom: 6px; font-size: 15px; }
.pv__state .pv__state-ops { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
.pv__spinner {
    width: 22px; height: 22px; margin: 0 auto 10px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: pv-spin .8s linear infinite;
}
@keyframes pv-spin { to { transform: rotate(360deg); } }
/* OnlyOffice 编辑器占满整块预览区；它自己带工具栏与滚动，外层不能再加滚动 */
.pv__body--office { overflow: hidden; position: relative; display: block; }
.pv__office { width: 100%; height: 100%; position: relative; }
.pv__office > div { width: 100%; height: 100%; }
.pv__office iframe { display: block; width: 100%; height: 100%; border: 0; }
.pv__loading {
    position: absolute;
    inset: 0;
    display: flex;
    background: var(--bg);
    z-index: 2;
}

/* 文件预览弹层：云文档页点「预览」就地盖一层 iframe，不跳转云盘。
   弹层本身不带标题栏——文件名、大小、下载、关闭都在预览页自己的 .pv__bar 上，
   免得同一个标题在上下两行里各出现一次 */
.pv-layer {
    position: fixed;
    inset: 0;
    /* layui 的弹层从 19891014 起算，预览层要能盖在课次弹窗之上（课程管理里就是弹窗中再开预览） */
    z-index: 19900100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.pv-layer[hidden] { display: none; }
.pv-layer__mask {
    position: absolute;
    inset: 0;
    background: rgba(13, 21, 33, .55);
}
.pv-layer__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1180px, 100%);
    height: min(88vh, 940px);
    background: var(--panel);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .3);
    overflow: hidden;
}
/* 面板靠脚本落焦（没有标题栏可聚焦），不画聚焦框 */
.pv-layer__panel:focus { outline: none; }
.pv-layer__frame {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: 0;
    background: var(--panel);
}
body.has-preview { overflow: hidden; }

@media (max-width: 860px) {
    .pv-layer { padding: 0; }
    .pv-layer__panel { width: 100%; height: 100%; border-radius: 0; }
}

/* ---------------- 云文档：左侧目录树 + 右侧列表 ---------------- */

.drive {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.drive__side {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--brand) 2.5%, #fff);
    padding: 10px 8px 12px;
    max-height: min(640px, calc(100vh - 320px));
    overflow: auto;
    position: sticky;
    /* 顶栏 56px 是 sticky 的，留出它的高度，滚动时树才不会被压住 */
    top: 68px;
}

.drive__side-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin: 0 4px 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--muted);
}

.drive__side-count { font-weight: 400; font-size: 11.5px; color: var(--muted); }

.drive__main { min-width: 0; }

/* 树本体 */
.tree, .tree__children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree__children {
    display: none;
    margin-left: 9px;
    padding-left: 6px;
    border-left: 1px dashed var(--line-strong);
}

.tree__node.is-open > .tree__children { display: block; }

.tree__row {
    display: flex;
    align-items: center;
    gap: 3px;
    border-radius: 6px;
    padding: 2px 6px 2px 1px;
    line-height: 1.5;
}
.tree__row:hover { background: color-mix(in srgb, var(--brand) 7%, #fff); }

.tree__toggle {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
}
.tree__toggle::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-left: 4px solid var(--muted);
    border-top: 3.5px solid transparent;
    border-bottom: 3.5px solid transparent;
    transition: transform .15s ease;
}
.tree__toggle:hover::before { border-left-color: var(--brand); }
.tree__node.is-open > .tree__row > .tree__toggle::before { transform: rotate(90deg); }
.tree__toggle.is-leaf { cursor: default; }
.tree__toggle.is-leaf::before { display: none; }

.tree__link {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    color: var(--ink-soft);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 1px 4px;
    border-radius: 4px;
}
.tree__link:hover { color: var(--brand); text-decoration: none; }
.tree__link.is-current {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}

@media (max-width: 1080px) {
    .drive { grid-template-columns: minmax(0, 1fr); }
    .drive__side {
        position: static;
        max-height: 280px;
    }
}

/* ---------------- 备授课：授课体系挑课（六维 chip + 卡片） ---------------- */

.picker {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 14px 4px;
    margin-bottom: 14px;
}

.picker__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.picker__count { margin: 0; font-size: 13px; color: var(--ink-soft); }
.picker__count strong {
    font-size: 15px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.picker__search { display: flex; align-items: center; gap: 6px; flex: 0 1 420px; }
.picker__search input[type="search"] {
    flex: 1 1 auto;
    min-width: 150px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}
.picker__search input[type="search"]:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

/* 一行一个维度，左侧固定宽度标签，右侧 chip 自动换行 */
.frow {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
}
.frow:last-child { border-bottom: 0; }
.frow__key {
    flex: 0 0 62px;
    width: 62px;
    padding-top: 4px;
    font-size: 12.5px;
    color: var(--muted);
}
.frow__val { display: flex; flex-wrap: wrap; gap: 5px; flex: 1 1 auto; min-width: 0; }
.frow__empty { padding-top: 5px; font-size: 12px; color: var(--muted); }

.fchip {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 12.5px;
    white-space: nowrap;
}
.fchip:hover { background: #f2f5f9; color: var(--ink); text-decoration: none; }
.fchip.is-on {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}

.teach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
    gap: 12px;
}

.teach {
    display: flex;
    flex-direction: column;
    padding: 12px 14px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.teach:hover { border-color: var(--line-strong); }

.teach__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
/* 只在备课中心的卡片里让自建标签更实一点，不动全局 .chip--brand */
.teach__tags .chip--brand {
    background: var(--brand-soft);
    border-color: transparent;
    color: var(--brand-ink);
    font-weight: 600;
}

.teach__title { margin: 0; font-size: 14.5px; line-height: 1.45; }
.teach__title a { color: var(--ink); }
.teach__title a:hover { color: var(--brand); text-decoration: none; }
.teach__sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.teach__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0 7px;
    font-size: 12px;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}
.teach__stu { margin-left: auto; color: var(--muted); }

/* 资料完成度：橙色进度条；没有课时时用虚线底表示「还没排」 */
.bar { height: 4px; border-radius: 999px; background: #edf0f4; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: #e0a53c; }
.bar--empty { background: repeating-linear-gradient(90deg, #eef1f5 0 6px, transparent 6px 12px); }

.teach__ops { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; }
.teach__ops .btn { flex: 1 1 0; height: 30px; font-size: 12.5px; }

@media (max-width: 860px) {
    .teach-grid { grid-template-columns: 1fr; }
    .picker__top { flex-direction: column; align-items: stretch; }
    .picker__search { flex: 1 1 auto; }
    .frow { flex-direction: column; gap: 2px; }
    .frow__key { flex: none; width: auto; padding-top: 0; }
}

/* ================= 通讯录（组织与人员） ================= */

/* 左树右表：树固定 250px，列表吃掉剩下的宽度 */
.org {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.org__side { padding: 14px 12px 16px; }
.org__side .card__head { margin-bottom: 10px; padding: 0 6px; }
.org__side .card__head h2 { font-size: 14px; }
.org__side-empty { margin: 6px 6px 0; text-align: left; }
.org__side-note { margin: 10px 6px 0; font-size: 11.5px; color: var(--muted); }

/* 标题栏右侧的小图标按钮（新建部门 / 同步）：只有图标，hover 才显底色 */
.org__head-ops { display: inline-flex; align-items: center; gap: 2px; }

.org__sync, .org__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color .15s, background .15s, border-color .15s;
}

.org__sync:hover, .org__icon:hover { color: var(--brand); background: var(--brand-soft); border-color: #cfe6db; }
.org__sync:disabled { opacity: .5; cursor: default; }
.org__sync svg { transition: transform .4s; }
.org__sync:disabled svg { transform: rotate(180deg); }

/* 「全部成员」是树的第 0 层，视觉上要跟部门行一致 */
.org-tree__all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.org-tree__all:hover { background: #f4f7fa; text-decoration: none; }
.org-tree__all.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.org-tree__all-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    flex: 0 0 auto;
}
.org-tree__all .org-tree__count { margin-left: auto; }

.org-tree, .org-tree__children { list-style: none; margin: 0; padding: 0; }
.org-tree__children { display: none; padding-left: 14px; }
.org-tree__node.is-open > .org-tree__children { display: block; }

.org-tree__row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px 6px 4px;
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 13px;
}

.org-tree__row:hover { background: #f4f7fa; }
.org-tree__node.is-active > .org-tree__row { background: var(--brand-soft); }

.org-tree__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: transform .15s;
}

.org-tree__node.is-open > .org-tree__row .org-tree__toggle { transform: rotate(90deg); }
.org-tree__toggle--none { cursor: default; }

.org-tree__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    text-decoration: none;
}

.org-tree__node.is-active > .org-tree__row .org-tree__name { color: var(--brand-ink); font-weight: 600; }

/* 重命名：节点名就地变输入框，不走弹窗 */
.org-tree__rename {
    flex: 1 1 auto;
    min-width: 0;
    height: 24px;
    padding: 0 6px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}

.org-tree__rename:focus {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.org-tree__count {
    flex: 0 0 auto;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #eef1f5;
    color: var(--muted);
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

/* 部门行的「⋯」：平时不占位，hover / 选中才浮出来 */
.org-tree__more {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
}

.org-tree__row:hover .org-tree__more,
.org-tree__node.is-active > .org-tree__row .org-tree__more { opacity: 1; }
.org-tree__more:hover { background: #e7edf3; color: var(--ink); }

/* ---- 部门右键菜单 ---- */
.org-menu { display: flex; flex-direction: column; min-width: 150px; }

.org-menu button {
    padding: 9px 14px;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.org-menu button:hover { background: #f4f7fa; color: var(--ink); }
.org-menu__danger { color: var(--danger) !important; }
.org-menu__danger:hover { background: var(--danger-soft) !important; }

/* layer 默认给内容加了内边距，菜单要贴边 */
.layui-layer.yimi-layer--menu { padding: 4px; border-radius: 10px; }
.yimi-layer--menu .layui-layer-content { padding: 0; }

/* ---- 右侧列表 ---- */
.org__main { padding: 12px 16px 6px; }

.org__tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.org__scope { color: var(--muted); font-size: 12.5px; }
.org__scope b { color: var(--ink); font-weight: 600; }

/* 新建部门：侧栏里就地一行输入，一次只填个名字，没必要弹窗 */
.org__new {
    display: grid;
    gap: 6px;
    margin: 10px 6px 0;
    padding: 8px;
    border: 1px dashed #cfe0d6;
    border-radius: 9px;
    background: var(--brand-soft);
}

.org__new[hidden] { display: none; }

.org__new input[type="text"] {
    width: 100%;
    height: 30px;
    padding: 0 9px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #fff;
    font: inherit;
    font-size: 12.5px;
}

.org__new input[type="text"]:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.org__new-ops { display: flex; gap: 6px; }

.org__bulk[hidden] { display: none; }
.org__bulk {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding: 4px 10px;
    border: 1px solid #cfe6db;
    border-radius: 9px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 12.5px;
}

.org__bulk-form { display: flex; align-items: center; gap: 6px; margin: 0; }

.org__bulk select {
    height: 26px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    font: inherit;
    font-size: 12px;
}

.org-table__check { width: 34px; text-align: center; }
.org-table__check input { width: auto; margin: 0; cursor: pointer; }
.org-table .js-org-check { width: auto; margin: 0; cursor: pointer; }

/* 行内是两行的（姓名 + 企微路径），所以单元格统一垂直居中，别贴顶 */
.org-table td, .org-table th { vertical-align: middle; }
.org-table td.org-table__check { text-align: center; }
.org-table td.org-table__check input { display: block; margin: 0 auto; }
/* 部门名不折行：「教学运营中心」拆成两行很难看 */
.org-table .org-cell-dept { white-space: nowrap; }

/* 账号 / 教务编号 / 手机都是等长短值，折一半就别读了。
   列多了以后容器窄会把这些列压到 60px，宁出横向滚动条也不压 */
.org-table td.mono,
.org-table .org-cell-edu { white-space: nowrap; }
/* .mono 本来是给行内 code 用的（带底纹和内边距），套到 td 上会变成一块小方块 */
.org-table td.mono,
.sg-table td.mono {
    background: none;
    border: 0;
    padding: 8px 12px;
    color: var(--ink);
    font-size: 13px;
}
.org-table { min-width: 1080px; }
/* DataTables 2.x 用的是 .dt-container（1.x 是 .dataTables_wrapper），两个都兜上：
   滚动条要出在表格这一块里，不能让整页横向溢出 */
.org__main .dt-container,
.org__main .dataTables_wrapper { width: 100%; max-width: 100%; overflow-x: auto; }

/* 姓名列：圆形首字 + 姓名 + 标签 */
.org-person { display: flex; align-items: center; gap: 9px; }

.org-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    background: #edf1f5;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
}

.org-person__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.org-person__name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
/* 姓名不许折行：列一窄就会被挤成「李 / 老 / 师」竖排 */
.org-person__name .link-strong { display: inline; white-space: nowrap; }
.org-person__body .cell-note { white-space: normal; }
.org-person__body .cell-note { margin-top: 1px; }

.org-ops { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
.org-ops form { margin: 0; }

/* ---- 新增成员的分裂按钮 ---- */
/* 类名原来也叫 .split，把上面那个两栏布局的 .split 覆盖成了 inline-flex，
   课程体系/企微设置那几页的两栏就塌成一行了。这里换成 .btn-split，各管各的 */
.btn-split { position: relative; display: inline-flex; gap: 0; }

.btn-split > .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.split__toggle {
    width: 30px;
    padding: 0;
    border-left: 1px solid rgba(255, 255, 255, .28);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.split__menu[hidden] { display: none; }
.split__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    min-width: 168px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    box-shadow: 0 8px 24px rgba(22, 32, 44, .12);
}

.split__menu button {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.split__menu button:hover { background: #f4f7fa; color: var(--ink); }

/* ---- 企微导入弹窗 ---- */
.org-import { display: flex; flex-direction: column; gap: 10px; }

.org-import__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 部门选择：输入框 + 展开的树，跟企微通讯录一致（边输边筛，点节点即选中） */
.org-pick { position: relative; flex: 0 0 270px; }

.org-pick__control {
    display: flex;
    align-items: center;
    height: 32px;
    padding-right: 3px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--panel);
}

.org-pick__control:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 107, 70, .1); }

.org-pick__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding: 0 10px;
    border: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    outline: none;
}

.org-pick__arrow {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.org-pick__arrow:hover { background: #f1f4f8; color: var(--ink); }
.org-pick__arrow svg { transition: transform .15s ease; }
.org-pick__arrow[aria-expanded="true"] svg { transform: rotate(180deg); }

.org-pick__panel {
    position: absolute;
    z-index: 9;
    top: calc(100% + 4px);
    left: 0;
    /* 比输入框（270px）宽一点：部门名常常更长，若按输入框宽会被省略号切掉 */
    width: 340px;
    max-width: calc(100vw - 40px);
    max-height: 300px;
    overflow: auto;
    padding: 5px 0;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(22, 32, 44, .14);
}

.org-pick__panel[hidden] { display: none; }

.org-pick__empty { margin: 0; padding: 11px 14px; color: var(--muted); font-size: 12.5px; }

.org-pick__children { margin: 0; padding: 0; list-style: none; }
.org-pick__children .org-pick__children { padding-left: 15px; }

.org-pick__node {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 3px 12px 3px 6px;
    color: var(--ink-soft);
    font-size: 13px;
    cursor: pointer;
}

.org-pick__node:hover { background: #f4f7fa; }
.org-pick__node.is-active { background: #eaf3ff; color: #1a6fd4; font-weight: 600; }

.org-pick__caret {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: rotate(90deg);
    transition: transform .14s ease;
}

.org-pick__caret.is-leaf { visibility: hidden; }
.org-pick__node.is-collapsed .org-pick__caret { transform: rotate(0deg); }
/* 折叠：node 后面紧跟的就是这层子部门 */
.org-pick__node.is-collapsed + .org-pick__children { display: none; }

.org-pick__label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.org-import__check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--ink-soft);
    cursor: pointer;
}

/* 搜人框：和部门选择器并排，故意窄一点，让「含下级」「刷新」还在第一行 */
.org-import__search { flex: 0 0 170px; display: block; }

.org-import__search input {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: var(--ink);
}

.org-import__search input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring, rgba(22, 104, 220, .14));
}

.org-import__search input::-webkit-search-cancel-button { cursor: pointer; }

/* 企微账号（企微 userid）：只展示不给改，所以干脆不做成输入框。
   灰底 + 锁图标 + 等宽字，一眼看出这是锁死的值而不是待填的空格。 */
.org-locked {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: #f3f5f8;
    color: var(--ink-soft);
    font-size: 13.5px;
    cursor: not-allowed;
    user-select: all;
}

.org-locked__icon { flex: 0 0 auto; color: var(--muted); }
.org-locked__id { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-locked__id.is-empty { color: var(--muted); cursor: default; }

.org-import__hint {
    padding: 7px 11px;
    border-radius: 8px;
    background: #f4f7fa;
    color: var(--ink-soft);
    font-size: 12.5px;
}

.org-import__hint--error { background: var(--danger-soft); color: var(--danger); }

.org-import__body { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.org-import__table { margin: 0; }

/* 姓名列窄的时候「已存在」标签会换行掉到名字下面，看着像串行，所以固定住 */
.org-import__table th:nth-child(2), .org-import__table td:nth-child(2) { min-width: 132px; }
.org-import__name { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.org-import__table th:last-child, .org-import__table td:last-child { white-space: nowrap; }
.org-import__table thead th { position: sticky; top: 0; z-index: 1; background: #f7f9fb; }
.org-import__table td { vertical-align: middle; }
.org-import__row--off { opacity: .55; }

.org-import__local { color: var(--ink); }
.org-import__local::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--ok);
    vertical-align: 2px;
}

@media (max-width: 1080px) {
    .org { grid-template-columns: 1fr; }
    .org__side { max-height: none; }
}

/* 窄屏先把邮箱列收起来，别让操作列被挤掉。断点看的是右侧内容区宽度而不是视口：
   左栏固定 290，1920 的屏幕内容区也可能只剩 1100，按视口算会误判 */
.org__main { container-type: inline-size; }
@container (max-width: 1140px) {
    .org-table .org-cell-mail { display: none; }
    .org-table { min-width: 900px; }
}
@media (max-width: 1320px) {
    .org-table .org-cell-mail { display: none; }
    .org-table { min-width: 900px; }
}

/* ---------------- 岗位与权限：左角色 + 右权限树 ---------------- */

.roles {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.roles__side .card__head { padding: 14px 16px; margin-bottom: 0; border-bottom: 1px solid var(--line); }
.roles__side .card__head h2 { font-size: 14px; }

.roles__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    max-height: calc(100vh - 260px);
    overflow-y: auto;
}

.role-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}

.role-item:hover { background: #f4f7fa; text-decoration: none; }
.role-item.is-on { background: var(--brand-soft); border-color: #cfe6db; }
.role-item.is-on .role-item__top b { color: var(--brand-ink); }

.role-item__top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13.5px; }
.role-item__top b { font-weight: 600; }
.role-item__meta { font-size: 11.5px; color: var(--muted); }

.roles__main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.perm-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.perm-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
    gap: 12px;
}

.perm-group {
    min-width: 0;
    margin: 0;
    padding: 10px 12px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fcfdff;
}

.perm-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 0 8px;
    margin-bottom: 4px;
    border-bottom: 1px dashed var(--line);
}

.perm-group__head label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.perm-group__count { font-size: 11.5px; color: var(--muted); }

.perm-group__items { display: flex; flex-direction: column; gap: 1px; }

/* 授权页里的版块小标题，与侧栏 .agroup__sub 同一套层级观感 */
.perm-group__sub {
    margin: 8px 0 2px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
}
.perm-group__sub:first-child { margin-top: 0; }

.perm-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 4px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.perm-item:hover { background: #f4f7fa; }
.perm-item input { margin: 0; }
.perm-item input:disabled + span { color: var(--muted); }

.roles__danger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    border-color: #f0c8c4;
}

.roles__danger h2 { margin-bottom: 4px; }
.roles__danger p { margin: 0; max-width: 560px; }

@media (max-width: 1080px) {
    .roles { grid-template-columns: minmax(0, 1fr); }
    .roles__list { max-height: 260px; }
}

/* ---------------- 岗位与权限：成员（角色 → 人） ---------------- */

.member-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.member-search input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}

.member-candidates {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: #fcfdff;
}

.member-candidate {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-candidate__body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13.5px;
}

.member-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.member-list__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px dashed var(--line);
}

.member-list__item:last-child { border-bottom: none; }

.member-list__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.member-list__name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13.5px;
}

.member-note { display: block; margin-top: 10px; }

/* 在岗成员 · 底部加人区：先查人，再选人，最后写回教务权限组 */
.member-add {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.member-add__search,
.member-add__pick {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.member-add__search input[type="search"],
.member-add__pick select {
    flex: 1 1 220px;
    min-width: 0;
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--ink);
    font: inherit;
}

.member-add__search input[type="search"]:focus,
.member-add__pick select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.member-list__action { margin-left: auto; flex: 0 0 auto; }

/* 加人弹窗：搜索框 + 可滚动的候选人清单 */
.role-pick__search { margin-bottom: 10px; }

.role-pick__search input[type="search"] {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--ink);
    font: inherit;
}

.role-pick__search input[type="search"]:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.role-pick {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 4px 6px;
}

.role-pick__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
}

.role-pick__item:hover { background: #f4f7fa; }
.role-pick__item input { flex: 0 0 auto; }
.role-pick__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.role-pick__body b { font-weight: 600; font-size: 13.5px; }
.role-pick__body .cell-note { margin: 0; }

/* ---------------- 成员弹窗：角色下拉多选 ---------------- */

.role-select { position: relative; width: 100%; min-width: 0; }

.role-select__control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.role-select__control:hover { border-color: #b9c9d6; }

.role-select.is-open .role-select__control {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.role-select__value {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-select__value.is-empty { color: var(--muted); }

.role-select__caret {
    flex: 0 0 auto;
    color: var(--muted);
    transition: transform .15s ease;
}

.role-select.is-open .role-select__caret { transform: rotate(180deg); }

/* 就地展开而不是浮层：layer 弹窗的内容区会裁掉溢出的 absolute 面板 */
.role-select__menu {
    margin-top: 6px;
    padding: 4px;
    max-height: 224px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(22, 40, 60, .08);
}

.role-select__menu[hidden] { display: none; }

.role-select__opt {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px;
    border-radius: 6px;
    font-size: 13.5px;
    line-height: 1.3;
    cursor: pointer;
}

.role-select__opt:hover { background: #f4f7fa; }
.role-select__opt span { flex: 1 1 auto; min-width: 0; }

/* 复选框外观统一由 ui.css 接管，这里只约束「不被 .field input 拉满宽」 */
.role-select .role-select__opt input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
}

/* ---------------- 章节体系：关联知识点 ---------------- */

.kn-link__head { margin: 0; font-weight: 600; }

.kn-picks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 10px;
    max-height: 330px;
    overflow-y: auto;
    padding: 4px 2px 2px;
}

.kn-group {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fcfdff;
}

.kn-group__title {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.kn-pick {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 2px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.kn-pick:hover { background: #f4f7fa; }

/* 复选框外观统一由 ui.css 接管（.field input 已排除 checkbox，不会再拉满宽） */
.kn-picks .kn-pick input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
}

.kn-pick > span:first-of-type {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------------- 教研体系 · 知识点目录树 ----------------
   一棵树 = 一条学科记录。树本身交给 jsTree（见 css/jstree-yimi.css），
   这里只管卡片外壳：标题、学科下拉、两个按钮、树的容器。 */

.kn-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.kn-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    /* 不能 hidden：头部的学段/学科下拉是绝对定位的，裁掉就看不见了 */
    overflow: visible;
}

.kn-panel__head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
    flex-wrap: wrap;
}

/* 左边一组：学科选择器 + 「＋ 一级目录」 */
.kn-panel__left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 学科选择器后面的「＋ 一级目录」：在树根上加一级目录 */
.kn-root-add {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 10px 0 8px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--panel);
    font-family: inherit;
    font-size: 13px;
    color: var(--ink-soft);
    white-space: nowrap;
    cursor: pointer;
}

.kn-root-add svg {
    width: 14px;
    height: 14px;
    color: var(--brand);
}

.kn-root-add:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand-ink);
}

.kn-panel__ops {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 学段（一级）/ 学科（二级）选择器：鼠标移入学段，右侧横移弹出这个学段的学科。
   纯 CSS hover，不用第三方下拉库；键盘 Tab 进来靠 :focus-within 也能展开。 */
.kn-scope {
    position: relative;
    margin: 0;
}

.kn-scope__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 168px;
    max-width: 260px;
    height: 30px;
    padding: 0 10px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    font-family: inherit;
}

.kn-scope__btn > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kn-scope__btn:hover,
.kn-scope:hover > .kn-scope__btn {
    border-color: var(--brand);
}

.kn-scope:hover > .kn-scope__btn {
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.kn-scope__caret {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: var(--muted);
    transition: transform .15s ease;
}

.kn-scope:hover .kn-scope__caret { transform: rotate(180deg); }

.kn-scope__menu {
    position: absolute;
    z-index: 40;
    top: 100%;
    left: 0;
    display: none;
    /* 用 padding 撑出空隙，别用 margin：鼠标从按钮下移到菜单上不会掉出 hover 区 */
    padding-top: 6px;
}

.kn-scope:hover .kn-scope__menu,
.kn-scope:focus-within .kn-scope__menu {
    display: block;
}

.kn-scope__stages {
    min-width: 128px;
    padding: 5px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(22, 32, 44, .14);
}

.kn-scope__stage {
    position: relative;
}

.kn-scope__stage-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px 7px 10px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--ink-soft);
    white-space: nowrap;
    cursor: default;
}

.kn-scope__stage:hover > .kn-scope__stage-label {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.kn-scope__stage.is-current > .kn-scope__stage-label {
    color: var(--brand);
    font-weight: 600;
}

.kn-scope__arrow {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    margin-left: 12px;
    color: var(--muted);
}

/* 二级：贴着一级那一行右侧，中间不留缝，鼠标直接横着移过去 */
.kn-scope__subs {
    position: absolute;
    top: -5px;
    left: calc(100% - 1px);
    display: none;
    min-width: 140px;
    padding: 5px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(22, 32, 44, .14);
}

.kn-scope__stage:hover > .kn-scope__subs {
    display: block;
}

/* 靠右边窗口时脚本加这个类，改到左边弹，免得被裁掉 */
.kn-scope__subs.is-flip {
    left: auto;
    right: calc(100% - 1px);
}

.kn-scope__sub {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--ink-soft);
    text-decoration: none;
    white-space: nowrap;
}

.kn-scope__sub:hover {
    background: var(--brand-soft);
    color: var(--brand-ink);
    text-decoration: none;
}

.kn-scope__sub.is-active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}

.kn-scope__tick {
    margin-left: auto;
    padding-left: 10px;
    color: var(--brand);
}

.kn-tree-box {
    padding: 10px 14px 14px;
    min-height: 220px;
}

/* 目录树不用铺满整张卡片，右边留白，行尾操作也够放 */
#kn-tree {
    max-width: 640px;
}

.kn-hint {
    margin: 0;
    padding: 0 20px 14px;
    font-size: 12px;
    color: var(--muted);
}

.kn-empty {
    padding: 26px 20px;
}

/* 空学科时那句提示在树容器里，别把卡片撑太高 */
.kn-empty--inline {
    padding: 6px 2px 12px;
    margin: 0;
    font-size: 13px;
}

/* ---------------- 学科组权限：顶栏筛选 + 左栏组列表 + 右栏成员表 ----------------
   版式对齐「教师分组」：左栏只有一条条组名和人数（没有目录树），
   点中那一行整行填成品牌色 —— 浅底在长列表里不够显眼，看不出「现在看的是哪一组」 */

.sgf {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
}

.sgf__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
}

.sgf__form input[type="search"],
.sgf__form select {
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}

.sgf__form input[type="search"] { width: 200px; }
.sgf__form select { min-width: 118px; }

.sgf__form input[type="search"]:focus,
.sgf__form select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.sgf__add { margin-left: auto; }

.sg {
    display: grid;
    grid-template-columns: 228px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.sg__side { padding: 8px 8px 10px; }

/* 左栏第 0 行「全部成员」：和组行同高，数字贴右边 */
.sg-all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.sg-all:hover { background: #f4f7fa; text-decoration: none; }
.sg-all.is-on { background: var(--brand); color: #fff; }
.sg-all__count { margin-left: auto; font-weight: 500; opacity: .8; }
.sg-all.is-on .sg-all__count { opacity: .92; }

/* 组名搜索：输入框 + 绿色圆钮，挤在一行里，不额外占高度 */
.sg__search {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 2px 8px;
    position: relative;
}

.sg__search input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 34px 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 12.5px;
}

.sg__search input[type="search"]:focus {
    outline: none;
    border-color: var(--brand);
}

.sg__search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
}

.sg__search-btn:hover { background: var(--brand-ink); }

.sg__list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.sg-row {
    display: flex;
    align-items: center;
    border-radius: 7px;
    color: var(--ink-soft);
}

.sg-row:hover { background: #f4f7fa; }

.sg-row__link {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 4px 8px 10px;
    color: inherit;
    font-size: 13px;
    text-decoration: none;
}

.sg-row__link:hover { text-decoration: none; }

.sg-row__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sg-row__count { flex: 0 0 auto; opacity: .7; }

.sg-row__flag {
    flex: 0 0 auto;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 10.5px;
}

/* 铅笔只在 hover / 选中行出现：平时列表要干净，一眼看的是组名和人数 */
.sg-row__edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin-right: 4px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, background .15s;
}

.sg-row:hover .sg-row__edit,
.sg-row.is-on .sg-row__edit { opacity: 1; }
.sg-row__edit:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }

/* 选中行整行填品牌色，文字转白 */
.sg-row.is-on { background: var(--brand); color: #fff; }
.sg-row.is-on .sg-row__count { opacity: .9; }
.sg-row.is-on .sg-row__edit { color: #fff; }
.sg-row.is-on .sg-row__edit:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.sg-row.is-on .sg-row__flag { background: rgba(255, 255, 255, .22); color: #fff; }

.sg__empty { margin: 8px 10px; text-align: left; }

.sg__foot {
    margin: 8px 10px 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--muted);
}

.sg__main { min-width: 0; }

/* 右栏顶部那一行：当前组 + 人数 + 学科范围，和「组织与人员」的范围行同一套 */
.sg__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
}

/* flex 子项默认按内容撑开，不给 min-width:0 会把右边那行说明顶出卡片 */
.sg__tools > * { min-width: 0; }

.sg__scope { color: var(--muted); font-size: 12.5px; }
.sg__scope b { color: var(--ink); font-weight: 600; font-size: 13.5px; }

/* 学科范围跟在人数后面同一行：.cell-note 是 block，这里得拉回 inline，
   否则「· 学科：…」会掉到第二行开头 */
.sg__scope .cell-note { display: inline; }

.sg__note { padding: 0 16px 12px; margin: 10px 0 0; }

/* 表格外层去掉 padding，让表头贴着卡片边（筛选栏已经在上面了） */
.sg__main .table { margin: 0; }
.sg__main .table th { white-space: nowrap; }

/* 列多（姓名/手机/部门/角色/学科/操作人/时间/状态/操作），窄屏放不下就横向滚，
   不要压成一行行竖排文字 —— 表格宽度按列上的 min-width 撑开。
   DataTables 会把表格包进自己的 .dt-layout-full，滚动条要挂在那里，
   否则「每页 N 条 / 第 1-2 条」这些控件会跟着一起滚 */
.sg__scroll { overflow-x: auto; }
.sg__scroll .table { min-width: 880px; }
.sg__main .dt-layout-full { overflow-x: auto; }

/* 表格贴卡片边，最后一列补回右边距，别让「操作」按钮顶到边框上 */
.sg__main .table th:last-child,
.sg__main .table td:last-child { padding-right: 18px; }

/* 时间不折行：折成两行会把整行撑高，看着像错位 */
.sg-table td.sg-dim { white-space: nowrap; }

/* 学科多选面板：按学段分档、档与档横向排开（学科一共就几门，
   一档一行的竖排会把卡片撑得很长），每档里学科再自动换行 */
.sg-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 26px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fcfdff;
}

.sg-pick__group { min-width: 0; }

.sg-pick__title {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--muted);
}

.sg-pick__items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.sg-pick__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* .field input 会把输入框拉满宽、加边框，复选框得显式还原，
   否则学科勾选项会变成一个个大盒子 */
.sg-pick__item input {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}
.sg-pick.is-off { opacity: .5; }

/* 成员表格：姓名是两行里的第一行，单元格统一垂直居中 */
.sg-table td { vertical-align: middle; }
.sg-table .org-avatar { flex: 0 0 auto; }

/* 次要信息列（角色 / 操作人 / 时间）。不要用 .cell-note —— 它是 display:block，
   套在 td 上会把单元格拖出表格行，整行的高低就对不齐了 */
.sg-table td.sg-dim { color: var(--ink-soft); font-size: 12.5px; }

.sg-person {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13.5px;
}

.sg-actions { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.sg-actions form { margin: 0; }

.sg-member__who {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 13.5px;
}

/* 编辑弹窗底部的删除区：和表单隔一条虚线，别让人手滑按到 */
.sg-edit__danger {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--line-strong);
}

.sg-edit__danger .cell-note { flex: 1 1 auto; }

/* 「添加人员」弹窗：上面搜、中间勾、下面确认 */
.sg-add__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sg-add__bar input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}

.sg-add__bar input[type="search"]:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.sg-add__list {
    max-height: 330px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fcfdff;
}

.sg-add__form .form-actions { margin-top: 12px; }

.sg-cand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
}

.sg-cand:hover { background: #f4f7fa; }

/* 复选框外观统一由 ui.css 接管 */
.sg-cand input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
}

.sg-cand__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sg-cand__name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
}

@media (max-width: 1080px) {
    .sg { grid-template-columns: minmax(0, 1fr); }
    .sg__list { max-height: 260px; }
    .sgf__form input[type="search"] { width: 100%; }
    .sgf__add { margin-left: 0; }
}
