:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --ok: #16a34a;
  --ok-bg: #f0fdf4;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --muted: #6b7280;
  --muted-bg: #f3f4f6;
  --text: #111827;
  --text-2: #374151;
  --border: #e5e7eb;
  --bg: #f6f8fb;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(17, 24, 39, .06), 0 4px 16px rgba(17, 24, 39, .06);
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

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

/* ---------- header ---------- */
.topbar {
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  color: #fff;
  padding: 0 24px;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: #fff; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.topnav { display: flex; gap: 6px; }
.topnav a {
  color: rgba(255,255,255,.85); padding: 6px 14px; border-radius: 8px; font-size: 14px;
}
.topnav a:hover, .topnav a.active { background: rgba(255,255,255,.16); color: #fff; text-decoration: none; }

.container { max-width: 1080px; margin: 0 auto; padding: 24px; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%);
  color: #fff; border-radius: var(--radius); padding: 40px 36px; margin-bottom: 24px;
}
.hero h1 { font-size: 26px; margin-bottom: 8px; }
.hero p { color: rgba(255,255,255,.85); max-width: 640px; }
.hero-stats { display: flex; gap: 28px; margin-top: 22px; flex-wrap: wrap; }
.hero-stats .stat b { font-size: 22px; display: block; }
.hero-stats .stat span { font-size: 13px; color: rgba(255,255,255,.75); }

/* ---------- sections ---------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 26px 0 14px; flex-wrap: wrap; gap: 12px;
}
.section-head h2 { font-size: 19px; }
.section-head .sub { color: var(--muted); font-size: 13px; }

/* ---------- filter chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--text-2);
  padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: 13px;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.plan-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.plan-card .tags { display: flex; gap: 8px; align-items: center; }
.plan-card h3 { font-size: 16px; line-height: 1.45; }
.plan-meta { display: flex; flex-direction: column; gap: 5px; color: var(--text-2); font-size: 13.5px; }
.plan-meta .row { display: flex; gap: 8px; align-items: baseline; }
.plan-meta .ico { width: 18px; text-align: center; flex: none; }
.plan-notice {
  background: var(--muted-bg); border-radius: 8px; padding: 8px 10px;
  font-size: 12.5px; color: var(--muted);
}
.progress-wrap { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.progress { flex: 1; height: 8px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.progress > i.hot { background: var(--warn); }
.card-foot { margin-top: auto; display: flex; justify-content: flex-end; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.muted { background: var(--muted-bg); color: var(--muted); }
.badge.primary { background: var(--primary-light); color: var(--primary-dark); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  padding: 8px 18px; font-size: 14px; font-weight: 600; transition: .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-bg); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field label .req { color: var(--bad); margin-left: 2px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 12px; font-size: 14px; background: #fff; color: var(--text);
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- 附件上传 ---------- */
.upload-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-line .btn { flex: none; }
.upload-name {
  font-size: 13px; color: var(--muted); word-break: break-all;
  max-width: 100%; line-height: 1.5;
}
.upload-name.has { color: var(--text); font-weight: 600; }

/* 表单中的单行勾选项（如「必须上传」） */
.field label.check-line {
  display: flex; align-items: center; gap: 8px;
  font-weight: 400; font-size: 13px; color: var(--text);
  margin-bottom: 0; cursor: pointer;
}
.field label.check-line input[type="checkbox"] { width: auto; margin: 0; flex: none; }

/* ---------- multi-select chips (日期/时段标签) ---------- */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-list:empty { margin-top: 0; }
.chip-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary-dark);
  padding: 3px 6px 3px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.chip-tag .rm {
  border: none; background: rgba(37,99,235,.12); color: var(--primary-dark);
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.chip-tag .rm:hover { background: var(--primary); color: #fff; }

/* ---------- query panel ---------- */
.query-box {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.query-box form { display: flex; gap: 10px; flex-wrap: wrap; }
.query-box input { flex: 1; min-width: 240px; border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; font-size: 14px; }
.query-box input:focus { outline: none; border-color: var(--primary); }

/* ---------- table ---------- */
.table-wrap {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: auto; box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--muted-bg); color: var(--muted); font-weight: 600; font-size: 12.5px; }
tbody tr:hover { background: #fafbff; }
td.wrap { white-space: normal; min-width: 180px; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 16px;
  overflow: auto;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(15,23,42,.25); animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.plan-summary {
  background: var(--primary-light); border-radius: 10px; padding: 12px 14px;
  font-size: 13.5px; margin-bottom: 16px; color: var(--primary-dark);
}

/* 温馨提示正文（报名前阅读） */
.notice-box {
  white-space: pre-wrap; line-height: 1.9; font-size: 14px; color: var(--text-2);
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; max-height: 46vh; overflow-y: auto;
}

/* ---------- toast ---------- */
#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast-item {
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: pop .18s ease;
  max-width: 90vw;
}
.toast-item.ok { background: #14532d; }
.toast-item.err { background: #7f1d1d; }

/* ---------- admin ---------- */
.login-wrap { max-width: 380px; margin: 60px auto; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 30px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 18px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card b { font-size: 24px; display: block; }
.stat-card span { font-size: 12.5px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab {
  border: none; background: none; padding: 10px 18px; font-size: 14.5px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar.filters-toolbar { justify-content: flex-start; }
.toolbar select { border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; height: 34px; font-size: 13.5px; background: #fff; color: var(--text); }
.toolbar input[type="search"] {
  flex: 0 1 200px; min-width: 140px; max-width: 200px;
  border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; height: 34px;
  font-size: 13.5px; background: #fff;
}
.toolbar .push-right { margin-left: auto; }
.toolbar .date-range {
  display: flex; align-items: center; gap: 5px; flex: 0 0 auto; white-space: nowrap;
  font-size: 12.5px; color: var(--muted);
}
.toolbar .date-range .dr-label { font-size: 12.5px; }
.toolbar .date-range input[type="date"] {
  width: 142px; height: 34px; padding: 0 4px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--text, #1f2937);
}
.toolbar .dr-sep { color: var(--muted); }
.toolbar .batch-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toolbar .btn-sm { height: 34px; padding: 0 12px; border-radius: 8px; }
.toolbar .batch-count { font-size: 12.5px; color: var(--muted); padding: 0 4px; white-space: nowrap; }
.toolbar .batch-count.active { color: var(--primary-dark); font-weight: 600; }

/* 预约列表勾选列 */
th.col-check, td.col-check { width: 34px; text-align: center; padding-left: 8px; padding-right: 4px; }
th.col-check input[type="checkbox"], td.col-check input[type="checkbox"] {
  width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary);
  vertical-align: middle;
}
tbody tr.row-sel { background: var(--primary-light); }
tbody tr.row-sel:hover { background: #e6f0ff; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* ---------- 预约列表：窗口内滚动 + 分页 ---------- */
/* 表格区域限制在可视窗口内滚动：表头吸顶，横向滚动条固定在该区域底部
   （不再跑到整页最下方，行数再多也能直接左右拖动）；分页条紧贴在下方。 */
.table-wrap.table-fill {
  max-height: calc(100vh - 388px);
  min-height: 240px;
  overflow: auto;
  overscroll-behavior: contain;
}
.table-wrap.table-fill thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--muted-bg);
  box-shadow: inset 0 -1px 0 var(--border);
}
.table-wrap.table-fill tbody tr:last-child td { border-bottom: none; }

.list-pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 4px 2px;
}
.list-pager .pager-info { font-size: 12.5px; color: var(--muted); }
.list-pager .pager-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-pager .pager-page { font-size: 13px; color: var(--text-2, #374151); min-width: 62px; text-align: center; }
.list-pager .pager-size { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.list-pager .pager-size select {
  height: 30px; padding: 0 8px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
}
.list-pager .btn:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 720px) {
  .table-wrap.table-fill { max-height: calc(100vh - 320px); }
}

footer {
  border-top: 1px solid var(--border); margin-top: 40px; padding: 22px 24px 30px;
  text-align: center; color: var(--muted); font-size: 12.5px;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .hero { padding: 26px 20px; }
  .container { padding: 16px; }
}

/* ---------- 时段选择 / 提醒 / 时段名额 ---------- */
.slot-option {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font-size: 14px;
}
.slot-option:hover { border-color: var(--primary); }
.slot-option span { flex: 1; }
.slot-option i { font-style: normal; color: var(--ok); font-size: 12.5px; }
.slot-option.disabled { opacity: .55; cursor: not-allowed; }
.slot-option.disabled i { color: var(--bad); }
.check-line {
  display: flex; align-items: center; gap: 8px;
  font-weight: 400; margin-bottom: 6px; font-size: 14px;
}
.radio-line { display: flex; gap: 18px; flex-wrap: wrap; font-weight: 400; font-size: 14px; }
.radio-line label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.chip-cap {
  width: 62px; border: 1px solid var(--border); border-radius: 7px;
  padding: 2px 6px; font-size: 12.5px; margin-left: 4px;
}
.chip-tag { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- 日期多选日历 ---------- */
#pfDateTrigger {
  cursor: pointer; background: #fff;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.cal-panel {
  border: 1px solid var(--border); border-radius: 12px; background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  padding: 12px; margin-top: 8px; width: 280px; z-index: 30;
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.cal-nav {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  width: 28px; height: 28px; cursor: pointer; font-size: 15px; line-height: 1;
}
.cal-nav:hover { border-color: var(--primary); color: var(--primary); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { text-align: center; font-size: 11.5px; color: var(--muted); padding: 4px 0; }
.cal-day {
  border: none; background: transparent; border-radius: 8px;
  height: 32px; cursor: pointer; font-size: 13px;
}
.cal-day:hover { background: var(--primary-light); }
.cal-day.sel { background: var(--primary, #2563eb); color: #fff; font-weight: 600; }
.cal-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}

/* ---------- 日期×时段名额矩阵 ---------- */
.mx-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.mx-table th, .mx-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: center; white-space: nowrap; }
.mx-table th { background: var(--bg-soft, #f5f7fa); font-weight: 600; }
.mx-table .mx-corner { color: var(--muted); font-weight: 400; font-size: 12px; }
.mx-table .mx-date { font-weight: 500; }
.mx-table .mx-cap { width: 76px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 7px; text-align: center; font-size: 13px; }

/* 导出格式与列选择 */
.fmt-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.fmt-picker label {
  display: flex; align-items: center; gap: 7px; font-weight: 400; font-size: 13.5px;
  color: var(--text, #1f2937); cursor: pointer; margin: 0;
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 14px; background: #fff;
}
.fmt-picker label:has(input:checked) { border-color: var(--primary, #2563eb); background: #eff6ff; }
.col-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
.col-picker label {
  display: flex; align-items: center; gap: 7px; font-weight: 400; font-size: 13.5px;
  color: var(--text, #1f2937); cursor: pointer; margin: 0;
}
.col-picker-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* 后台：账户无任何权限时的常驻提示 */
.no-perm {
  background: var(--warn-bg, #fffbeb);
  border: 1px solid #fcd34d;
  border-left: 4px solid var(--warn, #d97706);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
  color: var(--text-2, #374151);
  font-size: 13.5px;
  line-height: 1.85;
}
.no-perm b { color: var(--warn, #d97706); font-size: 14.5px; }
.no-perm p { margin: 8px 0 0; }
.no-perm code {
  display: inline-block;
  max-width: 100%;
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 4px 8px;
  margin: 4px 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
  color: #92400e;
}

/* ---------- 后台：二级分类（申报类别）设置 ---------- */
.scat-body { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; padding-right: 2px; }
.scat-group { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; }
.scat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.scat-head b { font-size: 14px; }
.scat-req {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  font-size: 13px; font-weight: 400; color: var(--text-2, #374151); cursor: pointer;
}
.scat-req input { width: 15px; height: 15px; accent-color: var(--primary); }
.scat-empty { font-size: 12.5px; color: var(--muted); }
.scat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.scat-chips:empty { margin-top: 4px; }
.scat-add { display: flex; gap: 8px; margin-top: 10px; }
.scat-add input { flex: 1 1 auto; min-width: 0; padding: 7px 10px; font-size: 13px; }

/* 一级分类（作业类别）管理块 */
.cat-l1-box {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: #f8fafc; margin-bottom: 14px;
}
.cat-l1-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-l1-head b { font-size: 14px; }
.chip-tag.chip-l1 { background: #e0edff; color: #1e40af; }
.chip-tag .chip-meta { font-style: normal; font-weight: 500; font-size: 11.5px; opacity: .75; }
.chip-tag .edit {
  border: none; background: rgba(37,99,235,.12); color: var(--primary-dark);
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  font-size: 11px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.chip-tag .edit:hover { background: var(--primary); color: #fff; }
