/* ============================================================
   Weiban LMS · 控制台样式（蓝白 / 腾讯云官网风）
   仅表现层：不改变任何 DOM id 与 JS 交互契约
   ============================================================ */

:root {
  --brand: #006EFF;
  --brand-hover: #0056D6;
  --brand-press: #0049B8;
  --brand-weak: #EAF2FF;
  --brand-weak-2: #F5F9FF;

  --ink: #141A24;
  --ink-2: #4E5A6E;
  --ink-3: #6B7688;
  --ink-4: #7C8698;

  --line: #E5EAF2;
  --line-2: #EEF2F8;
  --canvas: #F2F5FA;
  --surface: #FFFFFF;

  --ok: #0C9E67;
  --ok-weak: #E6F7EF;
  --warn: #C97B0E;
  --warn-weak: #FDF4E6;
  --err: #D93A4B;
  --err-weak: #FDECEE;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --sh-1: 0 1px 2px rgba(20, 26, 36, 0.05);
  --sh-2: 0 2px 6px -2px rgba(20, 26, 36, 0.08), 0 10px 28px -16px rgba(0, 110, 255, 0.18);
  --sh-3: 0 18px 48px -18px rgba(10, 20, 40, 0.22);

  --maxw: 1240px;
  --topbar-h: 58px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Adjusted", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
    "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;

  --ease: cubic-bezier(0.22, 0.9, 0.32, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 120ms;
  --dur-2: 190ms;
  --dur-3: 260ms;
  --dur-4: 420ms;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

a { color: var(--brand); text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
  font-weight: 500;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-weak);
  color: var(--brand);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { color: var(--brand); border-color: #CFE0FB; background: var(--brand-weak-2); }
.icon-btn:active { background: var(--brand-weak); }

.engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-xs);
  background: var(--canvas);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.engine-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
  flex: none;
}

.engine-badge.ok { background: var(--ok-weak); border-color: #C6EBD9; color: var(--ok); }
.engine-badge.ok .engine-dot { background: var(--ok); animation: pulse-dot 2s var(--ease) infinite; }
.engine-badge.err { background: var(--err-weak); border-color: #F6CCD2; color: var(--err); }
.engine-badge.err .engine-dot { background: var(--err); }

/* ---------------- 布局骨架 ---------------- */

.page { padding: 24px 0 40px; }

.page-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.col-main,
.col-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.layout > .log-card {
  grid-column: 1 / -1;
}

@media (min-width: 1080px) {
  .page { padding: 28px 0 48px; }
  .layout {
    grid-template-columns: minmax(0, 1fr) 384px;
    gap: 20px;
  }
  .col-main,
  .col-side { gap: 20px; }
}

/* ---------------- 主控台 ---------------- */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px;
  background: linear-gradient(135deg, #F5FAFF 0%, var(--surface) 58%);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.hero-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  color: var(--brand);
  opacity: 0.09;
  pointer-events: none;
}

.hero-mark svg { width: 92px; height: 92px; }

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 6px;
}

.hero-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(0, 110, 255, 0.14);
}

.hero-info { min-width: 0; }

.status-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.status-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
}

.status-desc {
  font-size: 12.5px;
  color: var(--ink-2);
  max-width: 46ch;
}

/* ---------------- 数据统计 ---------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.stat-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.stat-card:hover { border-color: #CFE0FB; box-shadow: var(--sh-2); }

.stat-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.stat-ico {
  display: grid;
  place-items: center;
  color: var(--brand);
}

.stat-label {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

.stat-num {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

/* ---------------- 卡片 ---------------- */

.card {
  padding: 18px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card-ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-xs);
  background: var(--brand-weak);
  color: var(--brand);
  flex: none;
}

.card-badge {
  font-size: 12px;
  color: var(--ink-2);
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 2px 8px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chip-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.chip-btn:hover { color: var(--brand); border-color: #CFE0FB; background: var(--brand-weak-2); }
.chip-btn:active { background: var(--brand-weak); }

/* ---------------- 表单控件 ---------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  min-width: 0;
}

.field > label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-hint {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
}

.input-wrap { position: relative; }

.input-wrap > input,
.add-form input,
.auth-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.input-wrap > input { padding-left: 38px; padding-right: 56px; }

.input-wrap > input::placeholder,
.add-form input::placeholder,
.auth-input::placeholder { color: var(--ink-4); }

.input-wrap > input:hover,
.add-form input:hover,
.auth-input:hover { border-color: #CFE0FB; }

.input-wrap > input:focus,
.add-form input:focus,
.auth-input:focus,
.captcha-input:focus,
.log-filter:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 110, 255, 0.12);
  background: #FCFDFF;
}

.input-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

select,
.auth-input select { cursor: pointer; }

.field select,
.setting select {
  width: 100%;
  height: 38px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B95A7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  color: var(--ink);
  font-size: 13px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.field select:hover,
.setting select:hover { border-color: #CFE0FB; }
.field select:focus,
.setting select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 110, 255, 0.12);
}

/* 学校下拉 */

.school-dropdown {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-3);
  display: none;
}

.school-dropdown.open { display: block; }

.school-option {
  padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.school-option:hover { background: var(--brand-weak-2); color: var(--brand); }
.school-option.active { background: var(--brand-weak); color: var(--brand); font-weight: 500; }

/* 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.12s var(--ease);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 86, 214, 0.18);
}
.btn-primary:hover { background: var(--brand-hover); box-shadow: 0 4px 14px -6px rgba(0, 110, 255, 0.5); }
.btn-primary:active { background: var(--brand-press); }

.btn-soft {
  background: var(--brand-weak);
  border-color: #D6E6FF;
  color: var(--brand);
}
.btn-soft:hover { background: #DFEBFF; border-color: #C2D9FF; }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-2);
}
.btn-ghost:hover { color: var(--brand); border-color: #CFE0FB; background: var(--brand-weak-2); }

.btn-danger {
  background: var(--err);
  color: #fff;
}
.btn-danger:hover { background: #C22F3F; }

.btn-ghost-danger {
  background: var(--surface);
  border-color: #F6CCD2;
  color: var(--err);
}
.btn-ghost-danger:hover { background: var(--err-weak); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-lg { height: 44px; font-size: 14.5px; }
.btn-block { width: 100%; }

.btn:disabled,
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------------- 账号列表 ---------------- */

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}

.list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.list-count {
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.account-list { display: grid; gap: 8px; }

.account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.account-item:hover { border-color: #CFE0FB; background: var(--brand-weak-2); }

.account-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-weak);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
}

.account-main { flex: 1 1 auto; min-width: 0; }

.account-school {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-uid {
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.account-status {
  flex: none;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--canvas);
  color: var(--ink-3);
}

.status-pending { background: var(--canvas); color: var(--ink-3); }
.status-logged_in { background: var(--ok-weak); color: var(--ok); }
.status-login_failed { background: var(--err-weak); color: var(--err); }
.status-running { background: var(--brand-weak); color: var(--brand); }
.status-done { background: var(--ok-weak); color: var(--ok); }
.status-error { background: var(--err-weak); color: var(--err); }

.account-remove {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-4);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.account-remove:hover { color: var(--err); background: var(--err-weak); border-color: #F6CCD2; }

.list-actions { margin-top: 12px; }

/* 空态 */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 28px 16px;
  color: var(--ink-3);
}

.empty-ico {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink-4);
}

.empty-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.empty-desc {
  font-size: 12px;
  color: var(--ink-3);
  max-width: 34ch;
  line-height: 1.6;
}

/* ---------------- 实时进度 ---------------- */

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 110, 255, 0.14);
  animation: pulse-dot 1.8s var(--ease) infinite;
  flex: none;
}

.status-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.status-item-avatar {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  background: var(--brand-weak);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}

.status-item-main { flex: 1 1 auto; min-width: 0; }

.status-item-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-item-msg {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 运行日志 ---------------- */

.log-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-filter {
  width: 132px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), width 0.2s var(--ease);
}
.log-filter::placeholder { color: var(--ink-4); }
.log-filter:hover { border-color: #CFE0FB; }
.log-filter:focus { width: 168px; }

.log-console {
  height: clamp(320px, 40vh, 480px);
  overflow-y: auto;
  padding: 4px;
  background: #FBFCFE;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.log-console > .empty {
  min-height: 100%;
  justify-content: center;
}

.log-console::-webkit-scrollbar { width: 8px; }
.log-console::-webkit-scrollbar-thumb {
  background: #D9E0EC;
  border-radius: 8px;
}
.log-console::-webkit-scrollbar-track { background: transparent; }

.log-line {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-xs);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.log-line + .log-line { border-top: 1px solid var(--line-2); }
.log-line:hover { background: #F4F8FF; }
.log-line {
  content-visibility: auto;
  contain-intrinsic-size: auto 33px;
}

.log-time {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.log-date { color: var(--ink-4); }

.log-account {
  color: var(--brand);
  background: var(--brand-weak);
  border-radius: var(--r-xs);
  padding: 0 6px;
  font-size: 11px;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-level {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.log-msg {
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.log-line[class*="level-error" i] { background: #FEF7F8; }
.log-line[class*="level-error" i] .log-level { color: var(--err); }
.log-line[class*="level-error" i] .log-msg { color: #A32B39; }

.log-line[class*="level-warning" i] .log-level { color: var(--warn); }
.log-line[class*="level-warning" i] .log-msg { color: #8A5A0C; }

.log-line[class*="level-success" i] .log-level { color: var(--ok); }
.log-line[class*="level-success" i] .log-msg { color: #0B6B49; }

.log-line[class*="level-info" i] .log-level { color: var(--brand); }
.log-line[class*="level-debug" i] { opacity: 0.72; }

/* ---------------- 设置 ---------------- */

.settings-card { padding: 0; }

.settings-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.settings-chevron {
  color: var(--ink-3);
  flex: none;
}
.settings-chevron.open { transform: rotate(180deg); }

.settings-body {
  display: none;
  padding: 0 20px 18px;
}
.settings-body.open { display: block; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}

.setting {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.setting-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}

.setting-desc {
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 6px;
}

/* 收起状态：JS 只在 #addForm 上切换 collapsed */

.add-form.collapsed { display: none; }

/* ---------------- 操作条 ---------------- */

.action-dock {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}

.action-dock-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.action-dock-tip {
  font-size: 12px;
  color: var(--ink-3);
  min-width: 0;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* ---------------- 弹窗 ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 38, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal {
  width: min(400px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
}

.modal-wide { width: min(520px, 100%); }

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 0;
}

.modal-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-weak);
  color: var(--brand);
}

.modal-title {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.modal-subtitle {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.modal-body { padding: 16px 20px 20px; }

.captcha-box {
  display: grid;
  place-items: center;
  padding: 10px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  min-height: 64px;
}

.captcha-box img { max-height: 60px; }

.captcha-input {
  width: 100%;
  height: 42px;
  margin-top: 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 15px;
  letter-spacing: 0.16em;
  text-align: center;
  color: var(--ink);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.captcha-input:hover { border-color: #CFE0FB; }
.captcha-input::placeholder { color: var(--ink-4); letter-spacing: 0; }

.captcha-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.captcha-actions .btn:last-child { margin-left: auto; }

/* ---------------- 登录 / 注册 ---------------- */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(1200px 520px at 12% -10%, #E8F1FF 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(900px 480px at 100% 0%, #EFF6FF 0%, rgba(255, 255, 255, 0) 58%),
    var(--canvas);
}

.auth-shell {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  overflow: hidden;
}

.auth-aside {
  display: none;
  position: relative;
  padding: 40px 36px;
  color: #fff;
  background: linear-gradient(160deg, #0052CC 0%, #006EFF 52%, #2E8BFF 100%);
  overflow: hidden;
}

.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(120% 90% at 85% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(120% 90% at 85% 0%, #000 0%, transparent 72%);
  pointer-events: none;
}

.auth-aside-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-aside-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  color: #fff;
}

.auth-aside-title {
  position: relative;
  z-index: 1;
  margin-top: 52px;
  font-size: 30px;
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-aside-foot {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
  line-height: 1.75;
  color: #fff;
}

.auth-modal { padding: 32px 28px; }

.auth-head { margin-bottom: 18px; }

.auth-mobile-brand {
  display: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--brand);
}

@media (max-width: 959px) {
  .auth-mobile-brand { display: inline-block; margin-bottom: 8px; }
}

.auth-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.auth-subtitle {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--canvas);
  border-radius: var(--r-sm);
}

.auth-tab {
  height: 34px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.auth-tab:hover { color: var(--brand); }

.auth-tab.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--sh-1);
}

.auth-form { display: grid; gap: 12px; }

.auth-forms { display: grid; }

.auth-forms > .auth-form {
  grid-area: 1 / 1;
  align-content: start;
}

.auth-forms > .auth-form[hidden] {
  display: grid !important;
  visibility: hidden;
  pointer-events: none;
}

.auth-field {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-field > svg {
  position: absolute;
  left: 12px;
  color: var(--ink-3);
  pointer-events: none;
}

.auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.auth-field input::placeholder { color: var(--ink-4); }
.auth-field input:hover { border-color: #CFE0FB; }
.auth-field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 110, 255, 0.12);
  background: #FCFDFF;
}

.auth-notice {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--brand-weak);
  border: 1px solid #D6E6FF;
  color: #1F4E96;
  font-size: 12px;
  line-height: 1.65;
}

.auth-error {
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--err-weak);
  border: 1px solid #F6CCD2;
  color: #A32B39;
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------------- 用户管理 ---------------- */

.admin-body {
  display: grid;
  gap: 18px;
  padding: 16px 20px 22px;
}

.admin-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.auth-input + .auth-input,
.admin-body .auth-input { margin-top: 0; }

.admin-user-list { display: grid; gap: 8px; }

.admin-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.admin-user-qq {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.admin-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-weak);
  border-radius: var(--r-xs);
  padding: 1px 7px;
}

.admin-user-tip {
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.admin-del-btn { margin-left: auto; }

.admin-user-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
}

/* ---------------- 服务未启动 ---------------- */

.offline-screen {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(1000px 460px at 50% -10%, #E8F1FF 0%, rgba(255, 255, 255, 0) 60%),
    var(--canvas);
}

.offline-card {
  width: min(420px, 100%);
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  text-align: center;
}

.offline-icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--brand-weak);
  color: var(--brand);
  margin-bottom: 14px;
}

.offline-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.offline-desc {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

.offline-steps {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  text-align: left;
}

.offline-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #FBFCFE;
  font-size: 12.5px;
  color: var(--ink-2);
}

.step-no {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-weak);
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
}

.offline-tip {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 150;
  transform: translate(-50%, 12px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 18px;
  border-radius: var(--r-sm);
  background: #141A24;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--sh-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #0B7A50; }
.toast.err { background: #B32A39; }

/* ---------------- 动效 ---------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 1080px) {
  .page-inner { padding: 0 16px; }
  .topbar-inner { padding: 0 16px; }
}

@media (max-width: 900px) {
  .page { padding-bottom: 108px; }

  .action-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 -10px 28px -18px rgba(10, 20, 40, 0.3);
  }

  .action-dock-inner { gap: 12px; }
  .action-dock-tip { display: none; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 0; }

  .toast { bottom: 88px; }
}

@media (max-width: 720px) {
  .log-console { height: 260px; }
  .log-date { display: none; }
  .hero { padding: 18px; gap: 14px; }
  .status-title { font-size: 22px; }
  .hero-mark { width: 64px; height: 64px; opacity: 0.07; }
  .hero-mark svg { width: 58px; height: 58px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .card { padding: 16px 16px 18px; }
  .card-head { flex-wrap: wrap; }
  .log-tools { width: 100%; }
  .log-filter,
  .log-filter:focus { flex: 1 1 auto; width: auto; min-width: 0; }
  .log-console { max-height: 300px; }
  .auth-screen { padding: 16px; }
  .auth-modal { padding: 26px 20px; }
  .modal-backdrop { padding: 14px; }
  .modal { border-radius: var(--r-md); }
  .engine-badge { height: 24px; padding: 0 8px; font-size: 11px; gap: 5px; }
}

@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
  .hero-mark { display: none; }
}

@media (min-width: 960px) {
  .auth-shell { grid-template-columns: 1.02fr 0.98fr; }
  .auth-aside { display: flex; flex-direction: column; }
  .auth-modal { padding: 40px 40px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .rise { opacity: 1; transform: none; }
}

/* ============================================================
   动效层：只动 transform / opacity / 颜色，不触发布局回流
   ============================================================ */

html { scroll-behavior: smooth; }

.skip-link { transition: top var(--dur-3) var(--ease); }

.icon-btn,
.chip-btn {
  transition: background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}

.icon-btn:active,
.chip-btn:active { transform: scale(0.96); }

.btn:active { transform: translateY(1px) scale(0.99); }

.auth-tab {
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}

body:has(#stopBtn:not([hidden])) .hero-dot {
  animation: dot-pulse 1.7s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 4px rgba(0, 110, 255, 0.14); }
  50% { opacity: 0.45; box-shadow: 0 0 0 7px rgba(0, 110, 255, 0.05); }
}

.status-list:empty::after {
  content: "正在等待账号进度…";
  display: block;
  padding: 16px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

.settings-chevron { transition: transform var(--dur-3) var(--ease-spring); }

.school-dropdown.open { animation: menu-in var(--dur-2) var(--ease-spring) both; }

.log-line { animation: log-in var(--dur-3) var(--ease) both; }

.modal-backdrop { animation: fade-in var(--dur-2) var(--ease) both; }

.modal { animation: modal-pop var(--dur-3) var(--ease-spring) both; }

.auth-shell { animation: shell-in var(--dur-4) var(--ease-spring) both; }

.offline-card { animation: shell-in var(--dur-4) var(--ease-spring) both; }

.rise { animation: rise var(--dur-4) var(--ease-spring) both; }
.rise:nth-child(2) { animation-delay: 50ms; }
.rise:nth-child(3) { animation-delay: 100ms; }
.rise:nth-child(4) { animation-delay: 150ms; }
.rise:nth-child(5) { animation-delay: 200ms; }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

@keyframes log-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.975); }
  to { opacity: 1; transform: none; }
}

@keyframes shell-in {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .action-dock {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--surface);
  }
}

@media (min-width: 1080px) {
  .action-dock {
    min-width: 0;
    margin: 0;
    padding: 16px;
  }
  .action-dock-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .hero-actions .btn { width: 100%; justify-content: center; }
}
