* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #4f6ef7;
  --primary-light: #6a8bff;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2329;
  --text-muted: #8a9099;
  --border: #eef0f3;
  --danger: #e54d42;
  --success: #3cbf6f;
  --warning: #f5a623;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f6ef7 0%, #6a8bff 100%);
}
.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(31, 35, 41, 0.2);
}
.login-logo {
  font-size: 48px;
  text-align: center;
}
.login-title {
  text-align: center;
  font-size: 24px;
  margin-top: 12px;
}
.login-sub {
  text-align: center;
  color: var(--text-muted);
  margin: 8px 0 32px;
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
}
.login-demo-tip {
  text-align: center;
  color: var(--warning);
  font-size: 12px;
  margin-top: 16px;
}

/* 表单 */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #5a6068;
}
.required {
  color: var(--danger);
}
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
}
.input.select {
  cursor: pointer;
}
.textarea {
  resize: vertical;
  font-family: inherit;
}

/* 按钮 */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-light);
}
.btn-ghost {
  background: #fff;
  color: #5a6068;
  border: 1px solid #dcdfe6;
}
.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* 主布局 */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: #1f2a44;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.logo-icon {
  font-size: 24px;
  margin-right: 10px;
}
.logo-text {
  font-size: 18px;
  font-weight: 700;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.nav-item.active {
  background: var(--primary);
  color: #fff;
}
.nav-icon {
  margin-right: 12px;
  font-size: 16px;
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.view-title {
  font-size: 20px;
  font-weight: 700;
}
.demo-badge {
  background: var(--warning);
  color: #fff;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
}
.content {
  flex: 1;
  padding: 24px 32px;
}

/* 数据看板 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(31, 35, 41, 0.04);
}
.stat-card-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

/* 面板 */
.panel {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(31, 35, 41, 0.04);
}
.panel-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 1;
  min-width: 200px;
}
.toolbar-left .input {
  width: auto;
  flex: 1;
  max-width: 240px;
}
.toolbar-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
table th, table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
table th {
  background: #fafbfc;
  font-weight: 600;
  color: #5a6068;
  white-space: nowrap;
}
table tr:hover td {
  background: #fafbff;
}
.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.tag-single { background: #e8f0ff; color: #4f6ef7; }
.tag-judge { background: #fff3e0; color: #f5a623; }
.tag-multiple { background: #e6f7ee; color: #3cbf6f; }
.tag-active { background: #e6f7ee; color: #3cbf6f; }
.tag-inactive { background: #f0f1f5; color: #8a9099; }

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.modal-box {
  position: relative;
  background: #fff;
  border-radius: 12px;
  width: 560px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 16px;
}
.modal-close {
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* 选项编辑 */
.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0f1f5;
  color: #5a6068;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

/* 操作按钮 */
.action-link {
  color: var(--primary);
  cursor: pointer;
  margin-right: 12px;
  font-size: 13px;
}
.action-link.danger {
  color: var(--danger);
}
.action-link:hover {
  text-decoration: underline;
}

/* 响应式 */
@media (max-width: 900px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sidebar {
    width: 64px;
  }
  .logo-text, .nav-item span:not(.nav-icon), .sidebar-user {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .nav-icon {
    margin-right: 0;
  }
}

/* ========== 题库分组（卡片列表） ========== */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 20px;
}
.bank-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}
.bank-card:hover {
  box-shadow: 0 6px 18px rgba(31, 35, 41, 0.1);
  transform: translateY(-2px);
}
.bank-cover {
  width: 100%;
  height: 140px;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bank-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bank-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #07c160, #05a94f);
}
.bank-card-body {
  padding: 16px;
}
.bank-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bank-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  height: 34px;
  overflow: hidden;
  line-height: 1.5;
}
.bank-card-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}
.bank-card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.bank-card-actions .btn {
  flex: 1;
}
.bank-detail-name {
  font-size: 16px;
  font-weight: 600;
  margin-right: 12px;
  color: var(--text);
}
.btn-danger-ghost {
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger-ghost:hover {
  background: #fff5f5;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  height: auto;
  line-height: 1.4;
}

/* ========== 题库封面上传 ========== */
.cover-upload {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cover-preview {
  width: 100%;
  max-width: 320px;
  height: 160px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.cover-preview:hover {
  border-color: var(--primary);
}
.cover-preview .cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-placeholder {
  color: #a0a6ad;
  font-size: 13px;
}
.cover-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.cover-actions .input {
  flex: 1;
  min-width: 160px;
}
.cover-tip {
  font-size: 12px;
  color: #a0a6ad;
}
