/* ================= 后台框架 ================= */
.section-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.section-shell.no-nav { grid-template-columns: minmax(0, 1fr); }
.section-nav {
  position: sticky; top: 5rem; display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.5rem; border-radius: 1rem; background: var(--md-sys-color-surface-container-low);
}
.section-nav-group {
  font-size: 0.75rem; font-weight: 600; color: var(--md-sys-color-on-surface-variant);
  padding: 0.75rem 0.75rem 0.25rem; letter-spacing: 0.02em;
}
.section-nav-group:first-child { padding-top: 0.35rem; }
.section-nav a {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem; border-radius: 999px;
  color: var(--md-sys-color-on-surface); text-decoration: none; font-size: 0.92rem; white-space: nowrap;
}
.section-nav a .material-icons { font-size: 1.15rem; color: var(--md-sys-color-on-surface-variant); }
.section-nav a:hover { background: var(--md-sys-color-surface-container); }
.section-nav a.active { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); font-weight: 600; }
.section-nav a.active .material-icons { color: inherit; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-bottom: 1.25rem; }
.section-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.section-actions:empty { display: none; }
.min-w-0 { min-width: 0; }
@media (max-width: 991.98px) {
  .section-shell { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .section-nav {
    position: static; flex-direction: row; overflow-x: auto; padding: 0.35rem; scrollbar-width: none;
  }
  .section-nav::-webkit-scrollbar { display: none; }
  .section-nav-group { display: none; }
  .section-nav a { flex-shrink: 0; padding: 0.4rem 0.8rem; }
}

/* 后台表格与小部件 */
.admin-table { width: 100%; }
.admin-table td, .admin-table th { vertical-align: middle; }
.admin-table .actions { text-align: right; white-space: nowrap; }
.admin-table td { padding-top: 0.35rem; padding-bottom: 0.35rem; }
.admin-table tbody tr { height: 3.1rem; }
.act-placeholder { display: inline-block; visibility: hidden; padding: 0 12px; font-size: 0.875rem; }
.admin-table tr.muted td:not(.actions) { opacity: 0.55; }
.row-title { font-weight: 500; color: inherit; text-decoration: none; }
a.row-title:hover { color: var(--md-sys-color-primary); text-decoration: underline; }
.badge-row { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; vertical-align: middle; }
.m3-badge.role-super_admin { background: var(--md-sys-color-tertiary-container, #ffd8e4); color: var(--md-sys-color-on-tertiary-container, #31111d); }
.m3-badge.role-campus_admin { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.m3-badge.role-operator { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-badge.role-user { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface-variant); }
.icon-btn-form { display: inline; }
.admin-table .order-column { width: 5.5rem; padding-inline: .5rem; }
.move-btns { display: inline-flex; gap: 0; vertical-align: middle; }
.move-btns > .icon-btn-form { display: flex; flex: 0 0 32px; }
.move-btns md-icon-button { --md-icon-button-icon-size: 20px; --md-icon-button-state-layer-width: 32px; --md-icon-button-state-layer-height: 32px; width: 32px; height: 32px; }
.move-btns .material-icons { flex: none; width: 1em; overflow: hidden; }
.qr-mini {
  width: 32px; height: 32px; object-fit: contain; border-radius: 0.4rem;
  border: 1px solid var(--md-sys-color-outline-variant); background: #fff; cursor: zoom-in; vertical-align: middle;
}
.admin-table tr[draggable="true"] { cursor: grab; }
.admin-table tr[draggable="true"].dragging { opacity: 0.45; }
@media (max-width: 767.98px) {
  .admin-table th.actions, .admin-table td.actions {
    position: sticky; right: 0; z-index: 2;
    background: var(--md-sys-color-surface-container-lowest);
    box-shadow: -6px 0 10px -6px rgba(0, 0, 0, 0.14);
  }
  .admin-table thead th.actions { background: var(--md-sys-color-surface-container-low); }
}
.seg-tabs { display: inline-flex; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 999px; overflow: hidden; }
.seg-tabs a {
  padding: 0.4rem 1rem; text-decoration: none; color: var(--md-sys-color-on-surface); font-size: 0.9rem;
  border-left: 1px solid var(--md-sys-color-outline-variant);
}
.seg-tabs a:first-child { border-left: 0; }
.seg-tabs a.active { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); font-weight: 600; }
.seg-tabs .n { font-size: 0.8rem; opacity: 0.75; margin-left: 0.25rem; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.cat-chips a {
  padding: 0.3rem 0.85rem; border-radius: 0.5rem; border: 1px solid var(--md-sys-color-outline-variant);
  text-decoration: none; color: var(--md-sys-color-on-surface); font-size: 0.88rem;
}
.cat-chips a.active { background: var(--md-sys-color-secondary-container); border-color: transparent; font-weight: 600; }
.cat-chips .n { opacity: 0.65; margin-left: 0.2rem; font-size: 0.8rem; }

/* Markdown 编辑器：左写右看 */
.md-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.md-editor textarea {
  width: 100%; min-height: 26rem; resize: vertical; padding: 0.85rem 1rem; border-radius: 0.75rem;
  border: 1px solid var(--md-sys-color-outline); background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface); font: 0.9rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.md-editor textarea:focus { outline: 2px solid var(--md-sys-color-primary); outline-offset: -1px; }
.md-preview {
  min-height: 26rem; max-height: 70vh; overflow-y: auto; padding: 0.85rem 1rem; border-radius: 0.75rem;
  border: 1px dashed var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface-container-lowest, var(--md-sys-color-surface));
}
.md-pane-label { font-size: 0.8rem; color: var(--md-sys-color-on-surface-variant); margin-bottom: 0.35rem; display: flex; gap: 0.5rem; }
@media (max-width: 767.98px) {
  .md-editor { grid-template-columns: 1fr; }
  .md-editor textarea, .md-preview { min-height: 14rem; }
}
.stat-inline { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.9rem; }
.stat-inline b { font-size: 1.1rem; }
.audit-detail { font-size: 0.85rem; word-break: break-all; color: var(--md-sys-color-on-surface-variant); }
.audit-time { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.85rem; }

/* ================= 首页：QQ 群卡片里折叠的常用网址 / 电话 ================= */
.fold-row { border-top: 1px solid var(--md-sys-color-surface-container); }
.fold-row > summary {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1.5rem; cursor: pointer; list-style: none;
  font-size: 0.92rem; font-weight: 500;
}
.fold-row > summary::-webkit-details-marker { display: none; }
.fold-row > summary:hover { background: var(--md-sys-color-surface-container-low); }
.fold-row > summary .lead { font-size: 1.15rem; color: var(--md-sys-color-primary); }
.fold-row > summary .n {
  font-size: 0.75rem; font-weight: 600; padding: 0 0.45rem; border-radius: 999px;
  background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface-variant);
}
.fold-row > summary .hint { font-size: 0.8rem; font-weight: 400; color: var(--md-sys-color-on-surface-variant); }
.fold-row > summary .chevron { margin-left: auto; color: var(--md-sys-color-on-surface-variant); transition: transform 0.15s; }
.fold-row[open] > summary .chevron { transform: rotate(180deg); }
.m3-card .fold-row:last-child:not([open]) > summary { border-radius: 0 0 var(--md-shape-card) var(--md-shape-card); }
.fold-body { padding: 0 1.5rem 1rem; }
.qq-card .qq-others-list { margin-top: 0; }
.contact-list { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.9rem; line-height: 1.5; }
.contact-list li {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.15rem 0.75rem;
  padding: 0.4rem 0; border-bottom: 1px dashed var(--md-sys-color-surface-container);
}
.contact-list li:last-child { border-bottom: 0; }
.contact-list .contact-label { color: var(--md-sys-color-on-surface); min-width: 0; }
.contact-list a { color: var(--md-sys-color-primary); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.contact-list a:hover { text-decoration: underline; }
.contact-list a[target="_blank"]::after {
  content: 'open_in_new'; font-family: 'Material Icons'; font-size: 0.85em; margin-left: 0.15em;
  vertical-align: -0.1em; opacity: 0.7; font-weight: normal;
}
.contact-list .contact-phone { font-variant-numeric: tabular-nums; white-space: nowrap; }
.contact-list .contact-more { justify-content: flex-end; font-size: 0.85rem; }

/* 公告编辑：图片区。插进正文的图片角上标"正文" */
.ann-images .m3-upload-grid { margin-top: 0; }
.ann-images .m3-upload-item img { cursor: zoom-in; }
.ann-inline-badge {
  position: absolute; top: 4px; right: 4px; padding: 0 0.4rem; border-radius: 0.5rem; font-size: 0.7rem; line-height: 1.3rem;
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
}

/* 长正文由 md-dialog 自己滚动（正文不再另设滚动区，否则会出现两条滚动条）；
   滚动条颜色 / 粗细是可继承属性，设在弹窗上能传进组件内部的滚动区 */
md-dialog, .md-preview, .qq-others-list { scrollbar-width: thin; scrollbar-color: var(--md-sys-color-outline-variant) transparent; }
.md-preview::-webkit-scrollbar, .qq-others-list::-webkit-scrollbar { width: 6px; }
.md-preview::-webkit-scrollbar-thumb, .qq-others-list::-webkit-scrollbar-thumb {
  background: var(--md-sys-color-outline-variant); border-radius: 3px;
}

/* 公告编辑：工具条、校区勾选 */
.md-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-bottom: 0.75rem; }
.campus-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.1rem 0.75rem; margin-bottom: 0.25rem; }
/* 编辑器所在区域不够宽时（如公告编辑页左栏），预览排到正文下面 */
.md-editor-host { container-type: inline-size; }
@container (max-width: 560px) {
  .md-editor { grid-template-columns: 1fr; }
  .md-editor textarea { min-height: 16rem; }
  .md-editor .md-preview { min-height: 8rem; max-height: none; }
}

/* Markdown 快捷排版栏 & 快捷排查流程图总览 */
.md-pane-label { align-items: center; }
.md-format-bar { display: inline-flex; gap: 0.2rem; }
.md-format-bar button {
  display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem;
  border: 1px solid var(--md-sys-color-outline-variant); border-radius: 0.4rem;
  background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface-variant); cursor: pointer;
}
.md-format-bar button:hover { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.md-format-bar .material-icons { font-size: 1rem; }

.gflow-canvas { flex: 1; overflow: auto; padding: 1.25rem; background: var(--md-sys-color-surface-container-lowest); border-radius: 0 0 var(--md-shape-card) var(--md-shape-card); }
.gflow-branch { display: flex; align-items: flex-start; gap: 1.25rem; }
.gflow-branch + .gflow-branch { margin-top: 0.75rem; }
.gflow-card {
  display: flex; flex-direction: column; gap: 0.15rem; width: 14rem; flex-shrink: 0;
  padding: 0.55rem 0.75rem 0.35rem; border-radius: 0.75rem; color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface); border: 1.5px solid var(--md-sys-color-outline-variant); transition: border-color 0.15s, box-shadow 0.15s;
}
.gflow-link { display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none; color: inherit; min-width: 0; }
.gflow-card:hover { border-color: var(--md-sys-color-primary); box-shadow: var(--md-elevation-1); }
.gflow-card.selected { background: var(--md-sys-color-secondary-container); border-color: var(--md-sys-color-primary); }
.gflow-card.issue { border-color: var(--md-sys-color-error); }
.gflow-card.is-leaf:not(.issue):not(.selected) { border-style: dashed; border-color: var(--md-sys-color-primary); }
.gflow-head { display: flex; align-items: center; gap: 0.35rem; font-weight: 600; font-size: 0.88rem; }
.gflow-head .material-icons { font-size: 1.05rem; color: var(--md-sys-color-primary); flex-shrink: 0; }
.gflow-card.issue .gflow-head .material-icons { color: var(--md-sys-color-error); }
.gflow-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.gflow-stat { font-size: 0.7rem; padding: 0 0.4rem; border-radius: 0.5rem; background: var(--md-sys-color-surface-container-high); font-weight: 500; flex-shrink: 0; }
.gflow-meta { font-size: 0.78rem; color: var(--md-sys-color-on-surface-variant); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gflow-actions { display: flex; justify-content: flex-end; gap: 0.1rem; opacity: 0; transition: opacity 0.12s; }
.gflow-card:hover .gflow-actions, .gflow-card:focus-within .gflow-actions, .gflow-card.selected .gflow-actions { opacity: 1; }
@media (hover: none) { .gflow-actions { opacity: 0.85; } }
.gflow-actions button { border: 0; background: none; padding: 0.18rem; border-radius: 999px; color: var(--md-sys-color-on-surface-variant); cursor: pointer; display: inline-flex; }
.gflow-actions button:hover { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-primary); }
.gflow-actions .material-icons { font-size: 0.95rem; }
.gflow-children { position: relative; padding-left: 1.25rem; border-left: 1.5px solid var(--md-sys-color-outline-variant); }
.gflow-children > .gflow-branch { position: relative; }
.gflow-children > .gflow-branch::before {
  content: ""; position: absolute; left: -1.25rem; top: 1.2rem; width: 1.25rem; border-top: 1.5px solid var(--md-sys-color-outline-variant);
}

/* 快捷排查草稿工作台、双模式开关、历史版本与撤销浮条 */
.guide-workbench-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem;
  padding: 0.6rem 0.9rem; margin-bottom: 1rem; border-radius: var(--md-shape-card);
  background: var(--md-sys-color-surface-container-lowest); border: 1px solid var(--md-sys-color-outline-variant); box-shadow: var(--md-elevation-1);
}
@media (min-width: 992px) { .guide-workbench-bar { position: sticky; top: 4.25rem; z-index: 15; } }
.guide-wb-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.guide-dirty-pill { font-size: 0.82rem; padding: 0.25rem 0.7rem; border-radius: 999px; background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant); }
.guide-dirty-pill.is-dirty { background: var(--md-custom-warning-container, #fff4d6); color: var(--md-custom-on-warning-container, #3d2e00); font-weight: 600; }
.guide-mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.guide-mode-switch[hidden] { display: none; }
@media (max-width: 575.98px) { .guide-mode-switch { grid-template-columns: 1fr; } }
.guide-mode-btn {
  display: flex; align-items: flex-start; gap: 0.55rem; text-align: left; padding: 0.6rem 0.8rem; border-radius: 0.75rem;
  border: 1.5px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface); cursor: pointer;
}
.guide-mode-btn .material-icons { color: var(--md-sys-color-primary); margin-top: 0.1rem; }
.guide-mode-btn span { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.88rem; }
.guide-mode-btn small { font-size: 0.76rem; color: var(--md-sys-color-on-surface-variant); }
.guide-mode-btn.active { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-secondary-container); }
.guide-hist-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border-radius: 0.6rem; border: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface-container-lowest); }
.guide-move-list { display: flex; flex-direction: column; gap: 0.2rem; max-height: 55vh; overflow-y: auto; }
.guide-move-opt { display: flex; align-items: center; gap: 0.45rem; width: 100%; border: 1px solid transparent; background: transparent; padding: 0.45rem 0.75rem; border-radius: 0.5rem; text-align: left; cursor: pointer; color: var(--md-sys-color-on-surface); }
.guide-move-opt:hover:not(:disabled) { background: var(--md-sys-color-secondary-container); }
.guide-move-opt .material-icons { font-size: 1rem; color: var(--md-sys-color-primary); flex-shrink: 0; }
.guide-toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 0.85rem;
  padding: 0.6rem 1.1rem; border-radius: 999px; background: var(--md-sys-color-inverse-surface, #313033); color: var(--md-sys-color-inverse-on-surface, #f4eff4);
  box-shadow: var(--md-elevation-2); font-size: 0.9rem; max-width: calc(100vw - 2rem);
}
.guide-toast[hidden] { display: none; }
.guide-toast .link-btn { color: var(--md-sys-color-inverse-primary, #d0bcff); }
