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

body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: #f5f6f8;
  color: #333;
  line-height: 1.6;
}

/* ---- 表单页 ---- */
.form-page {
  max-width: 720px;
  margin: 40px auto;
  padding: 0 20px 60px;
}

.form-page h1 {
  font-size: 26px;
  color: #FF8C00;
  margin-bottom: 8px;
}

.form-page .subtitle {
  color: #888;
  margin-bottom: 28px;
  font-size: 14px;
}

.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

.form-group input,
.form-group select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.form-group input:focus,
.form-group select:focus { border-color: #FF8C00; }

.form-group .hint { font-size: 12px; color: #d0d0d0; }
.form-group .hint.rank-ok { color: #67C23A; }
.form-group .hint.rank-error { color: #F56C6C; }
.hint-inline { font-size: 12px; color: #ccc; font-weight: 400; }

.form-group input::placeholder {
  color: #d8d8d8;
  opacity: 1;
}

.radio-group, .checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.radio-item, .checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #444;
  cursor: pointer;
  padding: 8px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fafafa;
  transition: border-color .2s, background .2s;
}

.radio-item:has(input:checked),
.checkbox-item:has(input:checked) {
  border-color: #FF8C00;
  background: #fff8f0;
  color: #FF8C00;
}

.checkbox-item.disabled {
  opacity: .4;
  cursor: not-allowed;
}

.radio-item input, .checkbox-item input { accent-color: #FF8C00; }

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  background: linear-gradient(135deg, #FF8C00, #FF6B00);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, background .2s, transform .15s;
}

.btn-primary:hover:not(:disabled) { opacity: .9; }
.btn-primary:active:not(:disabled) { transform: scale(0.99); }

.btn-primary:disabled,
.btn-primary.is-loading {
  background: linear-gradient(135deg, #d4d4d4, #bdbdbd);
  color: #f5f5f5;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}

/* ---- Loading 遮罩 ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-card {
  text-align: center;
  padding: 40px 48px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(255, 140, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.06);
  animation: loading-card-in .45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loading-card-in {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.loading-spinner {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border: 4px solid #fff3e0;
  border-top-color: #FF8C00;
  border-right-color: #FF6B00;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.spinner-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  background: linear-gradient(135deg, #FF8C00, #FF6B00);
  border-radius: 50%;
  animation: pulse-core 1.2s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-core {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.7; }
}

.loading-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}

.loading-ai-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, #FF8C00, #FF6B00);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(255, 140, 0, 0.35);
  animation: ai-badge-glow 2s ease-in-out infinite;
}

@keyframes ai-badge-glow {
  0%, 100% { box-shadow: 0 2px 8px rgba(255, 140, 0, 0.35); }
  50%      { box-shadow: 0 2px 16px rgba(255, 140, 0, 0.55); }
}

.loading-desc {
  font-size: 13px;
  color: #888;
  line-height: 1.7;
  max-width: 280px;
  margin: 0 auto 20px;
}

.loading-desc strong {
  color: #FF8C00;
  font-weight: 600;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF8C00;
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1); opacity: 1; }
}

.error-msg {
  background: #fef0f0;
  color: #f56c6c;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.free-trial-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, #fff8f0 0%, #fff 100%);
  border: 1px solid #ffd699;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.free-trial-badge {
  flex-shrink: 0;
  background: linear-gradient(135deg, #FF8C00, #FF6B00);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.free-trial-banner strong {
  display: block;
  font-size: 15px;
  color: #333;
  margin-bottom: 4px;
}

.free-trial-banner p {
  font-size: 13px;
  color: #888;
  line-height: 1.55;
  margin: 0;
}

.purchase-guide {
  background: #fafafa;
  border: 1px solid #eee;
  border-left: 4px solid #FF8C00;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.purchase-guide strong {
  display: block;
  font-size: 15px;
  color: #333;
  margin-bottom: 6px;
}

.purchase-guide > p {
  font-size: 13px;
  color: #666;
  line-height: 1.55;
  margin-bottom: 12px;
}

.support-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.support-list li {
  display: flex;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
  border-top: 1px solid #eee;
}

.support-list li:first-child { border-top: none; padding-top: 0; }

.support-list li span {
  flex-shrink: 0;
  width: 64px;
  color: #999;
}

.support-list li strong {
  color: #333;
  font-weight: 600;
  word-break: break-all;
}

.invite-code-group .hint strong {
  color: #FF8C00;
  font-weight: 600;
}

.success-msg {
  background: #f0f9eb;
  color: #67c23a;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.invite-code-group input {
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 15px;
  font-weight: 600;
}

.hint-link {
  color: #FF8C00;
  text-decoration: none;
}

.hint-link:hover { text-decoration: underline; }

/* ---- 管理后台 ---- */
.admin-page { max-width: 420px; }

.admin-back {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
}

.admin-back a { color: #888; text-decoration: none; }
.admin-back a:hover { color: #FF8C00; }

.admin-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-header h1 {
  font-size: 24px;
  color: #FF8C00;
  margin-bottom: 6px;
}

.admin-header-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.admin-link {
  font-size: 13px;
  color: #FF8C00;
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid #ffd699;
  border-radius: 8px;
}

.admin-link.muted { color: #888; border-color: #eee; }
.admin-link:hover { background: #fff8f0; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.stat-card.highlight { border-top: 3px solid #FF8C00; }

.stat-val {
  font-size: 28px;
  font-weight: 700;
  color: #333;
}

.stat-lbl {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.admin-generate h2,
.admin-table-card h2 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #333;
}

.admin-generate {
  overflow: hidden;
  min-width: 0;
}

.admin-gen-form {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: end;
}

.btn-sm {
  width: auto;
  margin-top: 0;
  padding: 10px 20px;
  white-space: nowrap;
}

.new-codes-box {
  margin-top: 18px;
  padding: 14px;
  background: #fff8f0;
  border-radius: 8px;
  border: 1px dashed #ffd699;
}

.new-codes-title {
  font-size: 13px;
  color: #888;
  margin-bottom: 10px;
}

.new-codes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-copy {
  padding: 4px 12px;
  font-size: 12px;
  color: #FF8C00;
  background: #fff;
  border: 1px solid #ffd699;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.btn-copy:hover { background: #fff8f0; }

.btn-copy.copied {
  color: #67c23a;
  border-color: #c2e7b0;
  background: #f0f9eb;
}

.code-chip {
  display: inline-block;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 13px;
  font-weight: 600;
  color: #FF8C00;
  letter-spacing: 0.06em;
}

.admin-table-card { margin-top: 20px; }

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: #fafafa;
  color: #888;
  font-weight: 600;
  border-bottom: 1px solid #eee;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
}

.admin-table tr.row-used { opacity: .75; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge.unused { background: #f0f9eb; color: #67c23a; }
.badge.used { background: #f5f5f5; color: #999; }
.badge.pending { background: #fdf6ec; color: #e6a23c; }
.badge.sending { background: #ecf5ff; color: #409eff; }
.badge.sent { background: #f0f9eb; color: #67c23a; }
.badge.failed { background: #fef0f0; color: #f56c6c; }
.badge.recalled { background: #f5f5f5; color: #909399; }

.admin-stats-5 {
  grid-template-columns: repeat(5, 1fr);
}

.delivery-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  align-items: end;
  width: 100%;
  min-width: 0;
}

.delivery-form .email-group {
  grid-column: 1 / -1;
}

.delivery-form .form-group input,
.delivery-form .form-group select {
  width: 100%;
  max-width: 100%;
}

.smtp-test-form {
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.smtp-test-form .hint {
  font-size: 12px;
  color: #999;
}

.delivery-form .form-group.full {
  grid-column: 1 / -1;
}

.delivery-sources {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 18px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.delivery-source-col {
  min-width: 0;
  max-width: 100%;
}

.delivery-source-col .form-group {
  margin-bottom: 10px;
  min-width: 0;
}

.bonus-folder-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #999;
}

.delivery-source-col .file-picker-list {
  max-height: 280px;
}

.email-group {
  position: relative;
}

.clipboard-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #67c23a;
  animation: clipboardFade 2.2s ease forwards;
}

.clipboard-hint.hidden {
  display: none;
}

@keyframes clipboardFade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

.file-picker-panel {
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  min-width: 0;
  max-width: 100%;
}

.file-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff8f0 0%, #fff 100%);
  border-bottom: 1px solid #f0f0f0;
}

.file-picker-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 160px;
}

.file-picker-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  background: #FF8C00;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.file-picker-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.file-picker-sub {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.file-picker-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.file-picker-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #FF8C00;
  background: #fff;
  border: 1px solid #ffd699;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.file-picker-btn:hover {
  background: #fff8f0;
}

.file-picker-btn.muted {
  color: #888;
  border-color: #e8e8e8;
}

.file-picker-toggle-btns {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  overflow: hidden;
  background: #f5f5f5;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.file-picker-toggle-btns .file-picker-btn {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-width: 52px;
  padding: 7px 14px;
}

.file-picker-toggle-btns .file-picker-btn + .file-picker-btn {
  border-left: 1px solid #e0e0e0;
}

.file-picker-toggle-btns .file-picker-btn:hover {
  background: #ececec;
}

.file-picker-toggle-btns .file-picker-btn.is-active {
  background: #FF8C00;
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.file-picker-toggle-btns .file-picker-btn.muted.is-active {
  background: #606266;
  color: #fff;
}

.file-picker-toggle-btns .file-picker-btn.is-active:hover {
  filter: brightness(1.05);
}

.file-picker-toggle-btns.is-partial {
  border-color: #ffb84d;
  background: #fffaf5;
  box-shadow: inset 0 0 0 1px rgba(255, 140, 0, 0.12);
}

.file-picker-toggle-btns.is-partial [data-toggle=select].is-partial {
  background: #ffe4c2;
  color: #b85c00;
  font-weight: 700;
}

.file-picker-toggle-btns.is-partial [data-toggle=clear].is-partial {
  background: #e4e4e4;
  color: #555;
  font-weight: 700;
}

.file-picker-toggle-btns.is-partial .file-picker-btn.is-partial:hover {
  filter: brightness(0.97);
}

.file-picker-list {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  background: #fafbfc;
}

.file-picker-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  min-width: 0;
}

.file-picker-item:last-child {
  margin-bottom: 0;
}

.file-picker-item:hover {
  border-color: #ffd699;
}

.file-picker-item.is-selected {
  border-color: #FF8C00;
  background: #fffaf5;
  box-shadow: 0 2px 8px rgba(255, 140, 0, 0.08);
}

.file-picker-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #FF8C00;
  flex-shrink: 0;
  cursor: pointer;
}

.file-picker-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
  flex-shrink: 0;
  position: relative;
}

.file-picker-icon::after {
  content: "XLS";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #2e7d32;
  letter-spacing: 0.02em;
}

.file-picker-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-picker-name {
  display: block;
  font-weight: 600;
  color: #333;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker-size {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5f5f5;
  color: #666;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.file-picker-loading,
.file-picker-empty {
  padding: 28px 16px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

.file-picker-empty {
  color: #f56c6c;
}

.file-picker-group {
  margin-bottom: 8px;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.file-picker-group:last-child {
  margin-bottom: 0;
}

.file-picker-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff8f0 0%, #fff 100%);
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.file-picker-group-head:hover {
  background: #fffaf5;
}

.file-picker-group-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.file-picker-group-toggle {
  width: 8px;
  height: 8px;
  border-right: 2px solid #FF8C00;
  border-bottom: 2px solid #FF8C00;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-top: -2px;
}

.file-picker-group:not(.is-collapsed) .file-picker-group-toggle {
  transform: rotate(45deg);
  margin-top: 2px;
}

.file-picker-group-title {
  color: #FF8C00;
  flex-shrink: 0;
}

.file-picker-group-count {
  font-size: 11px;
  font-weight: 500;
  color: #999;
  white-space: nowrap;
}

.file-picker-group-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.file-picker-group-btn {
  padding: 5px 11px;
  font-size: 11px;
  min-height: 0;
}

.file-picker-group-body {
  padding: 6px 8px 8px;
  background: #fafbfc;
}

.file-picker-group.is-collapsed .file-picker-group-body {
  display: none;
}

.file-picker-group.is-collapsed .file-picker-group-head {
  border-bottom: none;
}

.btn-link {
  background: none;
  border: none;
  color: #FF8C00;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.btn-link.muted { color: #999; }
.btn-link:hover { text-decoration: underline; }

.delivery-form .form-group:last-of-type {
  grid-column: 1 / -1;
}

.delivery-form .btn-sm {
  grid-column: 1 / -1;
  justify-self: start;
}

.status-cell .hint {
  margin-top: 4px;
  max-width: 220px;
  word-break: break-all;
}

.btn-text-danger {
  background: none;
  border: none;
  color: #f56c6c;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.btn-text-danger:hover { text-decoration: underline; }

.inline-form { display: inline; }

.empty-row {
  text-align: center;
  color: #ccc;
  padding: 24px !important;
}

@media (max-width: 700px) {
  .form-page {
    margin: 20px auto;
    padding: 0 16px 40px;
  }

  .form-page h1 { font-size: 22px; }

  .form-card {
    padding: 20px 16px;
    border-radius: 10px;
  }

  .admin-wrap {
    padding: 16px 12px 40px;
  }

  .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .admin-header h1 {
    font-size: 20px;
    line-height: 1.3;
  }

  .admin-header .subtitle {
    font-size: 13px;
    line-height: 1.5;
  }

  .admin-header-actions {
    justify-content: flex-end;
  }

  .admin-gen-form { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: 1fr; }
  .admin-stats-5 { grid-template-columns: repeat(2, 1fr); }
  .admin-stats-5 .stat-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .stat-card { padding: 14px 12px; }
  .stat-val { font-size: 24px; }

  .smtp-test-form {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .delivery-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .delivery-sources {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .delivery-source-col .file-picker-list {
    max-height: none;
    padding: 6px;
  }

  .file-picker-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .file-picker-summary {
    align-items: flex-start;
    flex: none;
    width: 100%;
  }

  .file-picker-title {
    font-size: 14px;
    word-break: break-word;
  }

  .file-picker-sub {
    word-break: break-word;
  }

  .file-picker-actions {
    width: 100%;
    display: flex;
    justify-content: stretch;
    gap: 8px;
  }

  .file-picker-btn {
    flex: 1;
    min-height: 40px;
    padding: 8px 12px;
  }

  .file-picker-item {
    grid-template-columns: 22px 34px minmax(0, 1fr);
    gap: 8px 10px;
    padding: 12px;
    border-radius: 12px;
  }

  .file-picker-icon {
    width: 34px;
    height: 34px;
  }

  .file-picker-name {
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .file-picker-size {
    font-size: 10px;
    padding: 2px 7px;
  }

  .bonus-folder-hint {
    line-height: 1.45;
    word-break: break-word;
  }

  .delivery-form .form-group input,
  .delivery-form .form-group select {
    font-size: 16px;
  }

  .delivery-form .btn-sm {
    width: 100%;
    justify-self: stretch;
    min-height: 44px;
    padding: 12px 20px;
  }

  .table-wrap {
    margin: 0 -4px;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table-delivery {
    font-size: 12px;
    min-width: 0;
  }

  .admin-table-delivery th,
  .admin-table-delivery td {
    padding: 8px 8px;
  }

  /* 手机隐藏次要列：ID、标题、创建/发送时间 */
  .admin-table-delivery th:nth-child(1),
  .admin-table-delivery td:nth-child(1),
  .admin-table-delivery th:nth-child(4),
  .admin-table-delivery td:nth-child(4),
  .admin-table-delivery th:nth-child(7),
  .admin-table-delivery td:nth-child(7),
  .admin-table-delivery th:nth-child(8),
  .admin-table-delivery td:nth-child(8) {
    display: none;
  }

  .admin-table-delivery td:nth-child(2) {
    max-width: 120px;
    word-break: break-all;
  }

  .admin-table-delivery td:nth-child(3) {
    white-space: nowrap;
  }

  .status-cell .hint {
    max-width: none;
  }
}

@media (max-width: 400px) {
  .admin-stats-5 {
    grid-template-columns: 1fr 1fr;
  }

  .admin-stats-5 .stat-card:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .file-picker-icon {
    width: 32px;
    height: 32px;
  }

  .file-picker-badge {
    min-width: 32px;
    height: 32px;
    font-size: 14px;
  }

  /* 极窄屏再隐藏「文件/大小」列 */
  .admin-table-delivery th:nth-child(6),
  .admin-table-delivery td:nth-child(6) {
    display: none;
  }
}

/* ---- 报告页 ---- */
.report-wrap {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
}

.report-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 12px 20px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.report-toolbar button,
.report-toolbar a {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid #FF8C00;
  color: #FF8C00;
  background: #fff;
}

.report-toolbar button.primary,
.report-toolbar a.primary {
  background: #FF8C00;
  color: #fff;
}

/* 报告主体 */
.report-body { padding: 0; }

.report-header {
  background: linear-gradient(135deg, #FF8C00 0%, #FF6B00 100%);
  color: #fff;
  padding: 32px 28px 28px;
  text-align: center;
}

.report-header h1 { font-size: 22px; margin-bottom: 6px; }
.report-header .meta { font-size: 13px; opacity: .9; }

.score-banner {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.score-item { text-align: center; }
.score-item .val { font-size: 28px; font-weight: 700; }
.score-item .lbl { font-size: 12px; opacity: .85; margin-top: 2px; }

.section {
  padding: 24px 28px;
  border-bottom: 8px solid #f5f6f8;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.section-num {
  background: #FF8C00;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.section-title h2 { font-size: 17px; color: #333; }

.card {
  background: #fafafa;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.card p, .card li { font-size: 13px; color: #555; }
.card ul { padding-left: 18px; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-cell {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px 14px;
}

.info-cell .lbl { font-size: 12px; color: #999; }
.info-cell .val { font-size: 14px; font-weight: 600; margin-top: 4px; }

/* 风险卡片 */
.risk-cards { display: flex; flex-direction: column; gap: 10px; }

.risk-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #fafafa;
}

.risk-card.high { border-left: 4px solid #F56C6C; }
.risk-card.mid  { border-left: 4px solid #FF8C00; }
.risk-card.low  { border-left: 4px solid #67C23A; }

.risk-card .badge {
  font-size: 20px;
  font-weight: 700;
  min-width: 48px;
  text-align: center;
}

.risk-card.high .badge { color: #F56C6C; }
.risk-card.mid  .badge { color: #FF8C00; }
.risk-card.low  .badge { color: #67C23A; }

.risk-card .info h3 { font-size: 14px; margin-bottom: 4px; }
.risk-card .info p  { font-size: 12px; color: #888; }

/* 志愿列表（按院校合并） */
.school-vol-list { display: flex; flex-direction: column; gap: 16px; }

.school-vol-card {
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.school-vol-header {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
}

.school-vol-seq {
  width: 28px;
  height: 28px;
  background: #FF8C00;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.school-vol-name { font-size: 15px; font-weight: 600; color: #333; }
.school-vol-prob { font-size: 22px; font-weight: 700; color: #FF8C00; text-align: right; min-width: 56px; }
.school-vol-prob span { font-size: 12px; }

.vol-tags { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fff3e0;
  color: #FF8C00;
}

.tag.sm { font-size: 10px; padding: 1px 6px; margin-top: 4px; display: inline-block; }
.tag.chong { background: #fef0f0; color: #F56C6C; }
.tag.wen   { background: #fff3e0; color: #FF8C00; }
.tag.bao   { background: #f0f9eb; color: #67C23A; }

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

.major-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.major-table th {
  background: #fff8f0;
  color: #888;
  font-weight: 600;
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

.major-table td {
  padding: 10px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: top;
}

.major-table tr:last-child td { border-bottom: none; }

.major-table .col-major { text-align: left; min-width: 140px; }
.major-table .col-prob  { text-align: center; width: 52px; font-weight: 600; color: #FF8C00; }
.major-table .col-year  { text-align: center; min-width: 88px; }

.major-name { font-weight: 600; color: #333; font-size: 13px; }
.major-remark { font-size: 11px; color: #aaa; margin-top: 2px; line-height: 1.4; }

.yr-score { font-weight: 600; color: #333; }
.yr-rank  { color: #888; margin-top: 2px; font-size: 11px; }
.yr-plan  { color: #FF8C00; margin-top: 2px; font-size: 11px; }
.yr-empty { color: #ccc; }

/* 图表 */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-box {
  background: #fafafa;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.chart-box img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.chart-full { margin-bottom: 16px; }

/* 专家建议 */
.expert-panel { display: flex; flex-direction: column; gap: 14px; }

.expert-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.expert-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #f0f0f0;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.expert-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f5f5f5;
}

.expert-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.expert-pros .expert-icon { background: #f0f9eb; color: #67C23A; }
.expert-cons .expert-icon { background: #fef0f0; color: #F56C6C; }
.expert-watch .expert-icon { background: #ecf5ff; color: #409EFF; }

.expert-card-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin-bottom: 2px;
}

.expert-sub {
  font-size: 11px;
  color: #aaa;
}

.expert-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.expert-list li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  color: #555;
  line-height: 1.55;
}

.expert-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.expert-pros .expert-list li::before { background: #67C23A; }
.expert-cons .expert-list li::before { background: #F56C6C; }
.expert-watch .expert-list li::before { background: #409EFF; }

.expert-list li.empty { color: #bbb; }
.expert-list li.empty::before { background: #ddd; }

.expert-list-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}

.expert-pros { border-top: 3px solid #67C23A; }
.expert-cons { border-top: 3px solid #F56C6C; }
.expert-watch { border-top: 3px solid #409EFF; }

.report-footer {
  padding: 20px 28px 32px;
  text-align: center;
  font-size: 11px;
  color: #bbb;
  line-height: 1.8;
}

@media print {
  .report-toolbar { display: none; }
  body { background: #fff; }
}

/* ---- PDF / 图片导出（WeasyPrint 对 Grid/Flex 支持有限，用 table/float 布局） ---- */
.export-mode {
  background: #fff;
}

.export-mode .report-wrap {
  max-width: 100%;
  margin: 0;
}

.export-mode .report-header {
  padding: 20px 16px 18px;
}

.export-mode .score-banner {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  gap: 0;
  margin-top: 14px;
}

.export-mode .score-item {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
}

.export-mode .score-item .val {
  font-size: 22px;
}

.export-mode .section {
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  page-break-inside: auto;
}

.export-mode .section-title {
  margin-bottom: 10px;
}

.export-mode .info-grid {
  display: block;
  overflow: hidden;
}

.export-mode .info-cell {
  float: left;
  width: 49%;
  margin: 0 0 8px;
  box-sizing: border-box;
}

.export-mode .info-cell:nth-child(odd) {
  margin-right: 2%;
  clear: left;
}

.export-mode .card {
  margin-bottom: 8px;
}

.export-mode .risk-card {
  margin-bottom: 8px;
}

.export-mode .school-vol-card {
  margin-bottom: 10px;
  page-break-inside: avoid;
}

.export-mode .school-vol-header {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.export-mode .school-vol-seq,
.export-mode .school-vol-info,
.export-mode .school-vol-prob {
  display: table-cell;
  vertical-align: middle;
}

.export-mode .school-vol-info {
  width: auto;
  padding: 0 8px;
}

.export-mode .school-vol-prob {
  width: 56px;
  text-align: right;
}

.export-mode .chart-row {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 8px 0;
  margin-bottom: 8px;
}

.export-mode .chart-row .chart-box {
  display: table-cell;
  width: 50%;
  vertical-align: middle;
  min-height: 0;
  padding: 6px 8px;
}

.export-mode .chart-full {
  margin-bottom: 8px;
}

.export-mode .chart-full .chart-box {
  min-height: 0;
}

.export-mode .chart-box img {
  max-height: 220px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

.export-mode .expert-panel {
  gap: 0;
}

.export-mode .expert-row {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 10px 0;
  margin-bottom: 10px;
}

.export-mode .expert-row > .expert-card {
  display: table-cell;
  width: 50%;
  vertical-align: top;
  float: none;
  box-shadow: none;
}

.export-mode .expert-watch {
  display: block;
  width: 100%;
  clear: both;
  box-shadow: none;
}

.export-mode .expert-card {
  padding: 14px 16px;
  page-break-inside: avoid;
}

.export-mode .expert-card-head {
  display: block;
  overflow: hidden;
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.export-mode .expert-icon {
  float: left;
  margin-right: 10px;
}

.export-mode .expert-card-head > div {
  overflow: hidden;
}

.export-mode .expert-list {
  gap: 0;
}

.export-mode .expert-list li {
  margin-bottom: 8px;
  padding-left: 14px;
}

.export-mode .expert-list-cols {
  display: block;
  column-count: 2;
  column-gap: 20px;
}

.export-mode .expert-list-cols li {
  break-inside: avoid;
  page-break-inside: avoid;
}

.export-mode .report-footer {
  padding: 14px 16px 20px;
  clear: both;
}

@page {
  margin: 10mm;
  size: A4;
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .chart-row, .expert-row, .expert-list-cols, .info-grid { grid-template-columns: 1fr; }
}
