:root {
  --ink: #202124;
  --muted: #6b7280;
  --line: #e6e8ec;
  --surface: #ffffff;
  --band: #f6f7f9;
  --soft: #f9fafb;
  --accent: #c83f46;
  --accent-dark: #9f2f36;
  --green: #117865;
  --focus: #2563eb;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--band);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

h2 {
  margin: 0;
  font-size: 16px;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.layout {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.is-hidden {
  display: none !important;
}

.collab-panel {
  order: 1;
}

.filters {
  order: 2;
}

.bulk-panel {
  order: 3;
}

.table-wrap {
  order: 4;
}

.import-panel,
.ocr-merge-panel {
  order: 5;
}

.auto-title-panel,
.auto-cover-panel {
  order: 6;
}

.import-panel,
.ocr-merge-panel,
.auto-title-panel,
.auto-cover-panel,
.filters,
.bulk-panel,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.daily-import-view,
.dictionary-view,
.profile-scan-view {
  max-width: 1180px;
  margin: 0 auto;
}

.daily-import-head,
.daily-import-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.daily-import-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.daily-import-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.daily-import-section-title {
  display: grid;
  gap: 2px;
}

.daily-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.daily-import-ocr-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.daily-import-ocr-row span.is-success {
  color: var(--green);
  font-weight: 700;
}

.daily-import-ocr-row span.is-error {
  color: var(--accent-dark);
  font-weight: 700;
}

.daily-import-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.daily-import-wide {
  grid-column: 1 / -1;
}

.daily-import-form textarea,
#dailyImportInput {
  min-height: 128px;
}

.daily-import-form textarea[name="body_text"] {
  min-height: 220px;
}

.daily-import-status,
.daily-import-duplicate {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #374151;
  background: var(--soft);
  line-height: 1.6;
}

.daily-import-status.is-success {
  color: #0f766e;
  border-color: #99f6e4;
  background: #f0fdfa;
}

.daily-import-status.is-warning,
.daily-import-duplicate.is-warning {
  color: #92400e;
  border-color: #fed7aa;
  background: #fff7ed;
}

.daily-import-status.is-error,
.daily-import-duplicate.is-error {
  color: #9f2f36;
  border-color: #f2c9cc;
  background: #fff5f5;
}

.daily-import-limits p {
  max-width: 880px;
}

.recent-import-list {
  display: grid;
  gap: 10px;
}

.recent-import-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.recent-import-title {
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.recent-import-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.recent-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.recent-import-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  text-align: center;
}

.dictionary-manager {
  display: grid;
  gap: 18px;
}

.dictionary-block {
  display: grid;
  gap: 8px;
}

.dictionary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dictionary-head h3 {
  margin: 0;
  font-size: 14px;
}

.dictionary-rows {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
}

.dictionary-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(130px, 0.8fr) 72px minmax(260px, 1.5fr) minmax(130px, 0.8fr) 88px minmax(150px, 1fr) 64px;
  gap: 0;
  align-items: center;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.dictionary-row.account-row {
  grid-template-columns: minmax(180px, 1.1fr) minmax(130px, 0.8fr) 72px minmax(260px, 1.5fr) minmax(130px, 0.8fr) 88px minmax(150px, 1fr) 64px;
}

.dictionary-row.operator-row {
  grid-template-columns: minmax(220px, 1.4fr) 96px minmax(240px, 1fr) 72px;
}

.dictionary-row:first-child {
  border-top: 0;
}

.dictionary-row > span {
  min-width: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  background: var(--soft);
  border-right: 1px solid var(--line);
}

.dictionary-row > input,
.dictionary-row > select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 9px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 13px;
}

.dictionary-row > input:focus,
.dictionary-row > select:focus {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.dictionary-row > :last-child {
  border-right: 0;
}

.dictionary-row-head {
  border-top: 0;
}

.dictionary-remove {
  width: 100%;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.dictionary-remove:hover {
  color: var(--accent);
  background: #fff1f2;
}

.profile-scan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.profile-scan-wide {
  grid-column: span 4;
}

.profile-scan-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.profile-scan-toolbar label {
  width: 220px;
}

.profile-scan-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.profile-scan-results {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
}

.profile-scan-result-row {
  display: grid;
  grid-template-columns: 96px 150px 180px minmax(260px, 1fr) 96px minmax(180px, 0.8fr) 130px;
  min-width: 1180px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.profile-scan-result-row:first-child {
  border-top: 0;
}

.profile-scan-result-row > span {
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.profile-scan-result-row > span:last-child {
  border-right: 0;
}

.profile-scan-result-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: var(--soft);
}

.profile-scan-badge {
  justify-self: start;
  margin-left: 8px;
  padding: 4px 8px !important;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px !important;
  line-height: 1.2;
}

.profile-scan-badge.is-missing {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.profile-scan-badge.is-imported {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.profile-scan-badge.is-unknown {
  border-color: #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
}

.profile-scan-note-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px !important;
}

.profile-scan-title {
  display: grid;
  gap: 4px;
}

.profile-scan-title small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.profile-scan-result-row button {
  margin: 2px 0;
  width: 100%;
}

.import-panel,
.ocr-merge-panel,
.auto-title-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.auto-title-panel {
  border-left: 4px solid var(--accent);
}

.auto-cover-panel {
  border-left-color: var(--green);
}

.auto-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auto-title-summary {
  color: var(--green);
  font-weight: 600;
}

.import-panel form,
.actions,
.pagination,
.dialog-actions,
.section-meta,
.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary,
button.copy-button,
button.text-button {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

button.secondary:hover,
button.copy-button:hover,
button.text-button:hover {
  background: #f0f2f5;
}

button.copy-button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

button.text-button {
  min-height: auto;
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
}

button.text-button:hover {
  background: transparent;
  text-decoration: underline;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
  font-size: 22px;
  line-height: 1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

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

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px;
}

.filters .wide {
  grid-column: span 2;
}

.filter-actions {
  align-self: end;
}

.filters input,
.filters select,
.filters button {
  min-height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.bulk-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
}

.bulk-panel p {
  margin-top: 4px;
}

.bulk-details {
  min-width: min(100%, 720px);
}

.bulk-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bulk-details[open] summary {
  margin-bottom: 10px;
}

.bulk-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.bulk-category-label {
  min-width: 140px;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.table-wrap {
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

#resultCount,
#pageInfo,
#filterSummary {
  color: var(--muted);
}

.page-size-label {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.page-size-label select {
  width: 90px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 2350px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  word-break: normal;
  overflow-wrap: normal;
}

th {
  color: var(--muted);
  background: #fbfbfc;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

td {
  overflow: hidden;
}

.is-column-hidden {
  display: none !important;
}

tr:hover td {
  background: #fffafa;
}

.empty-row {
  padding: 44px 16px;
  color: var(--muted);
  text-align: center;
}

/* 列宽与横向冻结列：左侧固定到标题列，右侧固定操作列 */
.select-col {
  width: 52px;
  min-width: 52px;
  text-align: center;
}

.publish-col {
  width: 120px;
  min-width: 120px;
  white-space: nowrap;
}

.cover-col {
  width: 90px;
  min-width: 90px;
}

.title-col {
  width: 340px;
  min-width: 340px;
}

.id-col {
  width: 184px;
  min-width: 184px;
}

.disease-col {
  width: 120px;
  min-width: 120px;
}

.owner-col {
  width: 100px;
  min-width: 100px;
}

.part-col {
  width: 120px;
  min-width: 120px;
}

.status-col,
.category-col {
  width: 112px;
  min-width: 112px;
}

.expression-col {
  width: 220px;
  min-width: 220px;
}

.cover-text-col {
  width: 280px;
  min-width: 280px;
}

.cover-text-cell {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  max-height: 68px;
  overflow: hidden;
  color: #374151;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.match-col {
  width: 158px;
  min-width: 158px;
}

.level1-col {
  width: 136px;
  min-width: 136px;
}

.level2-col {
  width: 176px;
  min-width: 176px;
}

.tag-col {
  width: 124px;
  min-width: 124px;
}

.area-col {
  width: 92px;
  min-width: 92px;
}

.machine-col {
  width: 160px;
  min-width: 160px;
}

.account-col {
  width: 142px;
  min-width: 142px;
}

.operator-col {
  width: 96px;
  min-width: 96px;
}

.url-col {
  width: 92px;
  min-width: 92px;
}

.remark-col {
  width: 180px;
  min-width: 180px;
}

.action-col {
  width: 142px;
  min-width: 142px;
  position: sticky;
  right: 0;
  z-index: 5;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
}

th.action-col {
  z-index: 8;
  background: #fbfbfc;
}

.sticky-col {
  position: sticky;
  z-index: 6;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

th.sticky-col {
  z-index: 9;
  background: #fbfbfc;
}

.sticky-select {
  left: 0;
}

.sticky-date {
  left: 52px;
}

.sticky-cover {
  left: 172px;
}

.sticky-title {
  left: 262px;
  box-shadow: 2px 0 0 var(--line);
}

tr:hover td.sticky-col,
tr:hover td.action-col {
  background: #fffafa;
}

.select-col input,
.row-select-checkbox {
  width: 18px;
  min-height: 18px;
  cursor: pointer;
}

tr.row-selected td {
  background: #fff7f7;
}

.selection-summary {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px solid #f2c9cc;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #fff5f5;
  font-weight: 700;
}

.cover-cell {
  position: relative;
}

.cover-button {
  display: block;
  width: 76px;
  height: 76px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef0f3;
}

.cover,
.cover-empty {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  object-fit: cover;
  color: var(--muted);
  background: #eef0f3;
  font-size: 13px;
}

.cover-preview {
  position: fixed;
  z-index: 20;
  display: none;
  width: 260px;
  max-height: 360px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef0f3;
  box-shadow: var(--shadow);
  transform: translate(112px, -150px);
}

.cover-cell:hover .cover-preview {
  display: block;
}

.title-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  line-height: 1.55;
  font-weight: 700;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #374151;
  background: #f9fafb;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-promoted {
  color: #9f2f36;
  border-color: #f2c9cc;
  background: #fff5f5;
}

.badge-category {
  color: #1f4f8f;
  border-color: #c9dcff;
  background: #f3f7ff;
}

.id-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.id-short {
  overflow: hidden;
  color: #374151;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remark-cell {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.5;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.pagination {
  justify-content: flex-end;
  padding: 12px 16px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(32, 33, 36, 0.34);
}

.dialog-shell {
  background: #fff;
}

.detail-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(88vh, 920px);
  margin: auto 18px auto auto;
  inset: 0 0 0 auto;
}

.edit-dialog {
  width: min(840px, calc(100vw - 28px));
  max-height: min(90vh, 920px);
}

.image-dialog {
  width: min(720px, calc(100vw - 28px));
}

.column-settings-dialog {
  width: min(780px, calc(100vw - 28px));
  max-height: min(88vh, 860px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.detail-body {
  display: grid;
  gap: 16px;
  max-height: calc(88vh - 68px);
  overflow: auto;
  padding: 18px;
}

.detail-cover-wrap {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.detail-cover-button {
  width: min(340px, 100%);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef0f3;
}

.detail-cover {
  display: block;
  width: 100%;
  min-width: 260px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #eef0f3;
}

.detail-cover-empty {
  display: grid;
  place-items: center;
  width: min(340px, 100%);
  min-width: 260px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #eef0f3;
}

.detail-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.detail-id-row,
.detail-link-row,
.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.detail-id-value {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.field strong,
.field div {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.65;
}

.body-field {
  max-height: 360px;
  overflow: auto;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.edit-note-id {
  display: grid;
  gap: 4px;
  padding: 14px 18px 0;
}

.edit-note-id span {
  color: var(--muted);
  font-size: 12px;
}

.edit-note-id strong {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.edit-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-height: calc(90vh - 190px);
  overflow: auto;
  padding: 18px;
}

.edit-fields .wide {
  grid-column: 1 / -1;
}

.field-editor {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.edit-field-title {
  color: var(--muted);
  font-size: 12px;
}


.edit-fields label[data-field="body_text"] textarea {
  min-height: 260px;
}

.dialog-actions {
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.image-preview {
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-preview img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  background: #eef0f3;
}

.column-settings-body {
  display: grid;
  gap: 14px;
  max-height: calc(88vh - 150px);
  overflow: auto;
  padding: 16px 18px;
}

.column-settings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#columnSettingsCount {
  color: var(--muted);
  font-size: 13px;
}

.column-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.column-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.column-check {
  min-height: 34px;
  border-radius: 8px;
  background: #fff;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: none;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--green);
  box-shadow: var(--shadow);
}

#toast.error {
  background: var(--accent-dark);
}


.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge-expression {
  color: #5b21b6;
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.checkbox-grid.compact {
  max-width: 640px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #374151;
  background: #f9fafb;
  font-size: 12px;
  cursor: pointer;
}

.check-pill input {
  width: 14px;
  min-height: 14px;
  padding: 0;
}

.bulk-expression-box {
  display: grid;
  gap: 8px;
  max-width: 660px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfbfc;
}

.bulk-expression-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bulk-expression-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.expression-checkbox-grid {
  align-items: flex-start;
}

@media (max-width: 1100px) {
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters .wide {
    grid-column: span 2;
  }

  .import-panel,
  .auto-title-panel,
  .bulk-panel,
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .dictionary-rows {
    overflow-x: auto;
  }

  .dictionary-row {
    min-width: 1160px;
  }

  .dictionary-row.operator-row {
    min-width: 620px;
  }

  .profile-scan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-scan-wide {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .filters,
  .filters .wide,
  .edit-fields,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .filters .wide {
    grid-column: span 1;
  }

  .actions,
  .import-panel form,
  .auto-title-actions,
  .bulk-actions,
  .filter-actions,
  .profile-scan-toolbar,
  .section-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-scan-grid,
  .profile-scan-wide {
    grid-template-columns: 1fr;
    grid-column: span 1;
  }

  .profile-scan-toolbar label {
    width: 100%;
  }
}

.detail-section {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #f2c9cc;
  border-radius: 12px;
  background: #fffafa;
}

.detail-section h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 15px;
}

.inline-select[data-inline-field="cover_level_1_type"] {
  color: #7c2d12;
  border-color: #fed7aa;
  background-color: #fff7ed;
}

.inline-select[data-inline-field="cover_level_2_type"] {
  color: #065f46;
  border-color: #a7f3d0;
  background-color: #ecfdf5;
}

button.danger {
  color: #9f1239;
  border-color: #fecdd3;
  background: #fff1f2;
}

button.danger:hover {
  color: #fff;
  border-color: #be123c;
  background: #be123c;
}

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

.row-actions button {
  min-height: 30px;
  padding: 0 10px;
}

.inline-select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 28px 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #fff;
}

.inline-select:hover {
  border-color: var(--accent);
}

.inline-select[data-inline-field="promotion_status"] {
  color: #9f2f36;
  border-color: #f2c9cc;
  background-color: #fffafa;
}

.inline-select[data-inline-field="note_category"] {
  color: #1f4f8f;
  border-color: #c9dcff;
  background-color: #f7faff;
}


.delivery-dash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: #777;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  font-weight: 600;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: #888;
  font-size: 12px;
  line-height: 1.5;
}

/* 窗口底部悬浮横向滚动条：避免大量数据时必须滑到表格最底部 */
.table-scroll {
  padding-bottom: 18px;
}

table {
  min-width: 3360px;
}

.floating-x-scroll {
  position: fixed;
  left: 16px;
  bottom: 14px;
  z-index: 1000;
  display: none;
  height: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -6px 18px rgba(31, 35, 40, 0.16);
}

.floating-x-scroll.is-visible {
  display: block;
}

#floatingXSpacer {
  height: 1px;
}

.floating-x-scroll::-webkit-scrollbar {
  height: 14px;
}

.floating-x-scroll::-webkit-scrollbar-thumb {
  border: 3px solid rgba(255, 255, 255, 0.98);
  border-radius: 999px;
  background: #9ca3af;
}

.floating-x-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* 只保留窗口底部悬浮横向滚动条，隐藏表格容器原生底部横向滚动条 */
.table-scroll {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 0;
}

.table-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* V0.3 标题表达类型自动打标逻辑说明 */
.expression-logic-note {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f9fafb;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.55;
  word-break: break-word;
}

.expression-logic-note strong {
  color: #374151;
  font-weight: 700;
}

.expression-col .expression-logic-note {
  max-width: 260px;
}

/* V0.4 动态协作录入版补充样式 */
.collab-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 260px auto auto;
  gap: 14px;
  align-items: end;
  padding: 16px 18px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}
.collab-panel h2 { margin: 0 0 6px; }
.collab-panel p { margin: 0; color: #64748b; font-size: 13px; }
.server-status {
  align-self: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #0369a1;
  font-size: 13px;
  white-space: nowrap;
}
.server-status.is-error {
  background: #fff1f2;
  color: #be123c;
}
.inline-input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
}
.owner-col { width: 100px; min-width: 100px; }
.part-col { width: 120px; min-width: 120px; }
.review-col { width: 120px; min-width: 120px; }
.modified-col { width: 150px; min-width: 150px; }
.modified-cell { font-size: 12px; line-height: 1.4; color: #475569; }
.modified-cell small { color: #64748b; }
@media (max-width: 980px) {
  .collab-panel { grid-template-columns: 1fr; align-items: stretch; }
}

.layout[hidden],
.employee-actions[hidden] {
  display: none !important;
}
