/*
 * 账号管理后台样式
 * ------------------------------------------------------------------
 * 只吃 campus 设计令牌（/campus-ui/tokens.css），不另造一套色板：
 * 门户、实训中心、管理台必须是同一个品牌，否则"三套皮肤"又是漂移源。
 */
:root {
  --a-bg: var(--campus-bg, #f6f8fb);
  --a-card: #fff;
  --a-ink: var(--campus-ink, #1f2937);
  --a-muted: #5b6675;
  --a-line: #e5ebf2;
  --a-brand: var(--campus-teal, #02b0b2);
  --a-brand-ink: var(--campus-teal-ink, #016b6d);
  --a-danger: #c0392b;
  --a-radius: 14px;
  --a-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--a-bg);
  color: var(--a-ink);
  font: 15px/1.6 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute; left: -9999px;
  background: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip:focus { left: 12px; top: 12px; z-index: 99; }

.boot {
  min-height: 60vh; display: grid; place-content: center; justify-items: center;
  gap: 14px; color: var(--a-muted);
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--a-line); border-top-color: var(--a-brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 顶栏 ---------- */
.a-head {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--a-line);
}
.a-head-in {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.a-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.a-brand b { font-size: 16px; }
.a-brand small { display: block; font-size: 12px; color: var(--a-muted); font-weight: 400; }
.a-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--a-brand);
  color: #fff; display: grid; place-content: center; font-weight: 700;
}
.a-head-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.a-head-actions a { color: var(--a-brand-ink); text-decoration: none; }
.a-head-actions a:hover { text-decoration: underline; }

/* AIGC 设置：跨模块入口，和「回门户 / 退出」这类站内链接不是一回事，
   做成浅色药丸单独拎出来，免得扫一眼找不到 */
.a-head-actions .a-link-aigc {
  padding: 6px 13px; border-radius: 99px;
  border: 1.5px solid #cdeeee; background: #f0fbfb;
  color: var(--a-brand-ink); font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.a-head-actions .a-link-aigc::before { content: "✦"; margin-right: 5px; opacity: .75; }
.a-head-actions .a-link-aigc:hover {
  background: #e2f7f7; border-color: var(--a-brand); text-decoration: none;
}
@media (max-width: 720px) {
  .a-head-actions .a-link-aigc::before { display: none; }
  .a-head-actions .a-link-aigc { padding: 5px 10px; }
}
.a-who { color: var(--a-muted); }
.a-role-tag {
  font-size: 12px; padding: 2px 8px; border-radius: 99px;
  background: #e7f8f8; color: var(--a-brand-ink); font-weight: 600;
}

/* ---------- 主体 ---------- */
.a-main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
.a-title { font-size: 22px; margin: 4px 0 2px; }
.a-sub { color: var(--a-muted); font-size: 13.5px; margin: 0 0 18px; }

.a-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.a-stat {
  background: var(--a-card); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  padding: 14px 16px; box-shadow: var(--a-shadow);
}
.a-stat b { display: block; font-size: 24px; line-height: 1.2; }
.a-stat span { color: var(--a-muted); font-size: 12.5px; }

.a-card {
  background: var(--a-card); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  box-shadow: var(--a-shadow); overflow: hidden;
}

.a-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--a-line);
}
.a-search { position: relative; flex: 1 1 240px; min-width: 180px; }
.a-search input { width: 100%; }
input[type="text"], input[type="password"], input[type="number"], select {
  height: 38px; padding: 0 10px; border: 1px solid var(--a-line); border-radius: 10px;
  background: #fff; color: inherit; font: inherit; font-size: 14px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(2, 176, 178, .45); outline-offset: 1px;
}

.a-btn {
  height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--a-line);
  background: #fff; color: var(--a-ink); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.a-btn:hover { border-color: #cfdae6; }
.a-btn--primary { background: var(--a-brand); border-color: var(--a-brand); color: #fff; }
.a-btn--primary:hover { filter: brightness(1.04); }
.a-btn--danger { color: var(--a-danger); border-color: #f1cdc8; background: #fff6f5; }
.a-btn:disabled { opacity: .5; cursor: not-allowed; }
.a-btn--sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.a-btn--icon {
  width: 30px; height: 30px; padding: 0; border-radius: 8px;
  color: var(--a-muted); font-size: 17px; line-height: 1; flex: none;
}
.a-btn--icon:hover { color: var(--a-danger); border-color: #f1cdc8; background: #fff6f5; }
.a-toolbar-sep { width: 1px; height: 24px; background: var(--a-line); }
.a-spacer { margin-left: auto; }

.a-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--a-line); white-space: nowrap; }
th { font-size: 12.5px; color: var(--a-muted); font-weight: 600; background: #fafcfe; }
tbody tr:hover { background: #fafdff; }
td.u-name { font-weight: 600; }
td.u-uid { color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-muted { color: var(--a-muted); font-size: 12.5px; }
.a-empty { padding: 40px 16px; text-align: center; color: var(--a-muted); }

.a-pager {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 13px; color: var(--a-muted);
}
.a-pager .a-spacer { margin-left: auto; }

.role-select { height: 32px; font-size: 13px; }

/* ---------- 可访问模块（下拉预设 + 自定义勾选） ---------- */
td.u-mods { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 168px; }
.mod-select {
  width: 100%; padding: 5px 8px; border: 1px solid var(--a-line); border-radius: 8px;
  background: #fff; font-size: 12px; color: var(--a-ink); cursor: pointer;
}
.mod-select:disabled { opacity: .6; cursor: default; background: #f3f5f9; }
.mod-select:focus-visible { outline: 2px solid var(--a-brand); outline-offset: 1px; }
.mod-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mod-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px;
  border: 1px solid var(--a-line); border-radius: 999px; background: #fff;
  font-size: 12px; color: var(--a-muted); cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.mod-chip input { width: 13px; height: 13px; margin: 0; accent-color: var(--a-brand); cursor: pointer; }
.mod-chip.is-on { background: #e6f7f7; border-color: #9fdcdc; color: var(--a-brand-ink); font-weight: 600; }
.mod-chip.is-locked { opacity: .62; cursor: default; }
.mod-chip:hover { border-color: #9fdcdc; }

/* ---------- 新账号默认权限卡片 ---------- */
.a-card--moddef { margin-bottom: 14px; }
.a-moddef { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.a-moddef-main { display: flex; flex-direction: column; gap: 3px; min-width: 220px; flex: 1 1 260px; }
.a-moddef-main b { font-size: 13px; color: var(--a-ink); }
.a-moddef-main .a-muted { font-size: 12px; }
.a-moddef .mod-chips { flex: 0 0 auto; }
.a-moddef #defSave { flex: 0 0 auto; }

/* ---------- 弹窗 ---------- */
dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(520px, 92vw);
  box-shadow: 0 24px 60px rgba(16, 24, 40, .22);
}
dialog::backdrop { background: rgba(15, 23, 42, .42); }
.d-head { padding: 18px 20px 6px; }
.d-head h2 { margin: 0; font-size: 18px; }
.d-body { padding: 8px 20px 4px; display: grid; gap: 12px; }
.d-body label { display: grid; gap: 6px; font-size: 13px; color: var(--a-muted); }
.d-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.d-hint { font-size: 12.5px; color: var(--a-muted); margin: 0; }
.d-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: #f6f9fc; border: 1px dashed var(--a-line); border-radius: 10px; padding: 10px;
  word-break: break-all; color: #34495e;
}
.d-foot { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 10px; }

/* 名单导入：行编辑器 */
dialog.d-wide { width: min(760px, 94vw); }
.d-paste { border: 1px solid var(--a-line); border-radius: 12px; background: #fafcfe; padding: 0 12px 10px; }
.d-paste summary {
  cursor: pointer; padding: 10px 0; font-size: 13.5px; font-weight: 600; color: var(--a-brand-ink);
  list-style: none;
}
.d-paste summary::-webkit-details-marker { display: none; }
.d-paste summary::before { content: "▸ "; }
.d-paste[open] summary::before { content: "▾ "; }
.d-paste textarea {
  width: 100%; resize: vertical; padding: 10px; border: 1px solid var(--a-line); border-radius: 10px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: #fff; color: inherit;
}
.d-paste-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.d-rows-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--a-muted); }
.d-rows { display: grid; gap: 8px; max-height: 42vh; overflow-y: auto; padding-right: 2px; }
.d-row-line {
  display: grid; grid-template-columns: 26px 1.1fr 1fr 96px 34px; align-items: center; gap: 8px;
}
.d-row-line input, .d-row-line select { height: 36px; font-size: 14px; width: 100%; min-width: 0; }
.d-row-no {
  font-size: 12px; color: var(--a-muted); text-align: center;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .d-row { grid-template-columns: 1fr; }
  .d-row-line { grid-template-columns: 20px 1fr 34px; grid-template-areas: "no uname del" ". pwd ." ". role ."; }
  .d-row-line .row-uname { grid-area: uname; }
  .d-row-line .row-pwd { grid-area: pwd; }
  .d-row-line .row-role { grid-area: role; }
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 14px; max-width: 90vw; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); z-index: 90;
}
.toast[data-kind="error"] { background: #b3261e; }
.toast[data-kind="ok"] { background: #0f766e; }

.a-denied {
  max-width: 480px; margin: 12vh auto; background: #fff; border: 1px solid var(--a-line);
  border-radius: 18px; padding: 28px; text-align: center; box-shadow: var(--a-shadow);
}
.a-denied h1 { font-size: 20px; margin: 8px 0 6px; }
.a-denied p { color: var(--a-muted); font-size: 14px; }

/* ---------- 魔塔绑题 ---------- */
.t-h2 { font-size: 16px; margin: 4px 0 14px; }
.t-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px; margin-bottom: 14px;
}
.t-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--a-muted); }
.t-field select, .t-field input {
  height: 38px; padding: 0 10px; border: 1px solid var(--a-line); border-radius: 10px;
  background: #fff; color: var(--a-ink); font: inherit; font-size: 14px;
}
.t-actions { margin-top: 4px; }
.t-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--a-muted); }
.t-inline select {
  height: 30px; padding: 0 8px; border: 1px solid var(--a-line); border-radius: 8px; background: #fff;
}
.t-hint { margin: 10px 0 0; font-size: 12px; color: var(--a-muted); }
.t-check {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--a-line); background: #f8fafc;
}
.t-check ul { margin: 6px 0 0; padding-left: 20px; max-height: 220px; overflow: auto; }
.t-check.ok { border-color: #b7e4d8; background: #f0fbf7; color: #0f766e; }
.t-check.bad { border-color: #f2c4be; background: #fdf3f2; color: #8a241a; }
.t-check.warn { border-color: #f1dfb6; background: #fffaf0; color: #7a5a12; }
.t-lines { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.t-floor-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.t-floor-bad { color: var(--a-danger); font-weight: 700; }
.t-floor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 10px 0 12px; border-top: 1px solid var(--a-line);
}
.t-floor-head small { display: block; color: var(--a-muted); font-size: 12px; }
.t-mobs { display: grid; gap: 8px; }
.t-mob {
  display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(110px, 150px) minmax(160px, 2fr) 60px;
  gap: 10px; align-items: center; padding: 9px 12px;
  border: 1px solid var(--a-line); border-radius: 10px; background: #fcfdff;
}
.t-mob.is-bad { border-color: #f2c4be; background: #fff8f7; }
.t-mob-name { font-size: 14px; }
.t-mob-name small { display: block; color: var(--a-muted); font-size: 11px; }
.t-mob input {
  height: 34px; padding: 0 9px; border: 1px solid var(--a-line); border-radius: 8px;
  font: 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--a-ink);
}
.t-mob input:focus { outline: 2px solid #8fd9d6; border-color: var(--a-brand); }
.t-mob-title { font-size: 12px; color: var(--a-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-badge {
  justify-self: end; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #e7f7f1; color: #0f766e;
}
.t-badge.bad { background: #fdeceb; color: #a02b20; }

@media (max-width: 720px) {
  .t-mob { grid-template-columns: 1fr 110px; }
  .t-mob-title { grid-column: 1 / -1; white-space: normal; }
  .t-badge { grid-column: 2; grid-row: 1; align-self: start; }
}

/* ---------- 题库与题单 ---------- */
.p-card + .p-card { margin-top: 16px; }
.p-gap { height: 2px; }
.p-card-title { font-size: 15px; }
.p-card-body { padding: 14px 16px 18px; }
.p-lead { margin: 0 0 12px; font-size: 13.5px; color: var(--a-muted); }
.p-lead b { color: var(--a-ink); }
.p-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.p-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.p-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 12px; font-size: 12px; color: var(--a-muted);
}
.p-divider::before, .p-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--a-line);
}
.p-drop {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px; border: 1.5px dashed #c8d6e4; border-radius: 12px;
  background: #fafcfe; cursor: pointer; transition: border-color .15s, background .15s;
}
.p-drop:hover, .p-drop.is-over { border-color: var(--a-brand); background: #f2fbfb; }
.p-drop-main { flex: 1 1 260px; min-width: 0; }
.p-drop-main b { display: block; font-size: 14px; }
.p-drop-main small { color: var(--a-muted); font-size: 12.5px; }
.p-samples { margin-top: 6px; font-size: 12.5px; color: var(--a-muted); word-break: break-all; }
.p-result { margin-top: 12px; display: grid; gap: 10px; }
.p-result ul { max-height: 200px; overflow: auto; }
