body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f7f9fc;
  margin: 0;
  padding: 30px 15px;
  color: #1e293b;
}

.container {
  max-width: 950px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.card {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

/* 登录框 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.login-card h2 {
  margin-top: 0;
  color: #0f172a;
}

.login-card p {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 25px;
}

.login-card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 20px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-sizing: border-box;
}

#login-msg {
  margin-top: 15px;
  font-size: 13px;
  color: #ef4444;
}

/* 头部布局 */
.header-with-logout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.header-with-logout h2 {
  margin: 0;
  font-size: 20px;
  color: #0f172a;
}

.logout-btn {
  padding: 6px 12px !important;
  font-size: 12px !important;
  border-color: #f87171 !important;
  color: #f87171 !important;
  border-radius: 6px;
  background: transparent;
}

.logout-btn:hover {
  background: #fef2f2 !important;
}

/* 表单元素 */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 13px;
  color: #475569;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 14px;
  transition: 0.2s;
  background: #fff;
}

input:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
}

.icon-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  transition: 0.2s;
  white-space: nowrap;
}

.icon-btn:hover {
  background: #e2e8f0;
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

button {
  font-family: inherit;
}

.btn-primary,
.btn-danger,
.btn-outline {
  flex: 1;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  text-align: center;
}

.btn-primary {
  background-color: #3b82f6;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 1px solid #3b82f6;
  color: #3b82f6;
  padding: 8px 15px;
  flex: none;
  font-size: 13px;
  border-radius: 8px;
}

.btn-outline:hover {
  background: #eff6ff;
}

#result-msg {
  margin-top: 15px;
  padding: 12px;
  border-radius: 8px;
  display: none;
  font-size: 13px;
  line-height: 1.5;
}

.msg-success {
  background-color: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.msg-error {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.msg-info {
  background-color: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* 顶部简洁复选框 */
.checkbox-group {
  display: flex;
  gap: 20px;
  background: #f8fafc;
  padding: 12px 15px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.simple-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  margin: 0;
}

.simple-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

/* 🚨 修复核心：限定 Notion 风格 Tag 样式仅作用于包含 .tag 的纯展示元素 */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-right: 6px;
  margin-bottom: 4px;
}

.tag.tag-gpt {
  background-color: #ffedd5;
  color: #c2410c;
}

.tag.tag-style {
  background-color: #dcfce7;
  color: #15803d;
}

.tag.tag-cp {
  background-color: #e0e7ff;
  color: #4338ca;
}

.tag.tag-none {
  background-color: #f1f5f9;
  color: #94a3b8;
}

/* 表格区域 */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.table-header h3 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
}

.table-responsive {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
  background: white;
}

th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #475569;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  vertical-align: middle;
}

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

tr:hover {
  background-color: #f8fafc;
}

.id-cell {
  font-family: ui-monospace, monospace;
  color: #0ea5e9;
  font-weight: 500;
}

/* 表格内状态切换 */
.view-mode {
  display: block;
}

.edit-mode {
  display: none;
}

tr.editing .view-mode {
  display: none;
}

tr.editing .edit-mode {
  display: flex;
  align-items: center;
}

tr.editing {
  background-color: #fffbeb !important;
}

/* 表格内的输入框 */
.cell-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  box-sizing: border-box;
}

.cell-input:focus {
  border-color: #3b82f6;
  outline: none;
}

/* 🚨 修复核心：确保编辑模式下的 Label 容器没有自己的背景色 */
.inline-tag-editor {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-label {
  display: inline-block;
  background: transparent !important;
  margin: 0;
}

.tag-label input[type="checkbox"] {
  display: none;
}

.tag-label span {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  opacity: 0.5;
  filter: grayscale(1);
  background-color: #f1f5f9;
  color: #64748b;
}

.tag-label.tag-gpt input:checked+span {
  opacity: 1;
  filter: grayscale(0);
  background-color: #ffedd5;
  color: #c2410c;
  border-color: #fdba74;
}

.tag-label.tag-style input:checked+span {
  opacity: 1;
  filter: grayscale(0);
  background-color: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.tag-label.tag-cp input:checked+span {
  opacity: 1;
  filter: grayscale(0);
  background-color: #e0e7ff;
  color: #4338ca;
  border-color: #a5b4fc;
}

/* 表格操作按钮 */
.action-btns {
  display: flex;
  gap: 6px;
}

.action-btns button {
  padding: 6px 10px;
  font-size: 12px;
  flex: none;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

.btn-edit {
  background: #f1f5f9;
  color: #475569;
}

.btn-edit:hover {
  background: #e2e8f0;
}

.btn-del {
  background: transparent;
  color: #ef4444;
}

.btn-del:hover {
  background: #fef2f2;
}

.btn-save {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.btn-save:hover {
  background: #bbf7d0;
}

.btn-cancel {
  background: transparent;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.btn-cancel:hover {
  background: #f1f5f9;
}

.load-more-container {
  text-align: center;
  margin-top: 25px;
}

#load-more-btn {
  background: #f1f5f9;
  color: #475569;
  border: none;
  padding: 10px 25px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

#load-more-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}