:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1f2a37;
  --muted: #6b7280;
  --primary: #2563eb;
  --border: #e5e7eb;
  --success: #16a34a;
  --warning: #f59e0b;
  --gray: #6b7280;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.login-card h2 {
  margin: 0 0 8px;
}

.login-btn {
  width: 100%;
  margin-top: 10px;
}

.login-tips {
  margin: 10px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
  align-items: end;
}

.captcha-input {
  margin-top: 0;
}

.captcha-code {
  height: 40px;
  border: 1px dashed #94a3b8;
  background: #f8fafc;
  border-radius: 8px;
  letter-spacing: 2px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #111827;
  color: #f9fafb;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}

.logo {
  margin: 0 0 20px;
  font-size: 18px;
}

.menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #d1d5db;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}

.menu-item:hover,
.menu-item.active {
  background: #1f2937;
  color: #fff;
}

.menu-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-arrow {
  transition: transform 0.2s ease;
  font-size: 12px;
}

.menu-arrow.expanded {
  transform: rotate(180deg);
}

.submenu-wrap {
  margin-bottom: 4px;
}

.menu-item-sub {
  width: calc(100% - 14px);
  margin-left: 14px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
}

.light-btn {
  width: 100%;
  color: #e5e7eb;
  background: #1f2937;
  border-color: #374151;
}

.content {
  padding: 24px;
}

.content-userbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.userbar-right-cluster {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.system-notice-wrap {
  position: relative;
}

.notice-bell-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.notice-bell-btn:hover {
  background: #f8fafc;
}

.notice-bell-icon {
  font-size: 18px;
  line-height: 1;
}

.notice-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.notice-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(380px, calc(100vw - 48px));
  max-height: min(420px, 70vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  z-index: 30;
}

.notice-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.notice-clear-btn {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.notice-clear-btn:hover:not(:disabled) {
  color: #0f172a;
  background: #f1f5f9;
}

.notice-clear-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.notice-empty {
  padding: 20px 14px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

.notice-list {
  overflow-y: auto;
  max-height: min(360px, 60vh);
}

.notice-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.notice-item:last-child {
  border-bottom: none;
}

.notice-item-title {
  font-weight: 600;
  color: #0f172a;
  font-size: 14px;
  margin-bottom: 4px;
}

.notice-item-time {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}

.notice-item-body {
  font-size: 13px;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.user-menu-wrap {
  position: relative;
}

.user-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.user-icon {
  font-size: 20px;
  line-height: 1;
}

.user-meta-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 240px;
  position: absolute;
  top: 46px;
  right: 0;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.user-meta-card p {
  margin: 4px 0;
  font-size: 13px;
  color: #374151;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0 0 4px;
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

.primary-btn {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

.primary-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.stat-card h3 {
  margin: 8px 0 0;
  font-size: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.entry-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.entry-card h3 {
  margin: 0 0 8px;
}

.entry-card .primary-btn {
  margin-top: 14px;
}

.entry-secondary-btn {
  margin-top: 10px;
  width: 100%;
}

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

.notice-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid label,
.block-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #374151;
}

.block-label {
  margin-top: 10px;
}

.apply-inline-panel h3 {
  margin: 0 0 8px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

input {
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  line-height: 20px;
}

.tag-draft { background: #f3f4f6; color: #374151; }
.tag-published { background: #dbeafe; color: #1d4ed8; }
.tag-running { background: #dcfce7; color: #166534; }
.tag-finished { background: #fef3c7; color: #92400e; }
.tag-pending { background: #fef3c7; color: #92400e; }
.tag-approved { background: #dcfce7; color: #166534; }
.tag-rejected { background: #fee2e2; color: #991b1b; }
.tag-flow-pending { background: #fef3c7; color: #92400e; }
.tag-flow-approved { background: #dcfce7; color: #166534; }
.tag-flow-rejected { background: #fee2e2; color: #991b1b; }
.tag-flow-returned { background: #ede9fe; color: #6d28d9; }
.tag-flow-exam { background: #dbeafe; color: #1d4ed8; }
.tag-flow-effective { background: #fef3c7; color: #92400e; }

.actions {
  display: flex;
  gap: 6px;
}

.action-group {
  margin-top: 12px;
}

.group-title {
  margin: 0 0 8px;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  color: #374151;
  cursor: pointer;
}

.ghost-btn-success {
  border-color: #86efac;
  color: #166534;
}

.ghost-btn-danger {
  border-color: #fca5a5;
  color: #991b1b;
}

.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.pagination button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px;
}

textarea {
  margin-top: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
  font: inherit;
}

.inline-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.userbar-actions {
  margin-top: 8px;
}

.error-text {
  color: #dc2626;
  margin: 8px 0 0;
  font-size: 13px;
}

.success-text {
  color: #166534;
  margin: 8px 0 0;
  font-size: 13px;
}

.countdown-badge {
  display: inline-block;
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}

.countdown-badge-warning {
  background: #dc2626;
  animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.75;
  }
}

.question-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fcfcfd;
}

.question-item {
  margin-bottom: 10px;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

/* 在线考试整页（顶栏 + 试卷区）全部左对齐 */
.topbar.exam-page {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}

.topbar.exam-page h2,
.topbar.exam-page .muted {
  text-align: left;
}

.panel.exam-page {
  text-align: left;
}

.panel.exam-page .question-block {
  text-align: left;
}

.panel.exam-page .question-block h3 {
  text-align: left;
}

.panel.exam-page .question-item {
  text-align: left;
}

.panel.exam-page .question-item > p {
  text-align: left;
}

.panel.exam-page .option-label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
  gap: 8px;
}

.panel.exam-page .option-label input[type="radio"] {
  flex-shrink: 0;
  margin: 0.2em 0 0 0;
}

.panel.exam-page .option-label span {
  flex: 1 1 auto;
  text-align: left;
}

.panel.exam-page textarea {
  text-align: left;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.panel.exam-page .error-text,
.panel.exam-page .success-text,
.panel.exam-page > .muted {
  text-align: left;
  width: 100%;
}

.panel.exam-page .inline-actions {
  justify-content: flex-start;
}

.answer-view p {
  margin: 0 0 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.score-info-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f9fafb;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid var(--border);
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.modal-close-btn:hover {
  color: #0f172a;
}

.modal-panel h3 {
  margin: 0 0 10px;
}

.review-modal-panel {
  max-width: 920px;
  max-height: 88vh;
  overflow-y: auto;
}

.readonly-answer {
  background: #f8fafc;
  color: #334155;
}

.exam-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.exam-type-btn {
  padding: 10px 12px;
  border-radius: 8px;
}

.permission-tree {
  display: grid;
  gap: 8px;
}

.permission-node {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafc;
}

.permission-page-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.permission-page {
  margin: 0;
  font-weight: 600;
  color: #1f2937;
}

.permission-buttons {
  margin: 0;
  color: #475569;
  font-size: 13px;
}

.permission-buttons-edit {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.permission-btn-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entry-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .exam-type-grid {
    grid-template-columns: 1fr;
  }
}

.apply-config-form {
  max-width: 480px;
}

.apply-config-hint {
  margin: -6px 0 10px;
  font-size: 13px;
}
