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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f6fa;
  color: #2c2c2a;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 680px; margin: 0 auto; padding: 16px; padding-bottom: 48px; }
.container-wide { max-width: 960px; margin: 0 auto; padding: 16px; padding-bottom: 48px; }

header { text-align: center; padding: 32px 0 24px; }
header h1 { font-size: 22px; font-weight: 600; color: #1a1a1a; }
.subtitle { font-size: 14px; color: #888; margin-top: 6px; }

.card { background: #fff; border-radius: 12px; padding: 24px 20px; margin-bottom: 12px; border: 1px solid #eee; }
.card-title { font-size: 16px; font-weight: 600; color: #1a1a1a; margin-bottom: 16px; }

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.label { display: block; font-size: 14px; font-weight: 500; color: #333; margin-bottom: 6px; }
.required { color: #e24b4a; }
.hint { font-size: 12px; color: #999; margin-top: 4px; }

.text-input, select.text-input, textarea.text-input {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 14px; color: #333; transition: border-color 0.2s; background: #fff; font-family: inherit;
}
.text-input:focus { outline: none; border-color: #378add; box-shadow: 0 0 0 3px rgba(55,138,221,0.1); }
textarea.text-input { resize: vertical; min-height: 72px; }

.btn {
  padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: #378add; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #185fa5; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }
.btn-success { background: #1d9e75; color: #fff; }
.btn-success:hover { background: #0f6e56; }
.btn-danger { background: #fff; color: #e24b4a; border: 1px solid #f09595; }
.btn-danger:hover { background: #fcebeb; }
.btn-warning { background: #fff; color: #854f0b; border: 1px solid #fac775; }
.btn-warning:hover { background: #faeeda; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 14px; font-size: 15px; justify-content: center; }
.btn-group { display: flex; gap: 8px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-created { background: #f1efe8; color: #5f5e5a; }
.badge-in_progress { background: #e6f1fb; color: #185fa5; }
.badge-submitted { background: #e1f5ee; color: #0f6e56; }
.badge-reviewing { background: #eeedfe; color: #534ab7; }
.badge-reviewed { background: #faeeda; color: #854f0b; }
.badge-needs_supplement { background: #faece7; color: #993c1d; }
.badge-supplement_submitted { background: #e6f1fb; color: #185fa5; }
.badge-completed { background: #eaf3de; color: #3b6d11; }

.badge-pass { background: #e1f5ee; color: #0f6e56; }
.badge-warning { background: #faeeda; color: #854f0b; }
.badge-fail { background: #fcebeb; color: #a32d2d; }
.badge-missing { background: #f1efe8; color: #888780; }
.badge-pending { background: #eeedfe; color: #534ab7; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; border-bottom: 2px solid #eee; color: #888; font-weight: 500; font-size: 12px; }
td { padding: 12px; border-bottom: 1px solid #f0f0f0; color: #333; vertical-align: middle; }
tr:hover td { background: #fafafa; }

.upload-area {
  border: 2px dashed #ddd; border-radius: 12px; padding: 28px 16px; text-align: center;
  cursor: pointer; transition: all 0.2s; color: #888;
}
.upload-area:hover, .upload-area.dragover { border-color: #378add; background: #f0f7ff; color: #378add; }
.upload-area .upload-text { font-size: 14px; margin-bottom: 4px; }
.upload-area .upload-link { color: #378add; font-weight: 500; }
.upload-area .upload-sub { font-size: 12px; color: #aaa; }

.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #eee;
  border-radius: 8px; font-size: 13px; transition: all 0.2s;
}
.doc-item.uploaded { background: #e1f5ee; border-color: #5dcaa5; }
.doc-item.missing { background: #fff; }

.doc-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #ccc; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; font-size: 12px;
}
.doc-item.uploaded .doc-check { background: #1d9e75; border-color: #1d9e75; color: #fff; }
.doc-label { flex: 1; color: #444; }
.doc-item.uploaded .doc-label { color: #085041; }
.doc-hint { font-size: 11px; color: #aaa; margin-top: 2px; }
.doc-status { font-size: 12px; color: #999; }
.doc-item.uploaded .doc-status { color: #0f6e56; }
.doc-actions { display: flex; gap: 6px; align-items: center; }

.file-preview {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid #eee;
  border-radius: 8px; font-size: 13px; margin-top: 6px;
}
.file-preview .file-icon {
  width: 32px; height: 32px; border-radius: 6px; background: #e6f1fb; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; font-size: 10px; font-weight: 600; color: #185fa5;
}
.file-preview .file-info { flex: 1; min-width: 0; }
.file-preview .file-name { color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview .file-meta { font-size: 11px; color: #999; }
.file-preview .file-remove { background: none; border: none; color: #ccc; cursor: pointer; padding: 4px 8px; font-size: 18px; border-radius: 4px; }
.file-preview .file-remove:hover { color: #e24b4a; background: #fcebeb; }

/* Supplement upload zone */
.supp-upload-zone {
  margin-top: 10px; padding: 20px 16px; border: 2px dashed #d0d5dd; border-radius: 8px;
  text-align: center; cursor: pointer; transition: all 0.2s; background: #fafbfc;
}
.supp-upload-zone:hover { border-color: #4a90d9; background: #f0f6ff; }
.supp-upload-zone .supp-upload-icon { font-size: 28px; color: #bbb; line-height: 1; margin-bottom: 6px; }
.supp-upload-zone .supp-upload-hint { font-size: 14px; color: #666; font-weight: 500; }
.supp-upload-zone .supp-upload-sub { font-size: 11px; color: #bbb; margin-top: 4px; }
.supp-upload-zone .supp-file-info {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px;
}
.supp-upload-zone .supp-file-icon { font-size: 20px; }
.supp-upload-zone .supp-file-name { font-size: 13px; color: #333; font-weight: 500; max-width: 200px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.supp-upload-zone .supp-file-size { font-size: 11px; color: #999; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center;
  justify-content: center; z-index: 1000; padding: 20px;
}
.modal-content {
  background: #fff; border-radius: 16px; padding: 32px 24px; max-width: 420px; width: 100%;
}
.modal-content h2 { font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.modal-message { font-size: 14px; color: #666; margin-bottom: 4px; }
.modal-hint { font-size: 13px; color: #999; margin-bottom: 20px; }
.modal-link-box {
  display: flex; gap: 8px; margin: 12px 0 20px; padding: 12px; background: #f5f6fa; border-radius: 8px;
}
.modal-link-box input { flex: 1; border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px; font-size: 13px; color: #333; }

.review-section { margin-bottom: 24px; }
.review-section-title { font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid #f0f0f0; }

.review-table th { font-size: 12px; color: #888; }
.review-table td { font-size: 13px; }

.cfg-tab {
  padding: 8px 20px; border: none; background: transparent; font-size: 14px; cursor: pointer;
  border-bottom: 2px solid transparent; color: #888; margin-bottom: -2px;
}
.cfg-tab.active { color: #4f46e5; border-bottom-color: #4f46e5; font-weight: 600; }
.cfg-tab:hover { color: #4f46e5; }

.opt-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f5f6fa;
  border-radius: 6px; margin-bottom: 4px; font-size: 14px;
}
.opt-item .opt-label { flex: 1; }
.opt-item .opt-tag {
  font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #e0e7ff; color: #4f46e5;
}
.opt-item .opt-tag.builtin { background: #f0f0f0; color: #888; }

.pool-panel {
  flex: 1; border: 1px solid #e8e8e8; border-radius: 8px; padding: 8px;
  max-height: 280px; overflow-y: auto; min-height: 120px;
}
.pool-panel-title { font-size: 12px; color: #888; font-weight: 600; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid #f0f0f0; }
.pool-item {
  display: flex; align-items: flex-start; gap: 4px; padding: 6px 8px; margin-bottom: 3px;
  border-radius: 6px; font-size: 13px; cursor: default; transition: background 0.15s;
}
.pool-item:hover { background: #f5f6fa; }
.pool-item .pool-item-label { flex: 1; line-height: 1.4; }
.pool-item .pool-item-hint { font-size: 11px; color: #aaa; margin-top: 2px; }
.pool-item .pool-btn {
  flex-shrink: 0; width: 24px; height: 24px; border: none; border-radius: 4px;
  cursor: pointer; font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.pool-item .pool-btn.add { background: #e0f2e9; color: #1d9e75; }
.pool-item .pool-btn.add:hover { background: #1d9e75; color: #fff; }
.pool-item .pool-btn.remove { background: #fce8e8; color: #e24b4a; }
.pool-item .pool-btn.remove:hover { background: #e24b4a; color: #fff; }
.pool-item.selected { background: #f0f7ff; border-left: 3px solid #4f46e5; padding-left: 5px; }
.pool-item.dragging { opacity: 0.4; }
.pool-item.drag-over { border-top: 2px solid #4f46e5; }
.pool-item .required-toggle {
  font-size: 11px; padding: 1px 6px; border-radius: 4px; cursor: pointer; border: 1px solid #ddd;
  background: #fff; color: #888; white-space: nowrap;
}
.pool-item .required-toggle.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }

.pool-manage-item {
  border: 1px solid #e8e8e8; border-radius: 8px; padding: 10px; margin-bottom: 8px; background: #fff;
}
.pool-manage-item .pmi-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pool-manage-item .pmi-label { flex: 1; font-size: 14px; font-weight: 500; }
.pool-manage-item .pmi-id { font-size: 12px; color: #aaa; }
.pool-manage-item .pmi-tag { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #f0f0f0; color: #888; }
.pool-manage-item .pmi-tag.custom { background: #e0f2e9; color: #1d9e75; }
.pool-manage-item .pmi-hint { font-size: 12px; color: #666; margin: 2px 0; }
.pool-manage-item .pmi-review { font-size: 12px; color: #999; margin: 2px 0; padding: 4px 8px; background: #fffbe6; border-radius: 4px; }
.pool-manage-item .pmi-actions { display: flex; gap: 6px; margin-top: 6px; }
.pool-manage-item.editing { border-color: #4f46e5; border-width: 2px; background: #fafaff; }
.pool-manage-item.editing .pmi-header { gap: 6px; }

.summary-bar {
  display: flex; gap: 12px; padding: 16px; background: #f5f6fa; border-radius: 10px; margin-bottom: 20px;
}
.summary-item { flex: 1; text-align: center; }
.summary-num { font-size: 24px; font-weight: 600; }
.summary-num.pass { color: #1d9e75; }
.summary-num.warning { color: #ef9f27; }
.summary-num.fail { color: #e24b4a; }
.summary-num.missing { color: #888780; }
.summary-label { font-size: 12px; color: #888; margin-top: 2px; }

.empty-state { text-align: center; padding: 48px 20px; color: #999; font-size: 14px; }

.link-cell { font-family: monospace; font-size: 12px; color: #378add; }
.copy-btn { background: none; border: 1px solid #ddd; border-radius: 4px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: #666; }
.copy-btn:hover { border-color: #378add; color: #378add; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1a1a1a; color: #fff;
  padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 2000; opacity: 0; transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

footer { text-align: center; padding: 24px 0; font-size: 12px; color: #bbb; }

@media (max-width: 640px) {
  .container-wide { padding: 8px; }
  .form-row { flex-direction: column; gap: 0; }
  table { font-size: 12px; }
  th, td { padding: 8px 6px; }
  .hide-mobile { display: none; }
  .summary-bar { flex-wrap: wrap; }
  .summary-item { min-width: 45%; }
}

/* User Bar */
.user-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: #fff; border-radius: 10px; margin-bottom: 12px;
  border: 1px solid #eee;
}
.user-info { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.role-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500;
}
.role-badge.super { background: #e0f2e9; color: #1d9e75; }
.role-badge.admin { background: #e6f1fb; color: #185fa5; }
.user-actions { display: flex; gap: 6px; }

/* Log Table */
.log-table th { font-size: 12px; color: #888; }
.log-table td { font-size: 12px; padding: 8px 10px; }
