/* ==========================================================================
   manager.css — 题库管理页（#/manager）
   私有类名统一 .mgr- 前缀；只依赖 base.css 的设计变量与通用组件
   ========================================================================== */

.mgr-page { padding-bottom: 20px; }

/* ------------------------------------------------------------- 页头 -- */
.mgr-head { padding-bottom: 30px; }
.mgr-head-grid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
}
.mgr-head-copy { max-width: 720px; min-width: 0; }
.mgr-title { margin-top: 14px; }
.mgr-title-soft { display: block; color: var(--muted); font-weight: 400; }
.mgr-head-copy .lead { margin-top: 14px; max-width: 620px; }
.mgr-head-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(122px, 1fr));
  gap: 10px;
  flex: 0 0 auto;
  min-width: 300px;
}
.mgr-head-stat {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(255, 252, 246, 0.62);
}
.mgr-head-stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.mgr-head-stat span { font-size: 12px; color: var(--muted); }

/* -------------------------------------------------------------- tab -- */
.mgr-tabs {
  position: sticky;
  top: var(--nav-h);
  z-index: 30;
  display: flex;
  gap: 4px;
  padding: 7px;
  margin: 0 0 26px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(247, 243, 235, 0.9);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
}
.mgr-tabs::-webkit-scrollbar { display: none; }
.mgr-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.mgr-tab:hover { color: var(--ink-2); background: rgba(27, 58, 82, 0.06); }
.mgr-tab.is-active {
  background: var(--navy);
  color: #f6f1e7;
  box-shadow: var(--shadow-1);
}
.mgr-tab svg { width: 16px; height: 16px; }
.mgr-tab-ico { display: inline-grid; place-items: center; }
.mgr-tab-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(27, 58, 82, 0.12);
  color: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}
.mgr-tab.is-active .mgr-tab-badge { background: rgba(255, 255, 255, 0.18); }

/* ------------------------------------------------------------- 通用 -- */
.mgr-panel { animation: fadeIn 0.22s var(--ease); }
.mgr-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}
.mgr-section-note { max-width: 440px; text-align: right; }
.mgr-subsection { margin-top: 30px; }
.mgr-dl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mgr-dl-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
}
.mgr-dl-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--navy-soft);
  color: var(--navy);
}
.mgr-dl-ico svg { width: 20px; height: 20px; }
.mgr-dl-card .btn { margin-top: auto; }
.mgr-dl-card .row-wrap { padding-top: 2px; }
.mgr-dl-meta { margin-bottom: 2px; }

/* ------------------------------------------------------------- 导入 -- */
.mgr-parse-error { margin-bottom: 18px; }
.mgr-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 46px 28px;
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.9), rgba(251, 246, 236, 0.55));
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.mgr-drop:hover,
.mgr-drop:focus-visible {
  border-color: var(--teal);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.mgr-drop-ico {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
}
.mgr-drop-ico svg { width: 26px; height: 26px; }
.mgr-drop-copy { max-width: 620px; }
.mgr-drop-copy .h-card { font-size: 20px; }
.mgr-drop-actions { margin-top: 6px; justify-content: center; }
.mgr-panel.is-drag .mgr-drop {
  border-color: var(--teal);
  border-style: solid;
  background: var(--teal-soft);
}

.mgr-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.mgr-step {
  padding: 18px 20px;
  background: rgba(255, 252, 246, 0.62);
  box-shadow: none;
}
.mgr-step-num {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--copper);
}
.mgr-step-title {
  margin-top: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.mgr-step .small { margin-top: 6px; }

.mgr-notices { display: grid; gap: 10px; margin-bottom: 14px; }

.mgr-filebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  border-left: 3px solid var(--teal);
}
.mgr-filebar-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.mgr-filebar-ico {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal);
}
.mgr-filebar-ico svg { width: 19px; height: 19px; }
.mgr-file-name { font-weight: 700; word-break: break-all; }

.mgr-options { margin-top: 12px; padding: 15px 20px; }
.mgr-options .checkbox { align-items: flex-start; line-height: 1.65; }
.mgr-options .checkbox input { margin-top: 4px; }

.mgr-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.mgr-stat {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.mgr-stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.mgr-stat span { font-size: 12px; color: var(--muted); }
.mgr-stat.is-valid { border-top-color: var(--navy); }
.mgr-stat.is-valid b { color: var(--navy); }
.mgr-stat.is-new { border-top-color: var(--ok); }
.mgr-stat.is-new b { color: var(--ok); }
.mgr-stat.is-update { border-top-color: #2f6f9d; }
.mgr-stat.is-update b { color: #2f6f9d; }
.mgr-stat.is-dup { border-top-color: var(--faint); }
.mgr-stat.is-dup b { color: var(--muted); }
.mgr-stat.is-error { border-top-color: var(--danger); }
.mgr-stat.is-error b { color: var(--danger); }

.mgr-preview-head { gap: 14px; }
.mgr-preview-table { min-width: 960px; }
.mgr-preview-table th,
.mgr-preview-table td { white-space: nowrap; }
.mgr-preview-table .mgr-cell-title,
.mgr-preview-table .mgr-cell-reason { white-space: normal; }
.mgr-cell-title { min-width: 220px; font-weight: 600; color: var(--ink-2); }
.mgr-cell-source {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}
.mgr-cell-reason {
  min-width: 210px;
  font-size: 12.5px;
  color: var(--muted);
}
.mgr-line { width: 52px; color: var(--faint); font-size: 12px; }
.mgr-row-error td { background: rgba(189, 87, 59, 0.055); }
.mgr-row-dup td { color: var(--muted); }

.mgr-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.mgr-status.is-new { background: rgba(47, 125, 91, 0.14); color: var(--ok); }
.mgr-status.is-update { background: rgba(47, 111, 157, 0.14); color: #2f6f9d; }
.mgr-status.is-dup { background: var(--surface-3); color: var(--muted); }
.mgr-status.is-error { background: var(--copper-soft); color: var(--danger); }

.mgr-error-summary { margin-top: 16px; }
.mgr-error-list { margin-top: 6px; display: grid; gap: 4px; font-size: 13px; }
.mgr-error-list li { position: relative; padding-left: 14px; }
.mgr-error-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--copper);
}
.mgr-error-summary .tiny { margin-top: 8px; }

.mgr-import-actions { align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.mgr-import-actions p { max-width: 560px; }

.mgr-success {
  padding: 44px 32px;
  text-align: center;
  border-top: 3px solid var(--teal);
}
.mgr-success-ico {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
}
.mgr-success-ico svg { width: 30px; height: 30px; }
.mgr-success .row-wrap { justify-content: center; }
.mgr-success-lead { max-width: 640px; margin: 12px auto 0; }

/* ------------------------------------------------------- 模板 / 导出 -- */
.mgr-copy-row { padding: 18px 22px; }
.mgr-copy-inner { gap: 20px; align-items: center; }
.mgr-header-code {
  display: block;
  margin-top: 8px;
  padding: 8px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  word-break: break-all;
}
.mgr-field-table { min-width: 780px; }
.mgr-field-name { white-space: nowrap; font-weight: 600; color: var(--ink-2); }
.mgr-field-example { color: var(--muted); }
.mgr-req {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--copper-soft);
  color: var(--copper);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.mgr-code {
  max-height: 330px;
  margin: 14px 0 0;
  padding: 16px 18px;
  overflow: auto;
  border-radius: var(--r-sm);
  background: var(--panel);
  color: #dfe8ee;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre;
}
.mgr-static-files {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.mgr-static-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--teal);
}
.mgr-static-link svg { width: 14px; height: 14px; }

.mgr-export-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mgr-export-card { display: flex; flex-direction: column; height: 100%; }
.mgr-export-head { align-items: flex-start; gap: 12px; }
.mgr-export-count {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
}
.mgr-export-fields {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--faint);
}
.mgr-export-card .row-wrap { margin-top: auto; padding-top: 16px; }

/* ------------------------------------------------------------- 自建 -- */
.mgr-panel-head { gap: 24px; }
.mgr-custom-toolbar { display: flex; align-items: center; gap: 16px; }
.mgr-custom-toolbar .search-field { flex: 1 1 auto; }
.mgr-custom-found { flex: 0 0 auto; color: var(--faint); }
.mgr-custom-list { display: grid; gap: 12px; }
.mgr-custom-card {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
}
.mgr-custom-body { min-width: 0; flex: 1 1 auto; }
.mgr-custom-id { margin-left: auto; align-self: center; font-size: 11px; color: var(--faint); }
.mgr-custom-title { margin-top: 10px; font-size: 18px; }
.mgr-custom-prompt { margin-top: 7px; }
.mgr-custom-tags { margin-top: 12px; gap: 8px; }
.mgr-custom-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.mgr-danger-text { color: var(--danger) !important; }
.mgr-danger-text:hover { background: var(--copper-soft) !important; }

/* ------------------------------------------------------------- 表单 -- */
.mgr-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  padding-bottom: 6px;
}
.mgr-form-full { grid-column: 1 / -1; }
.mgr-form-error {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-left: 3px solid var(--copper);
  border-radius: var(--r-sm);
  background: var(--copper-soft);
  color: var(--danger);
  font-size: 13.5px;
  line-height: 1.65;
}
.mgr-form .textarea { min-height: 64px; }

/* ----------------------------------------------------------- 响应式 -- */
@media (max-width: 1080px) {
  .mgr-head-grid { flex-wrap: wrap; align-items: flex-start; gap: 24px; }
  .mgr-head-stats {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .mgr-dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .mgr-export-grid { grid-template-columns: minmax(0, 1fr); }
  .mgr-custom-card { flex-direction: column; gap: 14px; }
  .mgr-custom-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
}

@media (max-width: 760px) {
  .mgr-head { padding-bottom: 22px; }
  .mgr-head-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mgr-tabs { top: calc(var(--nav-h) - 1px); margin-bottom: 20px; padding: 6px; }
  .mgr-tab { padding: 9px 14px; font-size: 13px; }
  .mgr-section-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .mgr-section-note { max-width: none; text-align: left; }
  .mgr-dl-grid,
  .mgr-steps,
  .mgr-form-grid { grid-template-columns: minmax(0, 1fr); }
  .mgr-form-full { grid-column: auto; }
  .mgr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mgr-stats .mgr-stat:first-child { grid-column: 1 / -1; }
  .mgr-drop { padding: 34px 20px; }
  .mgr-import-actions { flex-direction: column; align-items: stretch; }
  .mgr-import-actions .row-wrap { justify-content: stretch; }
  .mgr-import-actions .row-wrap .btn { flex: 1 1 auto; }
  .mgr-copy-inner { flex-direction: column; align-items: flex-start; }
  .mgr-custom-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .mgr-success { padding: 32px 20px; }
  .mgr-filebar { flex-direction: column; align-items: flex-start; }
  .mgr-panel-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .mgr-custom-id { margin-left: 0; }
}

@media (max-width: 480px) {
  .mgr-head-stat b { font-size: 21px; }
  .mgr-stat b { font-size: 22px; }
  .mgr-static-files { gap: 10px; }
  /* 360px 下收起 tab 图标，让四个 tab 尽量一屏放下 */
  .mgr-tab { padding: 8px 12px; font-size: 12.5px; gap: 5px; }
  .mgr-tab-ico { display: none; }
}
