:root{
  /* ChatGPT-like neutral palette */
  --bg: #f7f7f8;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;

  --border: rgba(15, 23, 42, 0.10);
  --border-2: rgba(15, 23, 42, 0.16);

  --shadow: 0 1px 2px rgba(0,0,0,.06);
  --shadow-2: 0 8px 24px rgba(0,0,0,.08);

  --radius: 14px;
  --radius2: 18px;

  --primary: #111827;      /* ChatGPT-ish black */
  --primaryText: #ffffff;

  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC","Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* links */
a{color:#111827; text-decoration:none}
a:hover{opacity:.86}

/* layout */
.container{
  width: calc(100% - 24px);
  margin: 0 auto;
  max-width: none;
}

/* narrow page mode (read/form pages) */
body.page-narrow .container{
  max-width: 1180px;
}

/* content-inner: local narrow wrapper inside full pages */
.content-inner{
  max-width: 1180px;
  margin: 0 auto;
}

/* bleed pages: remove outer paddings for workbench/boards */
body.page-bleed .main{
  padding: 0;
}
body.page-bleed .container{
  width: 100%;
}

/* topbar like ChatGPT */
.topbar{
  position:sticky; top:0;
  background: rgba(247,247,248,.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index:10;
}
.topbar .inner{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 0;
}

/* compatibility: some templates use .topbar-inner */
.topbar .topbar-inner{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 0;
}
.brand{
  display:flex; gap:10px; align-items:center;
  font-weight:800;
  letter-spacing:.2px;
}
.brand .dot{
  width:10px; height:10px; border-radius:50%;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(17,24,39,.06);
}

.nav{
  display:flex; gap:10px; align-items:center;
  color: var(--muted);
  font-size:14px;
}
.nav .pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
}
.nav .pill strong{color: var(--text); font-weight:700}

.main{
  padding: 14px 0 40px;
}

/* cards */
.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
}
.card .hd{
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.card .hd.hd-title-moved{
  /* 顶栏承载主标题后，卡片头部收紧留白 */
  padding-top: 8px;
  padding-bottom: 8px;
}
.card .bd{
  padding: 12px 16px 14px;
}

/* headings */
.h1{
  font-size: 18px;
  line-height: 1.25;
  margin: 0 0 6px;
  font-weight: 800;
}
.sub{
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

/* grid/row */
.grid{display:grid; gap:14px}
.grid.two{grid-template-columns:1fr 1fr}
@media (max-width: 860px){.grid.two{grid-template-columns:1fr}}

.row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

/* fields */
.field{display:flex; flex-direction:column; gap:8px}
.label{font-size:13px; color: var(--muted)}

.input, .select, .textarea{
  width:100%;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline:none;
  transition: box-shadow .12s ease, border-color .12s ease;
}
.input::placeholder{color: rgba(107,114,128,.9)}
.input:focus, .select:focus, .textarea:focus{
  border-color: rgba(17,24,39,.32);
  box-shadow: 0 0 0 4px rgba(17,24,39,.08);
}
/* =========================
   Global Top Loading Bar
   ========================= */
.top-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  /* 稍微粗一点、可见 */
  height: 5px;
  width: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease;
}

.top-progress.is-on { opacity: 1; }

.top-progress .bar {
  height: 100%;
  width: 0%;
  transform-origin: 0 50%;
  background: var(--primary);
  transition: width .2s ease;
}

/* buttons - ChatGPT-ish */
.btn{
  appearance:none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor:pointer;
  font-weight: 700;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{
  background: rgba(15,23,42,.03);
  border-color: var(--border-2);
}
.btn:active{transform: translateY(1px)}
.btn:disabled{opacity:.55; cursor:not-allowed; transform:none}

/* =========================
   Button loading (跟随顶部进度条)
   ========================= */
.btn.is-loading,
button.is-loading,
[role="button"].is-loading{
  cursor: wait;
}

.btn.is-loading::after,
button.is-loading::after,
[role="button"].is-loading::after{
  content:"";
  display:inline-block;
  width:12px;
  height:12px;
  margin-left:8px;
  border:2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align:-2px;
  animation: pmSpin .8s linear infinite;
}

@keyframes pmSpin{ to{ transform: rotate(360deg);} }

/* smaller buttons (mobile friendly) */
.btn.sm{
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.btn.primary{
  background: var(--primary);
  color: var(--primaryText);
  border-color: rgba(17,24,39,.9);
}
.btn.primary:hover{background: #0b1220}

.btn.danger{
  border-color: rgba(239,68,68,.35);
  color: #b91c1c;
  background: rgba(239,68,68,.06);
}
.btn.danger:hover{
  background: rgba(239,68,68,.10);
  border-color: rgba(239,68,68,.45);
}

/* table like ChatGPT list */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  background:#fff;
}
.table th, .table td{
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  vertical-align: middle;
}
.table th{
  text-align:left;
  color: #374151;
  font-weight: 800;
  background: #fafafa;
  position: sticky;
  top: 0;
}
.table tr:last-child td{border-bottom:none}
.table tr:hover td{
  background: rgba(15,23,42,.02);
}

/* table wrapper for mobile horizontal scroll */
.table-wrap{
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* actions in table cell (e.g. proctor workbench) */
.op-actions{ display:flex; flex-wrap:wrap; gap:8px; }

@media (max-width: 640px){
  .table th, .table td{ white-space: nowrap; }
  .op-actions{ gap:6px; }
  /* ✅ 手机端更紧凑：减少左右留白、整体上下间距 */
  .main{ padding: 10px 0 18px; }
  .container{ width: calc(100% - 16px); }
}

/* badges */
.badge{
  display:inline-flex;
  align-items:center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 12px;
  color: #374151;
}
.badge.ok{
  border-color: rgba(16,185,129,.35);
  background: rgba(16,185,129,.06);
  color: #065f46;
}
.badge.warn{
  border-color: rgba(245,158,11,.35);
  background: rgba(245,158,11,.08);
  color: #92400e;
}
.badge.danger{
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
  color: #991b1b;
}

/* small code-style pill */
.kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: #374151;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f9fafb;
}

/* footer */
.footer{
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

/* toast - minimal */
.toast-wrap{
  position: fixed;
  right: 16px;
  bottom: 16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index: 9999;
}
.toast{
  width: min(380px, calc(100vw - 32px));
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-2);
  padding: 12px 12px 12px 14px;
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.toast .t{
  font-weight: 900;
  margin:0 0 2px;
  font-size: 12.5px;
}
.toast .m{
  margin:0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}
.toast .x{
  margin-left:auto;
  background:transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  padding: 6px 8px;
  cursor:pointer;
}
.toast.ok{border-color: rgba(16,185,129,.30)}
.toast.warn{border-color: rgba(245,158,11,.30)}
.toast.danger{border-color: rgba(239,68,68,.30)}

/* loading overlay：已清理（仅保留顶部进度条 TopProgress） */

/* ================================
   Shell / Sidebar (ChatGPT-like)
   ================================ */
.shell{
  --sb-w: 260px;
  --sb-collapsed: 72px;
  --sb-radius: 18px;
  --sb-gap: 6px;
  --sb-item-h: 34px;

  display:flex;
  min-height:100vh;
  background: var(--bg);
}

/* Sidebar base */
.sidebar{
  width: var(--sb-w);
  flex: 0 0 var(--sb-w);
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  display:flex;
  flex-direction:column;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* top */
.sb-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 8px 8px;
}
.sb-brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  padding: 6px 8px;
  border-radius: 12px;
  text-decoration:none;
  color: var(--text);
  font-weight: 900;
}
.sb-brand:hover{ background: rgba(15,23,42,.05); }
.sb-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16,185,129,.14);
}
.sb-title{ font-size: 12.5px; letter-spacing: .3px; }

.sb-toggle{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.72);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.sb-toggle:hover{ background:#fff; }

/* nav */
.sb-nav{
  padding: 6px 8px 12px;
  overflow:auto;
}

/* section header */
.sb-sep{
  height: 1px;
  background: var(--border);
  margin: 8px 8px;
}
.sb-hd{
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  padding: 4px 10px;
  letter-spacing: .2px;
}

/* item (ChatGPT-ish) */
.sb-item{
  position: relative;
  height: var(--sb-item-h);
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 0 10px;
  margin: 1px 4px;
  border-radius: 12px;
  color: var(--text);
  text-decoration:none;
  font-weight: 800;
  overflow: hidden;

  /* “受气”动画：轻微上浮 + 阴影 */
  transition: background .12s ease, transform .12s ease, box-shadow .12s ease;
}

.sb-item .ico{
  width: 22px;
  height: 22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size: 16px;
  flex: 0 0 22px;
}
.sb-item .txt{
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  font-size: 12.5px;
  letter-spacing: .1px;
}

.sb-item .sb-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(239,68,68,.14);
  border: 1px solid rgba(239,68,68,.22);
  color: rgba(185,28,28,.95);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  margin-left: 6px;
  flex: 0 0 auto;
}

/* 收起状态：数字 badge 变成小红点，避免挤占 */
.shell.is-collapsed .sb-item .sb-badge{
  width: 8px;
  min-width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 99px;
  background: rgba(239,68,68,.55);
  border: 0;
  color: transparent;
  margin-left: 0;
  position: absolute;
  top: 8px;
  right: 12px;
}

/* hover “受气”样式 */
.sb-item:hover{
  background: rgba(15,23,42,.06);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  transform: translateY(-1px);
}
.sb-item:active{
  transform: translateY(0px);
  box-shadow: none;
}

/* ===== 当前菜单高亮（ChatGPT 风格） ===== */
.sb-item.active{
  background: linear-gradient(
    180deg,
    rgba(17,24,39,.10),
    rgba(17,24,39,.06)
  );
  border: 1px solid rgba(17,24,39,.14);
  box-shadow: 0 10px 26px rgba(15,23,42,.12);
}

/* 图标略强调 */
.sb-item.active .ico{
  transform: scale(1.06);
}

/* 收起状态：只高亮图标胶囊 */
.shell.is-collapsed .sb-item.active{
  background: rgba(17,24,39,.12);
  box-shadow: 0 8px 20px rgba(15,23,42,.18);
}

/* 防止 hover 覆盖 active */
.sb-item.active:hover{
  transform: none;
}


/* bottom user area */
.sb-bottom{
  margin-top:auto;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}
.sb-me{
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.8);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.sb-me-name{ font-weight: 900; font-size: 12.5px; }
.sb-me-no{ color: var(--muted); font-size: 12px; margin-top: 2px; }

.sb-logout{
  height: 40px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 12px;
  text-decoration:none;
  color: var(--text);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.72);
  font-weight: 900;
  transition: background .12s ease, transform .12s ease;
}
.sb-logout:hover{ background:#fff; transform: translateY(-1px); }

/* Main */
.content{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; }
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247,247,248,.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar.is-dark{
  background: rgba(17,24,39,.92);
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.topbar-inner{
  height: 52px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 0 14px;
}
.topbar-title{
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 900;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar.is-dark .topbar-title{ color: #fff; }
.topbar.is-dark .topbar-toggle{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.18);
  color:#fff;
}
.topbar.is-dark .topbar-toggle:hover{ background: rgba(255,255,255,.16); }
.topbar-right{ display:flex; align-items:center; gap:10px; }
.topbar-toggle{
  display:none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.72);
  cursor:pointer;
}
.topbar-toggle:hover{ background:#fff; }

.main{ flex: 1 1 auto; padding: 18px 0 30px; }
.container{ width: min(1680px, calc(100% - 32px)); margin: 0 auto; }
.footer{ margin-top: 18px; color: var(--muted); font-size: 12px; text-align:center; }

/* ================================
   Collapsed (desktop): icons only
   ================================ */
.shell.is-collapsed .sidebar{
  width: var(--sb-collapsed);
  flex-basis: var(--sb-collapsed);
}

.shell.is-collapsed .sb-title,
.shell.is-collapsed .sb-hd,
.shell.is-collapsed .sb-me,
.shell.is-collapsed .sb-logout{
  display:none;
}

/* center icons */
.shell.is-collapsed .sb-item{
  justify-content:center;
  padding: 0;
  margin: 4px 10px;
  border-radius: 16px;
}
.shell.is-collapsed .sb-item .txt{ display:none; }

/* Tooltip for collapsed */
.shell.is-collapsed .sb-item::after{
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15,23,42,.92);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.shell.is-collapsed .sb-item:hover::after{
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

/* ================================
   Mobile drawer + overlay
   ================================ */
@media (max-width: 980px){
  .sidebar{
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    height: 100vh;
    transform: translateX(-102%);
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    border-right: 1px solid var(--border);
  }
  .shell.is-open .sidebar{ transform: translateX(0); }

  /* mobile overlay */
  .shell::before{
    content:"";
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    z-index: 90;
  }
  .shell.is-open::before{
    opacity: 1;
    pointer-events: auto;
  }

  .topbar-toggle{ display:inline-flex; align-items:center; justify-content:center; }

  /* mobile ignore collapsed width */
  .shell.is-collapsed .sidebar{
    width: var(--sb-w);
    flex-basis: var(--sb-w);
  }
  .shell.is-collapsed .sb-item{
    justify-content:flex-start;
    padding: 0 10px;
    margin: 1px 4px;
  }
  .shell.is-collapsed .sb-item .txt{ display:inline; }
  .shell.is-collapsed .sb-item::after{ display:none; }
}

/* 顶部用户信息：桌面隐藏，手机显示（避免和侧边栏底部重复） */
.mobile-only { display: none; }

@media (max-width: 980px){
  .mobile-only { display: inline-flex; }
  .mobile-only { gap: 8px; align-items: center; }
}

.sb-logout{
  border-color: rgba(239,68,68,.18);
}
.sb-logout:hover{
  background: rgba(239,68,68,.06);
}

/* Mobile: sidebar as drawer */
@media (max-width: 980px){
  .sidebar{
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-102%);
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
  }
  .shell.is-open .sidebar{transform: translateX(0);}
  .topbar-toggle{display:inline-flex;}
  .shell.is-collapsed .sidebar{width:260px; flex-basis:260px;}
}
/* 登录/登出页：不渲染侧边栏时，让主内容占满 */
.shell.no-sidebar .content{
  width: 100%;
}
.shell.no-sidebar .topbar{
  border-left: 0;
}
.shell.no-sidebar .main .container{
  width: min(1680px, calc(100% - 40px));
}

/* Small polish */
.footer{
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align:center;
}

/* ================================
   Compact helpers (v7)
   ================================ */

/* 说明文字：PC 默认收起，悬停标题区再浮现；移动端默认显示 */
@media (hover:hover) and (pointer:fine){
  .card .hd .sub{
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
    transition: max-height .18s ease, opacity .18s ease, margin-top .18s ease;
  }
  .card .hd:hover .sub{
    max-height: 120px;
    opacity: 1;
    margin-top: 6px;
  }
}
@media (max-width: 820px){
  .card .hd .sub{ max-height:none !important; opacity:1 !important; margin-top:6px !important; }
}

/* 全站页码/分页条：统一更紧凑 */
.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin: 8px 0 12px;
}
.pager .group{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.pager .btn{
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12.5px;
}
.pager .input,
.pager select{
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12.5px;
}

/* hide exam card on /me dashboard (unused) */
#cardExam{display:none!important;}

/* ================================
   Mobile width hotfix (v20260212)

   问题：Sidebar 在移动端变为抽屉（position:fixed + translateX），但仍处于
   flex 布局链路时，部分浏览器会出现主内容区域“异常窄/右侧留白”。

   处理：在移动端把 .shell 切换为 block，确保 .content 占满 100% 宽度。
   同时把 .container 的宽度覆盖放到文件末尾，避免被前面/中间重复定义覆盖。
   ================================ */
@media (max-width: 980px){
  .shell{ display:block; }
  .content{ width:100%; min-width:0; }
  .main{ padding: 10px 0 18px; }
  .main .container{
    width: calc(100% - 16px) !important;
    max-width: none !important;
    margin: 0 auto !important;
  }
}

@media (max-width: 420px){
  .main .container{ width: calc(100% - 12px) !important; }
}

/* =============================
   Top action "More" dropdown
   - used by /admin/wf/* pages
   ============================= */
.more-wrap{position:relative;display:inline-block;}
.more-btn{display:inline-flex;align-items:center;gap:6px;}
.more-btn .caret{font-size:11px;opacity:.75;}
.more-menu{
  position:absolute;right:0;top:calc(100% + 6px);
  min-width:170px;z-index:1000;
  background:#fff;
  border:1px solid rgba(15,23,42,.12);
  border-radius:12px;
  box-shadow:0 18px 42px rgba(0,0,0,.14);
  padding:6px;
  display:none;
}
.more-wrap.is-open .more-menu{display:block;}
.more-item{
  width:100%;
  display:flex;align-items:center;gap:8px;
  padding:8px 10px;
  border-radius:10px;
  color:#111827;
  text-decoration:none;
  font-weight:700;
  font-size:13px;
  background:transparent;
  border:0;
}
.more-item:hover{background:rgba(15,23,42,.06);}
.more-item:disabled{opacity:.45;cursor:not-allowed;}
.more-sep{height:1px;background:rgba(15,23,42,.10);margin:6px 6px;}

