/* ============================================================
   职业技能竞赛理论考试平台 —— 基础样式
   设计原则：商务、简约、大方
   主色：藏青（权威/专业），辅以金（荣誉），中性灰做底
   ============================================================ */

:root {
  /* 主色系 */
  --navy-900: #0f2540;
  --navy-800: #16324f;
  --navy-700: #1d4166;
  --navy-600: #27527f;
  --navy-500: #33689c;

  /* 金色点缀 */
  --gold-600: #b8860b;
  --gold-500: #d4a017;
  --gold-400: #e8be4d;
  --gold-100: #fdf6e3;

  /* 语义色 */
  --success: #1d7a4c;
  --success-bg: #e8f5ee;
  --warning: #b7791f;
  --warning-bg: #fdf4e3;
  --danger: #b8322b;
  --danger-bg: #fbeceb;
  --info: #2b6cb0;
  --info-bg: #e8f1fa;

  /* 中性色 */
  --ink-900: #1a202c;
  --ink-800: #2d3748;
  --ink-700: #4a5568;
  --ink-600: #718096;
  --ink-500: #a0aec0;
  --ink-400: #cbd5e0;
  --ink-300: #e2e8f0;
  --ink-200: #edf2f7;
  --ink-100: #f7fafc;
  --white: #ffffff;

  /* 尺寸 */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 37, 64, 0.06);
  --shadow: 0 2px 8px rgba(15, 37, 64, 0.08);
  --shadow-lg: 0 8px 28px rgba(15, 37, 64, 0.12);
  --header-h: 62px;
  --maxw: 1200px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-800);
  background: var(--ink-100);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;   /* 移动端安全：用 dvh 而非 vvh */
}

/* 数字用等宽字体，倒计时不跳动 */
.mono, .timer, .countdown {
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

a { color: var(--navy-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 键盘焦点必须可见（无障碍） */
:focus-visible {
  outline: 2px solid var(--navy-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* 屏幕阅读器专用文本 */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ==================== 顶部导航 ==================== */
.topbar {
  height: var(--header-h);
  background: var(--navy-900);
  color: var(--white);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.topbar-inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.brand-mark {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy-900);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.brand-text { min-width: 0; }
.brand-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

/* ==================== 布局容器 ==================== */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.container-narrow { max-width: 720px; }
.container-wide { max-width: 1440px; }

.card {
  background: var(--white);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 32px 36px; }

.section-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.section-desc {
  font-size: 13.5px;
  color: var(--ink-600);
  margin-bottom: 22px;
}

/* 步骤指示器 */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }

.step {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  font-size: 13.5px;
  color: var(--ink-500);
}

.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink-300);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
}

.step.active { color: var(--navy-800); font-weight: 600; }
.step.active .step-num { background: var(--navy-700); }
.step.done { color: var(--success); }
.step.done .step-num { background: var(--success); }

.step-line {
  width: 30px;
  height: 1px;
  background: var(--ink-300);
  margin: 0 12px;
  flex-shrink: 0;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 24px;
  font-size: 14.5px;
  font-family: inherit;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.4;
  min-height: 44px;   /* 移动端可点区域 */
}

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

.btn-primary {
  background: var(--navy-700);
  color: var(--white);
  border-color: var(--navy-700);
}
.btn-primary:hover:not(:disabled) { background: var(--navy-800); border-color: var(--navy-800); }

.btn-gold {
  background: var(--gold-500);
  color: var(--navy-900);
  border-color: var(--gold-500);
  font-weight: 600;
}
.btn-gold:hover:not(:disabled) { background: var(--gold-400); border-color: var(--gold-400); }

.btn-outline {
  background: var(--white);
  color: var(--navy-700);
  border-color: var(--ink-400);
}
.btn-outline:hover:not(:disabled) { border-color: var(--navy-600); background: var(--ink-100); }

.btn-ghost {
  background: transparent;
  color: var(--navy-700);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--ink-200); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #9e2a24; }

.btn-lg { padding: 14px 34px; font-size: 16px; min-height: 52px; }
.btn-sm { padding: 7px 14px; font-size: 13px; min-height: 34px; }
.btn-block { width: 100%; }

/* ==================== 表单 ==================== */
.field { margin-bottom: 20px; }

.label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-800);
  margin-bottom: 7px;
}
.label .req { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  max-width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink-900);
  background: var(--white);
  border: 1px solid var(--ink-400);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(51, 104, 156, 0.13);
}

.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--ink-100);
  color: var(--ink-600);
  cursor: not-allowed;
}

.textarea { min-height: 110px; resize: vertical; line-height: 1.7; }

.hint { font-size: 12.5px; color: var(--ink-600); margin-top: 6px; }
.error-text { font-size: 12.5px; color: var(--danger); margin-top: 6px; }

/* 单选/复选组（横向排列） */
.radio-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}
.check-item input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--navy-700); }

/* ==================== 提示条 ==================== */
.alert {
  padding: 13px 17px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-bottom: 20px;
  border: 1px solid;
  line-height: 1.65;
}
.alert-icon { flex-shrink: 0; font-weight: 700; font-size: 14px; line-height: 1.6; }
.alert-info { background: var(--info-bg); border-color: #bcd8f0; color: #1c5289; }
.alert-success { background: var(--success-bg); border-color: #b6e0c8; color: #14603a; }
.alert-warning { background: var(--warning-bg); border-color: #f0d9a8; color: #8f5e14; }
.alert-danger { background: var(--danger-bg); border-color: #f0c4c1; color: #8f2620; }

/* ==================== 徽章 / 标签 ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-navy { background: var(--info-bg); color: #1c5289; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: var(--ink-200); color: var(--ink-700); }
.badge-gold { background: var(--gold-100); color: var(--gold-600); }

/* ==================== 表格 ==================== */
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 72vh;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-lg);
  background: var(--white);
  -webkit-overflow-scrolling: touch;
}

/* 全局滚动条：桌面端可见，长表格 / 长列表可滚动查看（需求 12） */
* { scrollbar-width: thin; scrollbar-color: var(--ink-400) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-400); border-radius: 100px; border: 2px solid var(--white); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-500); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}

table.data th {
  background: var(--ink-100);
  color: var(--ink-700);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.4px;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink-300);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink-200);
  color: var(--ink-800);
  vertical-align: middle;
}

table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--ink-100); }
table.data .num { text-align: right; font-family: "SF Mono", Menlo, monospace; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.link-btn {
  background: none;
  border: none;
  color: var(--navy-600);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.link-btn:hover { background: var(--info-bg); text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-bg); }

/* ==================== 空状态 ==================== */
.empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--ink-500);
}
.empty-icon { font-size: 40px; margin-bottom: 14px; opacity: 0.4; }
.empty-title { font-size: 15.5px; color: var(--ink-700); margin-bottom: 6px; font-weight: 500; }
.empty-desc { font-size: 13.5px; }

/* ==================== 加载中 ==================== */
.loading { text-align: center; padding: 50px 20px; color: var(--ink-500); font-size: 14px; }

.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--ink-300);
  border-top-color: var(--navy-600);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 弹窗 ==================== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 37, 64, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 88dvh;
  overflow-y: auto;
}

.modal-head {
  padding: 22px 26px 0;
}
.modal-title {
  font-size: 17.5px;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 8px;
}
.modal-body { padding: 16px 26px; font-size: 14.5px; color: var(--ink-700); line-height: 1.75; }
.modal-foot {
  padding: 0 26px 24px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-foot .btn { flex: 1; min-width: 110px; }

@media (max-width: 560px) {
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
}

/* 交卷三次确认的进度点 */
.confirm-steps { display: flex; gap: 8px; justify-content: center; margin: 18px 0 4px; }
.confirm-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink-300);
  transition: background 0.2s;
}
.confirm-dot.on { background: var(--navy-600); }

/* ==================== 页脚 ==================== */
.footer {
  text-align: center;
  padding: 26px 20px 34px;
  font-size: 12.5px;
  color: var(--ink-500);
  line-height: 1.9;
}
.footer-slogan {
  font-size: 14px;
  color: var(--gold-600);
  font-weight: 500;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

/* ==================== 工具类 ==================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.flex-center { display: flex; align-items: center; gap: 10px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.small { font-size: 12.5px; }
.muted { color: var(--ink-600); }
.strong { font-weight: 600; color: var(--navy-900); }
.nowrap { white-space: nowrap; }
.gap-4 { gap: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* ==================== 响应式断点 ==================== */

/* 平板 */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .card-pad { padding: 26px 24px; }
  .container { padding: 20px 16px 50px; }
}

/* 手机 */
@media (max-width: 640px) {
  body { font-size: 14.5px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 14px; }

  .container { padding: 16px 12px 44px; }
  .card-pad { padding: 22px 18px; }

  .brand-title { font-size: 14.5px; }
  .brand-sub { display: none; }
  .brand-mark { width: 30px; height: 30px; font-size: 13px; }
  .topbar-inner { padding: 0 14px; gap: 10px; }
  .topbar-right { font-size: 12.5px; gap: 10px; }

  .section-title { font-size: 17px; }
  .btn { padding: 11px 18px; font-size: 14px; }
  .btn-lg { padding: 13px 24px; font-size: 15.5px; }

  .step-line { width: 14px; margin: 0 7px; }
  .step { font-size: 12.5px; gap: 6px; }
  .step-num { width: 22px; height: 22px; font-size: 11.5px; }

  .alert { padding: 11px 14px; font-size: 13.5px; }
  .footer { padding: 20px 14px 28px; }

  table.data th, table.data td { padding: 10px 11px; }
}

/* 超小屏 */
@media (max-width: 380px) {
  .brand-title { font-size: 13.5px; }
  .btn { padding: 10px 14px; }
}

/* 打印：准赛证需要打印，所以保留打印样式 */
@media print {
  .topbar, .no-print, .footer, .btn { display: none !important; }
  body { background: var(--white); }
  .card { border: none; box-shadow: none; }
}
