/* 标签编辑器专用样式 */
.label-editor-root {
  height: calc(100vh - 4rem);
  min-height: 560px;
}

.label-mobile-toolbar {
  display: none;
}

.label-panel-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.35rem 0.5rem;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
  font-size: 0.7rem;
}

.label-left-panel,
.label-right-panel {
  transition: width 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.label-editor-root.left-collapsed .label-left-panel {
  width: 44px !important;
  padding-left: 5px;
  padding-right: 5px;
  overflow: hidden;
}

.label-editor-root.left-collapsed .label-left-panel > :not(.label-panel-collapse) {
  display: none !important;
}

.label-editor-root.right-collapsed .label-right-panel {
  width: 44px !important;
}

.label-editor-root.right-collapsed .label-right-panel > :not(.label-panel-collapse) {
  display: none !important;
}

@media (min-width: 768px) {
  .label-editor-root {
    height: calc(100vh - 5rem);
  }
}

.label-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  background: #fff;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.label-toolbar-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}

.label-editor-topbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
}

.label-topbar-main,
.label-topbar-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.label-topbar-main {
  justify-content: space-between;
}

.label-topbar-tools {
  padding-top: 0.5rem;
  border-top: 1px solid #f1f5f9;
}

.label-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.label-document-group {
  min-width: 0;
}

.label-template-group {
  margin-right: auto;
}

.label-view-group {
  margin-left: auto;
}

.label-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 36px;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  color: #fff;
  background: #2563eb;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.label-primary-action:hover {
  background: #1d4ed8;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.28);
}

.label-danger-action:hover {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.label-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  color: #64748b;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  width: 100%;
}

.label-tool-btn:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.label-tool-btn i {
  font-size: 1.25rem;
}

.label-tool-popover-wrap {
  position: relative;
}

.label-tool-popover {
  position: fixed;
  z-index: 1000;
  min-width: 168px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.label-tool-popover.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.label-tool-popover button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 8px 6px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: #fff;
  color: #475569;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.label-tool-popover button:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.label-tool-popover button i {
  font-size: 18px;
}

.label-icon-popover {
  width: 300px;
  max-height: 420px;
  overflow: hidden;
  flex-direction: column;
  padding: 0;
}

.label-icon-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem 0.5rem 0.35rem;
  border-bottom: 1px solid #e2e8f0;
  max-height: none;
  overflow-y: visible;
}

.label-icon-tab {
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid transparent;
  white-space: nowrap;
}

.label-icon-tab.active {
  color: #2563eb;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.label-icon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.5rem;
  overflow-y: auto;
  max-height: 340px;
}

.label-icon-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.2rem;
  border-radius: 0.5rem;
  min-height: 56px;
}

.label-icon-grid button span {
  font-size: 0.6rem;
  line-height: 1.1;
  text-align: center;
  color: #64748b;
}

.label-icon-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 1rem 0;
}

.label-stage-wrap {
  background-color: #e2e8f0;
  background-image:
    linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
    linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.label-stage {
  position: relative;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  background: #fff;
  touch-action: none;
  cursor: default;
}

.label-stage canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
}

.label-ruler-h,
.label-ruler-v {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 9px;
  color: #94a3b8;
  pointer-events: none;
  overflow: hidden;
  flex-shrink: 0;
}

.label-ruler-corner {
  width: 24px;
  height: 24px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.label-workspace {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.label-workspace-top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.label-workspace-body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.label-canvas-area {
  position: absolute;
  inset: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.label-ruler-h canvas,
.label-ruler-v canvas {
  display: block;
}

.label-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
}

.label-modal-backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

/* 关闭态：必须完全脱离点击命中，避免挡住导航栏和工具栏 */
.label-modal-backdrop.label-modal-closed,
.label-modal-backdrop.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.label-modal-backdrop.is-open {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.label-tool-popover.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#label-empty-hint,
#label-empty-hint * {
  pointer-events: none !important;
}

/* 标签编辑页：导航栏始终在最上层（高于默认 z-50 模态层） */
body.label-editor-page #navbar {
  z-index: 200;
}

body.label-editor-page .label-modal-backdrop.is-open {
  z-index: 150;
}

body.label-editor-page .label-tool-popover:not(.hidden) {
  z-index: 160;
}

.label-prop-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.label-prop-field input,
.label-prop-field select,
.label-prop-field textarea {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.label-prop-field input:focus,
.label-prop-field select:focus,
.label-prop-field textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

@media (max-width: 1023px) {
  .label-editor-root {
    height: calc(100dvh - 4rem);
    min-height: 0;
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
  }

  .label-editor-panels {
    position: relative;
    flex-direction: row;
  }

  .label-left-panel {
    display: none !important;
  }

  .label-stage-wrap {
    width: 100%;
    height: 100%;
  }

  .label-right-panel {
    position: fixed;
    z-index: 120;
    left: 0;
    right: 0;
    bottom: calc(58px + env(safe-area-inset-bottom));
    width: 100% !important;
    height: min(68vh, 620px);
    max-height: none;
    border: 1px solid #e2e8f0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.2);
    transform: translateY(calc(100% + 70px));
    pointer-events: none;
  }

  .label-right-panel.mobile-open {
    transform: translateY(0);
    pointer-events: auto;
  }

  .label-right-panel .label-panel-collapse {
    display: none;
  }

  .label-canvas-area {
    padding: 1rem;
    align-items: center;
    justify-content: center;
    overscroll-behavior: contain;
  }

  .label-mobile-toolbar {
    position: fixed;
    z-index: 130;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 4px 8px env(safe-area-inset-bottom);
    border-top: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
  }

  .label-mobile-toolbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 44px;
    min-height: 48px;
    color: #475569;
    font-size: 11px;
    border-radius: 8px;
  }

  .label-mobile-toolbar button:active {
    color: #2563eb;
    background: #eff6ff;
  }

  body.label-editor-page {
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
  }

  body.label-editor-page .label-editor-root > header.label-editor-topbar {
    max-height: none;
    overflow: hidden;
    padding: 0.4rem 0.5rem;
  }

  .label-topbar-main,
  .label-topbar-tools {
    width: 100%;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  .label-topbar-main {
    justify-content: flex-start;
  }

  .label-template-group {
    margin-right: 0;
  }

  .label-print-group {
    margin-left: auto;
  }

  .label-view-group {
    margin-left: 0;
  }

  .label-topbar-main .label-toolbar-btn,
  .label-topbar-tools .label-toolbar-btn,
  .label-primary-action {
    min-height: 34px;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
}

@media (max-width: 639px) {
  .label-canvas-area {
    padding: 0.5rem;
  }

  #label-name-input {
    max-width: 128px;
  }

  #template-save-status {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .label-toolbar-btn,
  .label-tool-btn,
  .label-stage {
    transition: none;
  }
}

/* ── 选框（框选多选） ── */
.label-marquee {
  position: absolute;
  border: 1.5px dashed #2563EB;
  background: rgba(37, 99, 235, 0.06);
  pointer-events: none;
  z-index: 10;
}

/* ── 对齐工具条 ── */
.label-align-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.08);
  max-width: calc(100% - 24px);
}
.label-align-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.label-align-bar button:hover {
  background: #eff6ff;
  color: #2563EB;
}
.label-align-bar button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.label-align-bar button:disabled:hover {
  color: #475569;
  background: transparent;
}
.label-align-bar .align-ref,
.label-align-bar .align-gap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}
.label-align-bar .align-ref select,
.label-align-bar .align-gap input {
  height: 26px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: #334155;
  font-size: 11px;
}
.label-align-bar .align-ref select {
  width: 72px;
  padding: 0 4px;
}
.label-align-bar .align-gap input {
  width: 48px;
  padding: 0 4px;
}
.label-align-bar .align-gap em {
  font-style: normal;
}
.label-align-bar .sep {
  width: 1px;
  height: 18px;
  background: #e2e8f0;
  margin: 0 2px;
}

/* ── 右键菜单 ── */
#label-context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 160px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.14);
  padding: 4px;
  animation: ctxFadeIn 0.1s ease;
}
@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
#label-context-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #334155;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
#label-context-menu button:hover {
  background: #eff6ff;
  color: #2563EB;
}
#label-context-menu button.danger:hover {
  background: #fef2f2;
  color: #dc2626;
}
#label-context-menu .ctx-sep {
  height: 1px;
  background: #f1f5f9;
  margin: 3px 0;
}

.label-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.label-table-toolbar .label-toolbar-btn {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
}

.label-icon-popover.label-tool-popover:not(.hidden) {
  display: flex !important;
  flex-direction: column;
  grid-template-columns: none;
  width: 300px;
  max-height: 420px;
  padding: 0;
  overflow: hidden;
}

.label-icon-tabs {
  flex-shrink: 0;
}

.label-icon-grid {
  flex: 1;
  min-height: 180px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.5rem;
  overflow-y: auto;
  max-height: none;
}

.label-icon-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.15rem;
  padding: 0.35rem 0.2rem;
  border-radius: 0.5rem;
  min-height: 72px;
  cursor: pointer;
  pointer-events: auto;
}

.label-icon-preview {
  display: block;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.label-icon-tab {
  cursor: pointer;
  pointer-events: auto;
}

.label-industry-tabs .label-industry-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.label-industry-tabs .label-industry-tab.active {
  color: #2563eb;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.label-template-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.label-template-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

.label-template-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.label-template-card-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
}

.label-template-card-size {
  font-size: 10px;
  color: #94a3b8;
}

.label-template-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.label-template-card-desc {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.4;
  min-height: 2.8em;
  margin-bottom: 12px;
}

.label-template-card-btn {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  transition: all 0.15s ease;
}

.label-template-card-btn:hover {
  background: #2563eb;
  color: #fff;
}

.label-my-template-row {
  margin-bottom: 2px;
}

.label-data-drop {
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.label-field-map-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.label-field-map-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.label-field-map-row select {
  flex: 1;
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
}

.label-field-token {
  flex: 0 0 auto;
  max-width: 110px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-data-preview {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.label-data-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.label-data-preview th,
.label-data-preview td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  text-align: left;
  white-space: nowrap;
}

.label-data-preview th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
}

.label-cell-inline-editor {
  position: fixed;
  z-index: 50;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: 2px solid #2563eb;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
  overflow: hidden;
}

.label-cell-inline-editor.hidden {
  display: none;
}

.label-cell-inline-editor textarea {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 2px 4px;
  margin: 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #000;
  font-family: inherit;
  line-height: 1.25;
  box-sizing: border-box;
}

/* 模板管理弹窗样式 */
.template-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
}

.template-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.template-card-preview {
  background: #f8fafc;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border-bottom: 1px solid #f1f5f9;
}

.template-card-preview canvas {
  max-width: 100%;
  max-height: 100px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.template-card-info {
  padding: 12px;
}

.template-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card-meta {
  font-size: 12px;
  color: #64748b;
}

.template-card-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
}

.template-btn {
  flex: 1;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.template-btn-load {
  background: #3b82f6;
  color: #fff;
}

.template-btn-load:hover {
  background: #2563eb;
}

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

.template-btn-rename:hover {
  background: #e2e8f0;
}

.template-btn-delete {
  background: #fef2f2;
  color: #dc2626;
}

.template-btn-delete:hover {
  background: #fee2e2;
}

/* ── 右侧属性/图层切换 ── */
.label-right-tabs {
  background: #f8fafc;
}
.label-right-tab {
  flex: 1;
  padding: 0.65rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.label-right-tab:hover {
  color: #2563eb;
}
.label-right-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: #fff;
}

/* ── 图层面板 ── */
.label-layer-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.label-layer-item:hover {
  background: #f8fafc;
}
.label-layer-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.label-layer-item.hidden-item {
  opacity: 0.55;
}
.label-layer-item .layer-name {
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.label-layer-item .layer-type {
  font-size: 0.625rem;
  color: #94a3b8;
}
.label-layer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.35rem;
  font-size: 0.6875rem;
  color: #94a3b8;
  border: none;
  background: transparent;
  cursor: pointer;
}
.label-layer-btn:hover {
  background: #e2e8f0;
  color: #475569;
}
.label-layer-btn.on {
  color: #2563eb;
}

#print-validate-panel.validate-errors {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}
#print-validate-panel.validate-warnings {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}
#print-validate-panel .validate-line {
  display: flex;
  gap: 0.35rem;
  align-items: flex-start;
  line-height: 1.4;
}
#print-validate-panel .validate-line i {
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.label-print-preview {
  display: grid;
  gap: 0.5rem;
}

.label-print-preview img {
  display: block;
  max-width: 100%;
  max-height: 210px;
  margin: 0 auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  image-rendering: auto;
}

.label-print-progress-bar {
  height: 0.4rem;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.label-print-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
  transition: width 0.2s ease;
}

#label-print-modal.is-executing [data-close-modal] {
  display: none;
}

/* ── 商为云印多端入口（小程序 / PC） ── */
.label-ends-wrap {
  position: relative;
  display: inline-flex;
}

.label-ends-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(92vw, 360px);
  padding: 14px 16px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  text-align: left;
}

.label-ends-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.label-ends-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.label-ends-sub {
  margin-top: 2px;
  font-size: 0.72rem;
  color: #64748b;
}

.label-ends-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: #94a3b8;
}

.label-ends-close:hover {
  background: #f1f5f9;
  color: #475569;
}

.label-ends-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.label-ends-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  background: #fcfdff;
}

.label-ends-item.is-current {
  border-color: #dbeafe;
  background: #f5f9ff;
}

.label-ends-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.95rem;
}

.label-ends-mobile-icon {
  font-size: 1.35rem;
}

.label-ends-body {
  min-width: 0;
}

.label-ends-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
}

.label-ends-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: #e0edff;
  color: #2563eb;
  font-size: 0.65rem;
  font-weight: 600;
}

.label-ends-desc {
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: #64748b;
}

.label-ends-qr,
.label-ends-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
}

.label-ends-qr-img {
  width: 104px;
  height: 104px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.label-ends-qr-tip {
  font-size: 0.68rem;
  line-height: 1.5;
  color: #94a3b8;
}

.label-ends-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}

.label-ends-download:hover {
  background: #1d4ed8;
}

.label-ends-pending {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
}

.label-ends-foot {
  margin-top: 10px;
  font-size: 0.68rem;
  color: #94a3b8;
}

.label-ends-foot a {
  color: #2563eb;
}

@media (max-width: 640px) {
  /* mobile: toolbar is a horizontal scroll container; absolute panel gets clipped -> fixed bottom sheet */
  .label-ends-panel {
    position: fixed;
    top: auto;
    left: 50%;
    right: auto;
    bottom: 12px;
    transform: translateX(-50%);
    width: min(94vw, 360px);
    max-height: 72vh;
    overflow-y: auto;
    z-index: 220;
    box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.22);
  }
}
