:root {
  --primary: #1473E6;
  --primary-dark: #1473E6;
  --deep: #0E61C8;
  --light: #F1F7FF;
  --bg: #FCFDFC;
  --surface: #fff;
  --text: #142033;
  --muted: #6b7280;
  --border: #E2E8F0;
  --danger: #c04444;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
button, input, textarea, select { font: inherit; }
button, .button { min-height: 40px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; cursor: pointer; text-decoration: none; transition: .18s ease; }
.primary { color: white; background: var(--primary-dark); }
.primary:hover { background: var(--deep); transform: translateY(-1px); }
.ghost { color: var(--primary-dark); background: transparent; border: 1px solid var(--border); }
.ghost:hover { border-color: var(--primary); }
.small { min-height: 34px; padding-inline: 13px; font-size: 12px; }
.error { min-height: 20px; color: var(--danger); font-size: 13px; }
.login { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: var(--light); }
.login-card { width: min(420px, 100%); padding: 42px; display: grid; gap: 16px; background: white; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 24px 60px rgba(15,35,60,.12); }
.brand-mark { color: var(--primary); font-size: 14px; font-weight: 700; letter-spacing: .18em; }
.login-card h1 { margin: 0; font-size: 30px; }
.login-card p { margin: -8px 0 4px; color: var(--muted); }
.login-card label, .field-panel label, .field-label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.captcha-row { display: flex; align-items: stretch; gap: 10px; }
.captcha-row input { min-width: 0; flex: 1; text-transform: uppercase; }
#captcha-image { width: 132px; height: 46px; flex: 0 0 auto; cursor: pointer; background: var(--light); border: 1px solid var(--border); border-radius: 9px; }
input, textarea, select { width: 100%; padding: 11px 13px; color: var(--text); background: white; border: 1px solid var(--border); border-radius: 9px; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(20,115,230,.14); border-color: var(--primary); }
.topbar { min-height: 68px; padding: 12px 28px; position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 22px; color: white; background: var(--primary); }
.topbar > div:first-child { display: flex; align-items: center; gap: 13px; }
.topbar strong { color: white; font-size: 19px; }
.topbar span { color: white; font-size: 13px; opacity: .76; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.topbar .ghost { color: white; border-color: rgba(255,255,255,.24); }
.pending-badge { padding: 5px 10px; color: #cfe2ff; background: rgba(20,115,230,.12); border: 1px solid rgba(20,115,230,.3); border-radius: 999px; }
.view { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 70px; }
.view-head { margin-bottom: 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.view-head p { margin: 0 0 5px; color: var(--primary-dark); font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.view-head h1 { margin: 0; font-size: 30px; }
.view-actions { display: flex; gap: 9px; }
.import-status { min-height: 20px; margin: -16px 0 12px; color: var(--muted); font-size: 13px; text-align: right; }
.article-list { display: grid; gap: 10px; }
.article-row { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: white; border: 1px solid var(--border); border-radius: 14px; }
.article-summary { min-width: 0; flex: 1; }
.article-row h2 { margin: 0 0 8px; font-size: 17px; }
.article-row p { margin: 0; display: flex; flex-wrap: wrap; gap: 8px 13px; align-items: center; color: var(--muted); font-size: 12px; }
.article-row code { color: #9a8d7e; }
.status { padding: 2px 8px; border-radius: 999px; }
.status.live { color: #0D966A; background: #DFF8EE; }
.status.new-draft { color: #145da8; background: #eaf3ff; }
.status.edited-draft { color: #145da8; background: #eaf3ff; }
.row-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.row-actions button:disabled { cursor: default; opacity: .48; transform: none; }
.row-more-actions summary { min-height: 34px; padding-inline: 13px; font-size: 12px; }
.row-more-actions .action-menu { top: calc(100% + 8px); bottom: auto; z-index: 12; }
.empty { padding: 70px; color: var(--muted); text-align: center; background: white; border: 1px dashed var(--border); border-radius: 14px; }
#edit-form { display: grid; gap: 18px; }
.field-panel, .editor-panel { padding: 24px; background: white; border: 1px solid var(--border); border-radius: 16px; }
.field-panel { display: grid; gap: 15px; }
.field-panel small { font-weight: 400; opacity: .8; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.custom-select { position: relative; }
.select-trigger { width: 100%; padding: 0 13px; justify-content: space-between; color: var(--text); background: white; border: 1px solid var(--border); border-radius: 9px; text-align: left; }
.select-trigger:hover, .custom-select.open .select-trigger { border-color: var(--primary); }
.custom-select.open .select-trigger { outline: 2px solid rgba(20,115,230,.14); }
.select-chevron { color: var(--muted); transition: transform .18s ease; }
.custom-select.open .select-chevron { transform: rotate(180deg); }
.select-menu { width: 100%; margin-top: 7px; position: absolute; z-index: 20; overflow: hidden; background: white; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 45px rgba(15,35,60,.16); }
.select-options { max-height: 220px; padding: 7px; display: grid; gap: 2px; overflow-y: auto; }
.select-option { width: 100%; min-height: 40px; padding: 0 11px; justify-content: space-between; color: var(--text); background: transparent; border-radius: 8px; }
.select-option:hover { background: #F1F7FF; }
.select-option[aria-selected="true"] { color: var(--primary-dark); background: #EAF3FF; font-weight: 600; }
.option-check { opacity: 0; color: var(--primary-dark); }
.select-option[aria-selected="true"] .option-check { opacity: 1; }
.category-create { padding: 12px; background: #F7F9FC; border-top: 1px solid var(--border); }
.category-create > span { display: block; margin-bottom: 8px; color: var(--text); font-weight: 600; }
.category-create > div { display: flex; gap: 8px; }
.category-create input { min-width: 0; }
.category-create button { min-width: 68px; flex: 0 0 auto; white-space: nowrap; }
.category-create .error { min-height: 0; margin: 6px 2px 0; }
.editor-titlebar { align-items: flex-end; }
.editor-titlebar > div { display: grid; gap: 12px; }
.editor-titlebar > .status { margin-bottom: 4px; padding: 6px 12px; font-size: 13px; }
.back-button { min-height: auto; width: max-content; padding: 0; color: var(--muted); background: transparent; border-radius: 0; }
.back-button:hover { color: var(--primary-dark); }
.version-note { margin: -12px 0 18px; padding: 13px 16px; color: #365a78; background: #eef7ff; border: 1px solid var(--border); border-radius: 11px; font-size: 13px; }
.auto-meta { margin: 0; padding: 11px 13px; color: var(--muted); background: #F7F9FC; border-radius: 9px; font-size: 12px; }
.editor-head { margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.editor-head > div { display: flex; align-items: center; gap: 9px; }
.editor-head small { color: var(--muted); font-size: 12px; font-weight: 400; }
#upload-status { color: var(--muted); font-size: 12px; }
.editor-grid { min-height: 480px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#body { min-height: 480px; resize: vertical; font-family: inherit; font-size: 15px; line-height: 1.8; }
.preview { padding: 22px; overflow: auto; background: #F9FCFF; border: 1px solid var(--border); border-radius: 9px; line-height: 1.8; }
.preview:empty::before { content: "文章预览会显示在这里"; color: var(--muted); }
.preview h1, .preview h2, .preview h3 { color: var(--primary-dark); }
.preview img { max-width: 100%; }
.edit-actions { padding: 15px 18px; position: sticky; bottom: 14px; z-index: 5; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(75,34,26,.1); backdrop-filter: blur(10px); }
.save-button { background: white; }
.more-actions { position: relative; }
.more-actions summary { min-height: 40px; padding: 0 15px; display: flex; align-items: center; color: var(--muted); background: white; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 13px; list-style: none; }
.more-actions summary::-webkit-details-marker { display: none; }
.more-actions summary::after { content: "⌄"; margin-left: 7px; transition: transform .18s ease; }
.more-actions[open] summary::after { transform: rotate(180deg); }
.more-actions[open] summary { color: var(--primary-dark); border-color: var(--primary); }
.action-menu { min-width: 180px; padding: 7px; position: absolute; right: 0; bottom: calc(100% + 8px); display: grid; gap: 2px; background: white; border: 1px solid var(--border); border-radius: 11px; box-shadow: 0 14px 36px rgba(75,34,26,.16); }
.menu-action { width: 100%; min-height: 38px; padding: 0 11px; justify-content: flex-start; color: var(--text); background: transparent; border-radius: 7px; font-size: 13px; }
.menu-action:hover { background: #f1f7ff; }
.menu-action.danger { color: var(--danger); }
.menu-action.danger:hover { background: #fff0f0; }
#message { margin-left: 8px; color: var(--muted); font-size: 13px; }
.modal { position: fixed; inset: 0; z-index: 30; padding: 20px; display: grid; place-items: center; overflow-y: auto; overscroll-behavior: contain; background: rgba(0,0,0,.6); }
.modal-card { width: min(780px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: white; border-radius: 16px; overflow: hidden; }
.modal-card > div { padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.category-manager { width: min(680px, 100%); }
.modal-card > .modal-head { padding: 18px 20px; }
.modal-head > div { display: grid; gap: 4px; }
.modal-head small { color: var(--muted); font-size: 12px; font-weight: 400; }
.password-card { width: min(500px, 100%); }
.modal-card > .password-form { padding: 20px; display: grid; gap: 14px; border: 0; }
.password-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.password-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.password-form .error { margin: -4px 0 0; }
.password-actions { display: flex; justify-content: flex-end; gap: 9px; }
.modal-card > .category-manager-body { max-height: 68vh; padding: 20px; display: block; overflow-y: auto; border: 0; }
.manager-create { display: flex; gap: 9px; }
.manager-create input { min-width: 0; }
.manager-create button { flex: 0 0 auto; white-space: nowrap; }
.category-manager-list { margin-top: 8px; display: grid; gap: 8px; }
.category-manager-row { padding: 13px 14px; background: #f5f9fd; border: 1px solid var(--border); border-radius: 11px; }
.category-row-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.category-row-name { min-width: 0; display: grid; gap: 3px; }
.category-row-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-row-name span { color: var(--muted); font-size: 12px; }
.category-row-actions { display: flex; gap: 5px; }
.category-row-actions button { min-height: 32px; padding-inline: 10px; font-size: 12px; }
.category-row-actions .danger { color: var(--danger); }
.category-row-actions button:disabled { cursor: not-allowed; opacity: .45; }
.category-inline-panel { margin-top: 11px; padding-top: 11px; display: grid; gap: 9px; border-top: 1px solid var(--border); }
.category-inline-panel p { margin: 0; color: var(--muted); font-size: 12px; }
.category-rename-form { display: flex; gap: 8px; }
.category-rename-form input { min-width: 0; }
.category-inline-actions, .replacement-options { display: flex; flex-wrap: wrap; gap: 7px; }
.category-inline-actions button, .replacement-options button { min-height: 32px; padding-inline: 11px; font-size: 12px; }
.confirm-danger { color: white; background: var(--danger); }
.replacement-options button { color: var(--primary-dark); background: white; border: 1px solid var(--border); }
.replacement-options button:hover { border-color: var(--primary); background: #eaf3ff; }
.build-card { width: min(780px, 100%); }
#build-log { max-height: 62vh; margin: 0; padding: 18px; overflow: auto; color: var(--muted); background: #f5f9fd; white-space: pre-wrap; font-size: 12px; }
.admin-shell { min-height: 100vh; padding-left: 238px; }
.sidebar { width: 238px; position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; color: #dbeaff; background: #102f55; box-shadow: 8px 0 28px rgba(10,40,75,.12); }
.sidebar-brand { height: 86px; padding: 20px 24px; display: grid; align-content: center; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand span { color: #78b8ff; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.sidebar-brand strong { margin-top: 3px; color: white; font-size: 20px; }
.sidebar nav { padding: 20px 13px; display: grid; gap: 5px; }
.sidebar nav > p { margin: 17px 11px 5px; color: rgba(219,234,255,.48); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.sidebar nav > p:first-child { margin-top: 0; }
.sidebar-link { width: 100%; min-height: 44px; padding: 0 13px; justify-content: space-between; color: #dbeaff; background: transparent; border-radius: 10px; }
.sidebar-link:hover, .sidebar-link.active { color: white; background: rgba(92,166,255,.2); }
.sidebar-link b { min-width: 24px; padding: 3px 7px; color: #0f3865; background: #86c2ff; border-radius: 999px; font-size: 11px; }
.sidebar-account { margin-top: auto; padding: 19px 24px 22px; display: grid; gap: 4px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-account small { color: rgba(219,234,255,.55); }
.sidebar-account strong { color: white; }
.admin-main { min-width: 0; }
.topbar { color: var(--text); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); backdrop-filter: blur(16px); }
.topbar strong { color: var(--text); }
.topbar span { color: var(--muted); }
.topbar .ghost { color: var(--primary-dark); border-color: var(--border); }
.pending-badge { color: #145da8; background: #eaf3ff; border-color: #c7def8; }
.view-head > div > span { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }
.metric-grid { margin-bottom: 16px; padding: 0 18px; display: flex; align-items: center; background: white; border: 1px solid var(--border); border-radius: 10px; }
.metric-grid article { min-width: 150px; padding: 15px 22px; display: flex; align-items: baseline; gap: 10px; border-right: 1px solid var(--border); }
.metric-grid article:first-child { padding-left: 0; }
.metric-grid article:last-child { border-right: 0; }
.metric-grid small { color: var(--muted); font-size: 12px; }
.metric-grid strong { color: #12365f; font-size: 20px; }
.table-card { overflow-x: auto; overflow-y: hidden; background: white; border: 1px solid var(--border); border-radius: 10px; scrollbar-color: #b8c7d8 #f2f5f8; scrollbar-width: thin; }
.table-card::-webkit-scrollbar { height: 9px; }
.table-card::-webkit-scrollbar-track { background: #f2f5f8; }
.table-card::-webkit-scrollbar-thumb { background: #b8c7d8; border: 2px solid #f2f5f8; border-radius: 999px; }
.data-list { min-width: 1320px; }
.data-row { display: grid; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.data-row:last-child { border-bottom: 0; }
.data-head { min-height: 44px; padding-block: 11px; color: var(--muted); background: #f7f9fb; font-size: 12px; font-weight: 600; }
.consultation-row { grid-template-columns: 44px 76px 108px 76px 82px 66px 112px 150px 68px 102px 214px; }
.teacher-row { grid-template-columns: 1.45fr .85fr .45fr .65fr .55fr .9fr; }
.data-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.phone-link { color: var(--text); font-size: 12px; font-weight: 600; text-decoration: none; }
.page { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.created,.teacher-name { font-size: 12px; }
.created { color: var(--muted); }
.sequence,.call-count { color: var(--muted); font-size: 12px; }
.user-name,.location,.unadded-reason,.note-summary,.consultation-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.consultation-row > :last-child { position: sticky; right: 0; z-index: 2; min-height: 100%; align-content: center; background: #fff; box-shadow: -10px 0 14px -14px rgba(19,48,79,.75); }
.consultation-row.data-head > :last-child { z-index: 3; background: #f7f9fb; }
.consultation-row .row-actions { gap: 5px; flex-wrap: nowrap; }
.consultation-row .row-actions button { min-height: 29px; padding-inline: 9px; font-size: 11px; }
.inline-follow-form { display: contents; }
.inline-follow-form select { padding: 8px 10px; font-size: 13px; }
.inline-note { min-width: 0; display: grid; gap: 4px; }
.inline-note textarea { height: 54px; min-height: 54px; padding: 7px 10px; overflow: hidden; resize: none; font-size: 13px; line-height: 1.5; }
.note-toggle { width: max-content; min-height: 22px; padding: 0; color: var(--primary-dark); background: transparent; border-radius: 0; font-size: 11px; }
.note-toggle:hover { text-decoration: underline; }
.inline-follow-actions { display: grid; justify-items:start; gap: 2px; }
.inline-follow-actions .save-state { min-height: 14px; margin: 0; white-space: nowrap; }
.consultation-note-card { width: min(680px, 100%); }
.consultation-note-form { padding: 22px; display: grid; gap: 18px; }
.note-card-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.note-card-summary > div { padding: 14px 16px; display: grid; gap: 5px; background: #f5f9fd; border-radius: 9px; }
.note-card-summary small { color: var(--muted); font-size: 11px; }
.note-card-summary strong { font-size: 15px; }
.consultation-note-form > label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.consultation-note-form select { max-width: 180px; }
.consultation-note-form textarea { min-height: 230px; resize: vertical; line-height: 1.7; }
.note-card-footer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; align-items:center; }
.note-card-footer > span { color: var(--muted); font-size: 11px; }
.note-card-footer > p { margin: 0; color: var(--danger); font-size: 12px; }
.teacher-identity { display: flex; align-items: center; gap: 12px; }
.teacher-identity img { width: 48px; height: 48px; object-fit: cover; border: 1px solid var(--border); border-radius: 8px; }
.teacher-state { width: max-content; padding: 4px 9px; border-radius: 999px; font-size: 12px; }
.teacher-state.enabled { color: #087a56; background: #dff8ee; }
.teacher-state.disabled { color: #7b8190; background: #edf0f4; }
.row-actions .danger { color: var(--danger); }
.teacher-card { width: min(760px, 100%); }
.consultation-user-card { width: min(760px, 100%); }
.teacher-card > .modal-head,.consultation-user-card > .modal-head { flex: 0 0 auto; }
.teacher-form { min-height: 0; padding: 20px; display: grid; gap: 18px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.teacher-form::-webkit-scrollbar { width: 8px; }
.teacher-form::-webkit-scrollbar-track { background: #f3f6f9; }
.teacher-form::-webkit-scrollbar-thumb { background: #bdc9d6; border: 2px solid #f3f6f9; border-radius: 999px; }
.teacher-form > .password-actions { margin: 0 -4px -4px; padding: 12px 4px 4px; position: sticky; bottom: 0; z-index: 2; background: linear-gradient(180deg,rgba(255,255,255,0),#fff 24%); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.teacher-form label, .qr-field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.teacher-form label small { font-size: 11px; }
.qr-upload { min-height: 132px; padding: 14px; gap: 16px; color: var(--primary-dark); background: #f5f9fd; border: 1px dashed #9dc9f7; border-radius: 13px; }
.qr-upload img { width: 102px; height: 102px; object-fit: contain; background: white; border-radius: 7px; }
.switch-row { display: flex !important; align-items: center; gap: 9px !important; color: var(--text) !important; }
.switch-row input { width: 17px; height: 17px; }
.teacher-session #pending-badge { display: none !important; }
.settings-panel { padding: 22px 24px; display: flex; align-items:center; justify-content:space-between; gap: 30px; background:#fff; border:1px solid var(--border); border-radius:10px; }
.settings-panel > div { max-width:720px; }
.settings-panel strong { display:block; margin-bottom:7px; font-size:16px; }
.settings-panel p { margin:0; color:var(--muted); font-size:13px; line-height:1.7; }
.settings-panel button { flex:0 0 auto; }
@media (max-width: 760px) {
  .topbar, .view-head, .article-row { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; flex-wrap: wrap; }
  .view-actions { width: 100%; }
  .view-actions button { flex: 1; }
  .field-row, .editor-grid { grid-template-columns: 1fr; }
  .view { width: min(100% - 28px, 1120px); padding-top: 28px; }
  .row-actions { width: 100%; }
  .row-actions > button, .row-more-actions { flex: 1; }
  .row-more-actions summary { width: 100%; justify-content: center; }
  .edit-actions { flex-wrap: wrap; }
  #message { width: 100%; margin: 4px 0 0; }
  .login-card { padding: 30px 24px; }
  .manager-create, .category-row-main, .category-rename-form { align-items: stretch; flex-direction: column; }
  .admin-shell { padding: 0 0 72px; }
  .sidebar { width: auto; height: 64px; inset: auto 10px 8px; flex-direction: row; border-radius: 16px; }
  .sidebar-brand, .sidebar-account, .sidebar nav > p { display: none; }
  .sidebar nav { width: 100%; padding: 7px; display: flex; gap: 5px; overflow-x:auto; }
  .sidebar-link { min-height: 50px; flex: 1; padding: 0 8px; justify-content: center; }
  .sidebar-link b { margin-left: 6px; }
  .topbar { position: static; }
  .metric-grid { padding: 0; overflow-x: auto; }
  .metric-grid article { min-width: 120px; padding: 13px 16px; }
  .metric-grid article:first-child { padding-left: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { padding: 10px; place-items: start center; }
  .modal-card { max-height: calc(100dvh - 20px); }
  .teacher-form { padding: 17px; }
  .consultation-row { grid-template-columns: 44px 76px 108px 76px 82px 66px 112px 150px 68px 102px 214px; }
  .note-card-summary { grid-template-columns: 1fr; }
  .note-card-footer { grid-template-columns: 1fr 1fr; }
  .note-card-footer > p { grid-column: 1 / -1; grid-row: 2; }
  .settings-panel { align-items:stretch; flex-direction:column; }
}
