:root {
  color-scheme: light;
  --canvas: #edf1f4;
  --panel: #ffffff;
  --panel-soft: #f7f9fb;
  --line: #d8dee6;
  --line-strong: #b9c4d0;
  --text: #18212b;
  --muted: #667384;
  --brand: #0d7868;
  --brand-dark: #075f53;
  --brand-soft: #eaf7f3;
  --blue: #245ad6;
  --blue-soft: #edf3ff;
  --orange: #b45309;
  --orange-soft: #fff5e8;
  --red: #c43737;
  --red-soft: #fff0f0;
  --shadow: 0 10px 28px rgba(24, 33, 43, 0.09);
  --font: "Inter", "MiSans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--canvas);
  color: var(--text);
  font: 14px/1.45 var(--font);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(36, 90, 214, 0.2);
  outline-offset: 1px;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex: 0 0 auto;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: #fff;
  border-right: 1px solid var(--line);
}

body.sidebar-collapsed .sidebar {
  display: none;
}

.brand {
  min-height: 74px;
  padding: 14px 16px;
  display: flex;
  gap: 11px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-copy {
  min-width: 0;
  display: grid;
}

.brand-copy strong {
  font-size: 16px;
}

.brand-copy span {
  color: var(--muted);
  font-size: 11px;
}

.station-select {
  margin: 12px;
  min-height: 54px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.station-select > svg {
  color: var(--brand);
}

.station-select > svg:last-child {
  color: var(--muted);
  width: 15px;
}

.station-select div {
  display: grid;
  min-width: 0;
}

.station-select span {
  color: var(--muted);
  font-size: 10px;
}

.station-select strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.nav-list {
  padding: 4px 10px;
  display: grid;
  gap: 4px;
  align-content: start;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 0 11px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #34404d;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover {
  background: #f3f6f8;
}

.nav-item.active {
  border-color: #b8ddd5;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.nav-item kbd {
  min-width: 19px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font: 10px/1.4 var(--mono);
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.printer-mini {
  min-width: 0;
  padding: 8px 7px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.printer-mini > div {
  min-width: 0;
  display: grid;
}

.printer-mini strong,
.printer-mini span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.printer-mini strong {
  font-size: 12px;
}

.printer-mini div span {
  color: var(--muted);
  font-size: 10px;
}

.prototype-note {
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #dfc79f;
  border-radius: 5px;
  background: var(--orange-soft);
  color: #8b4b0f;
  font-size: 11px;
  font-weight: 800;
}

.prototype-note svg {
  width: 15px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 74px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.page-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-heading > div {
  min-width: 0;
}

.breadcrumb {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 1px;
  font-size: 21px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
}

h3 {
  font-size: 14px;
}

.top-actions,
.inline-actions,
.result-actions,
.printer-strip-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.connection-button {
  min-height: 48px;
  padding: 6px 10px;
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.connection-button:hover {
  border-color: #99bdb5;
  background: #fbfefd;
}

.connection-copy {
  display: grid;
  text-align: left;
}

.connection-copy strong {
  font-size: 12px;
}

.connection-copy small {
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  background: #8c98a5;
  box-shadow: 0 0 0 3px rgba(140, 152, 165, 0.13);
}

.status-dot.connected {
  background: #15966f;
  box-shadow: 0 0 0 3px rgba(21, 150, 111, 0.13);
}

.status-dot.error {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(196, 55, 55, 0.13);
}

.icon-btn,
.tool-btn {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #394654;
}

.icon-btn:hover,
.tool-btn:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.mobile-menu {
  display: inline-grid;
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--red);
}

.avatar {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #243240;
  color: #fff;
  font-weight: 800;
}

.page {
  display: none;
  padding: 18px 24px 30px;
}

.page.active {
  display: block;
}

.printer-strip {
  min-height: 48px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.printer-strip-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.printer-strip-main > span:not(.status-dot):not(.separator) {
  color: var(--muted);
}

.printer-strip-main svg {
  width: 16px;
  color: var(--blue);
}

.printer-profile-control {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.printer-profile-control select {
  min-height: 32px;
  padding: 4px 28px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
}

.separator {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--line);
}

.text-btn {
  min-height: 32px;
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--blue);
  font-weight: 750;
}

.text-btn:hover {
  background: var(--blue-soft);
}

.text-btn svg {
  width: 15px;
}

.text-btn.danger {
  color: var(--red);
}

.text-btn.danger:hover {
  background: var(--red-soft);
}

.workbench-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 14px;
  align-items: start;
}

body.preview-collapsed .workbench-grid {
  grid-template-columns: minmax(0, 1fr);
}

body.preview-collapsed .preview-column {
  display: none;
}

.workflow-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: #fff;
}

.scan-section {
  order: 1;
}

.print-content-section {
  order: 2;
}

.sample-results-section {
  order: 3;
}

.queue-section {
  order: 4;
}

.scan-section,
.result-section,
.print-content-section,
.queue-section {
  padding: 18px;
}

.scan-section,
.result-section,
.print-content-section {
  border-bottom: 1px solid var(--line);
}

.section-heading {
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading.compact {
  margin-bottom: 11px;
  align-items: center;
}

.section-heading > div:first-child {
  min-width: 0;
}

.section-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.result-summary {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.sample-results-section.collapsed {
  padding-block: 12px;
  background: #f8fafb;
}

.sample-results-section.collapsed .section-heading {
  margin-bottom: 0;
}

.sample-results-section.collapsed .sample-results-body,
.sample-results-section.collapsed #refreshResultsBtn {
  display: none;
}

.sample-results-body {
  padding-top: 2px;
}

.sample-count-badge {
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.sample-disclosure-toggle svg {
  width: 15px;
  transition: transform 160ms ease;
}

.sample-disclosure-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: #243240;
  color: #fff;
}

.scan-input-wrap {
  min-height: 58px;
  padding: 6px 6px 6px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 2px solid #77b5a8;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 120, 104, 0.06);
}

.scan-input-wrap > svg {
  width: 23px;
  height: 23px;
  color: var(--brand);
}

.scan-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.scan-input-wrap input::placeholder {
  color: #9aa5b1;
  font-weight: 600;
}

.clear-scan {
  width: 32px;
  height: 32px;
  border: 0;
  color: var(--muted);
}

.primary-btn,
.secondary-btn,
.print-btn {
  min-height: 38px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  font-weight: 850;
}

.primary-btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.secondary-btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
}

.secondary-btn:hover {
  border-color: #8e9cac;
  background: var(--panel-soft);
}

.secondary-btn.danger {
  border-color: #e0aaaa;
  color: var(--red);
}

.full {
  width: 100%;
}

.scan-input-wrap .primary-btn {
  min-width: 96px;
  min-height: 44px;
}

.scan-meta {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.scan-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scan-meta svg {
  width: 14px;
}

.scan-meta-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.auto-print-control {
  color: var(--brand-dark);
}

.scan-ready {
  color: var(--brand-dark);
  font-weight: 800;
}

.query-status {
  color: var(--muted);
  font-weight: 750;
}

.query-status.good {
  color: var(--brand-dark);
}

.query-status.error {
  color: var(--red);
}

.query-status svg {
  animation: status-spin 0.9s linear infinite;
}

.query-status.good svg,
.query-status.error svg {
  animation: none;
}

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

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #45515e;
  font-size: 11px;
  font-weight: 750;
}

.check-control input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.result-toolbar {
  margin-bottom: 9px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 9px;
  align-items: center;
}

.sample-filter,
.label-filter {
  position: relative;
  display: block;
}

.sample-filter svg,
.label-filter svg {
  position: absolute;
  top: 50%;
  left: 9px;
  z-index: 1;
  width: 15px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.sample-filter input,
.label-filter input {
  padding-left: 31px;
}

.result-toolbar > span,
.page-size-control {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.page-size-control {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-size-control select {
  width: 66px;
  min-height: 34px;
  padding-block: 5px;
}

.result-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
}

.result-table-scroll {
  max-height: 292px;
  overflow: auto;
}

.result-table-scroll .result-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 12px;
}

.result-table th,
.result-table td {
  padding: 10px 11px;
  border-bottom: 1px solid #e4e8ed;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.result-table th {
  background: #f3f6f8;
  color: #526070;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.result-table tbody tr {
  cursor: pointer;
}

.result-table tbody tr:hover {
  background: #f7faf9;
}

.result-table tbody tr.selected {
  background: #edf8f5;
  box-shadow: inset 3px 0 0 var(--brand);
}

.result-table td strong,
.result-table td small {
  display: block;
}

.result-table td small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.select-col {
  width: 28px;
}

.row-radio {
  width: 16px;
  height: 16px;
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
}

.row-radio.active {
  border: 5px solid var(--brand);
}

.list-pagination {
  min-height: 42px;
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.list-pagination > div {
  display: flex;
  gap: 6px;
}

.list-pagination .icon-btn {
  width: 32px;
  height: 32px;
}

.state-badge {
  min-height: 24px;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f4f6f8;
  color: #5a6674;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.state-badge.ready {
  border-color: #a8d7ca;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.state-badge.warning {
  border-color: #e4c08e;
  background: var(--orange-soft);
  color: #8d4c0d;
}

.state-badge.error {
  border-color: #e6b0b0;
  background: var(--red-soft);
  color: var(--red);
}

.print-content-heading {
  align-items: flex-start;
}

.print-content-actions,
.manual-context-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.manual-context-bar {
  position: sticky;
  top: 84px;
  z-index: 8;
  min-height: 52px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 6px 16px rgba(24, 33, 43, 0.06);
}

.manual-context-bar > div:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.manual-context-bar > div:first-child > svg {
  width: 18px;
  color: var(--brand);
}

.manual-context-bar > div:first-child > div {
  display: grid;
}

.manual-context-bar > div:first-child span {
  color: var(--muted);
  font-size: 9px;
}

.manual-context-bar > div:first-child strong {
  font-size: 12px;
}

.apply-scope button {
  min-width: 98px;
}

.quick-print-btn {
  width: auto;
  min-width: 250px;
  min-height: 42px;
  margin: 0;
  padding-inline: 16px;
}

.active-purpose-bar {
  min-height: 48px;
  margin-top: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #a8d7ca;
  background: #f4fbf9;
}

.active-purpose-bar.manual {
  border-color: #e0c18e;
  background: var(--orange-soft);
}

.active-purpose-bar.empty {
  border-color: var(--line);
  background: var(--panel-soft);
}

.active-purpose-bar > div {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.active-purpose-bar svg {
  width: 16px;
  color: var(--brand);
}

.active-purpose-bar.manual svg {
  color: var(--orange);
}

.active-purpose-bar.empty svg {
  color: var(--muted);
}

.active-purpose-bar > div > span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.active-purpose-bar > div > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-purpose-note {
  margin-top: 8px;
  min-height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.manual-purpose-note svg {
  width: 14px;
  color: var(--orange);
}

.category-selector {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.category-selector .category-tile {
  min-width: 0;
  min-height: 58px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: #45515e;
  text-align: left;
}

.category-selector .category-tile > svg {
  width: 18px;
  color: var(--muted);
}

.category-copy {
  min-width: 0;
  display: grid;
}

.category-copy strong {
  font-size: 11px;
}

.category-copy small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-count {
  min-width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf1f4;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.category-selector .category-tile:hover {
  border-color: #82b8ad;
  background: #f8fcfb;
}

.category-selector .category-tile.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.category-selector .category-tile.active > svg,
.category-selector .category-tile.active .category-copy strong {
  color: var(--brand-dark);
}

.category-selector .category-tile.active .category-count {
  background: var(--brand);
  color: #fff;
}

.label-list-toolbar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.label-list-toolbar > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.label-list-toolbar > div span {
  color: var(--muted);
  font-size: 10px;
}

.label-filter {
  width: min(260px, 45%);
}

.label-option-list {
  min-height: 280px;
  max-height: 58vh;
  margin-top: 8px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.label-option-group + .label-option-group {
  border-top: 1px solid var(--line);
}

.label-option-group-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 32px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #f3f6f8;
}

.label-option-group-head strong {
  color: #44515f;
  font-size: 10px;
}

.label-option-group-head span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.label-option-group-grid {
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 7px;
  background: #f7f9fb;
}

.label-option {
  position: relative;
  min-width: 0;
  min-height: 72px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.label-option:hover {
  border-color: #9bc4bb;
  background: #f7faf9;
}

.label-option.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.label-option-marker {
  grid-column: 2;
  grid-row: 1;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
}

.label-option.selected .label-option-marker {
  border: 5px solid var(--brand);
}

.label-option > span:last-child {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  display: grid;
}

.label-option strong {
  overflow: hidden;
  display: -webkit-box;
  min-height: 32px;
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.label-option small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.label-list-empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
}

.manual-selection-footer {
  min-height: 39px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

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

.queue-row {
  min-height: 54px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.queue-index {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #e4eaf0;
  color: #4b5968;
  font-weight: 900;
}

.queue-main {
  min-width: 0;
  display: grid;
}

.queue-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-print-actions {
  margin-top: 12px;
  padding-top: 12px;
  display: grid;
  grid-template-columns: minmax(360px, 1fr);
  gap: 16px;
  align-items: end;
  border-top: 1px solid var(--line);
}

.primary-print-actions .print-options {
  padding: 0;
  grid-template-columns: repeat(2, minmax(140px, 220px));
  justify-content: start;
}

.primary-print-actions .print-btn {
  width: 100%;
  min-height: 52px;
  margin: 0;
}

.print-runtime-status {
  min-height: 54px;
  margin-top: 12px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: #f7f9fb;
}

.print-runtime-status > div {
  min-width: 0;
  display: grid;
}

.print-runtime-status strong {
  font-size: 11px;
}

.print-runtime-status div span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.print-runtime-status[data-state="printing"] {
  border-color: #bdcbea;
  background: var(--blue-soft);
}

.print-runtime-status[data-state="printed"],
.print-runtime-status[data-state="connected"] {
  border-color: #a8d7ca;
  background: var(--brand-soft);
}

.print-runtime-status[data-state="error"] {
  border-color: #e6b0b0;
  background: var(--red-soft);
}

.preview-column {
  position: sticky;
  top: 88px;
}

.preview-panel {
  border: 1px solid var(--line);
  background: #fff;
}

.preview-head,
.panel-title,
.modal-head,
.drawer-head {
  min-height: 54px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.label-stage {
  position: relative;
  min-height: 270px;
  padding: 42px 22px 26px 39px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background-color: #f5f7f9;
  background-image:
    linear-gradient(#e5eaef 1px, transparent 1px),
    linear-gradient(90deg, #e5eaef 1px, transparent 1px);
  background-size: 12px 12px;
}

.label-ruler {
  position: absolute;
  display: flex;
  color: #788493;
  font: 9px/1 var(--mono);
}

.ruler-x {
  left: 42px;
  right: 22px;
  top: 15px;
  justify-content: space-between;
}

.ruler-y {
  left: 13px;
  top: 46px;
  bottom: 28px;
  flex-direction: column;
  justify-content: space-between;
}

.tube-label {
  width: 326px;
  max-width: 100%;
  aspect-ratio: 50 / 18;
  padding: 8px;
  display: grid;
  grid-template-columns: 34% 66%;
  align-items: center;
  border: 1px solid #c4ccd5;
  background: #eef0ee;
  box-shadow: 0 5px 14px rgba(24, 33, 43, 0.12);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.tube-label.rotated {
  transform: rotate(180deg);
}

.circle-sticker,
.strip-sticker {
  background: #fff;
  color: #111;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.circle-sticker {
  width: 80px;
  height: 80px;
  padding: 11px 8px;
  display: grid;
  place-items: center;
  align-content: center;
  justify-self: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #e2e2e2;
  font-size: 7px;
  line-height: 1.2;
}

.circle-sticker strong {
  margin: 2px 0;
  font-size: 12px;
}

.strip-sticker {
  height: 88px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 72px 1fr;
  grid-template-rows: 28px repeat(4, 1fr);
  column-gap: 8px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px #e2e2e2;
  font-size: 7px;
  line-height: 1.1;
  overflow: hidden;
}

.strip-sticker > .pdf417 {
  grid-row: 1 / 6;
  align-self: stretch;
}

.strip-sticker > strong {
  font-size: 12px;
}

.strip-sticker > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strip-sticker .library-value {
  font-weight: 800;
}

.pdf417 {
  display: block;
  min-width: 64px;
  min-height: 28px;
  border: 2px solid #111;
  background:
    repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 4px, #111 4px 5px, #fff 5px 8px),
    repeating-linear-gradient(0deg, transparent 0 5px, #111 5px 7px, transparent 7px 11px);
  background-blend-mode: multiply;
}

.preview-info {
  min-height: 54px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.preview-info > div {
  min-width: 0;
  display: grid;
}

.preview-info span {
  color: var(--muted);
  font-size: 10px;
}

.preview-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.print-options {
  padding: 12px 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: #4b5866;
  font-size: 11px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 37px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
}

.stepper {
  height: 37px;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  overflow: hidden;
}

.stepper button {
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: #f3f6f8;
  color: #394654;
}

.stepper button:first-child {
  border-right: 1px solid var(--line);
}

.stepper button:last-child {
  border-left: 1px solid var(--line);
}

.stepper input {
  min-height: 35px;
  padding: 0;
  border: 0;
  border-radius: 0;
  text-align: center;
  font-weight: 900;
}

.stepper svg {
  width: 14px;
}

.print-btn {
  margin: 0 13px 8px;
  width: calc(100% - 26px);
  min-height: 48px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
}

.print-btn:hover {
  background: #1949bd;
}

.print-btn span {
  flex: 1;
  text-align: left;
}

.print-btn kbd {
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  font: 10px/1.3 var(--mono);
}

.preview-panel > .secondary-btn {
  margin: 0 13px 13px;
  width: calc(100% - 26px);
}

.page-intro {
  min-height: 74px;
  margin-bottom: 14px;
  padding: 3px 1px 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line-strong);
}

.page-intro h2 {
  font-size: 21px;
}

.page-intro p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.batch-layout,
.device-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}

.batch-main,
.batch-summary,
.device-list,
.device-settings,
.jobs-panel {
  border: 1px solid var(--line);
  background: #fff;
}

.batch-toolbar {
  min-height: 64px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.file-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-summary > svg {
  width: 28px;
  height: 28px;
  color: var(--brand);
}

.file-summary div {
  min-width: 0;
  display: grid;
}

.file-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary span {
  color: var(--muted);
  font-size: 11px;
}

.batch-summary {
  padding: 15px;
  display: grid;
  gap: 12px;
}

.batch-summary .print-btn {
  margin: 3px 0 0;
  width: 100%;
}

.summary-line {
  padding: 11px 0;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-line span {
  color: var(--muted);
}

.template-editor {
  min-height: 690px;
  display: grid;
  grid-template-columns: 224px minmax(560px, 1fr) 304px;
  border: 1px solid var(--line);
  background: #fff;
}

.template-list,
.property-panel {
  min-width: 0;
  background: #fff;
}

.template-list {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
}

.property-panel {
  max-height: 760px;
  overflow: auto;
  border-left: 1px solid var(--line);
}

#templateList {
  min-height: 0;
  overflow: auto;
}

.template-item {
  width: calc(100% - 16px);
  min-height: 66px;
  margin: 8px;
  padding: 8px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.template-item:hover {
  background: var(--panel-soft);
}

.template-item.active {
  border-color: #a7d4ca;
  background: var(--brand-soft);
}

.template-item > span:nth-child(2) {
  min-width: 0;
  display: grid;
}

.template-item strong,
.template-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-item small {
  margin-top: 2px;
  color: var(--muted);
}

.template-item > svg {
  width: 15px;
  color: var(--brand);
}

.template-thumb {
  width: 48px;
  height: 34px;
  display: block;
  border: 1px solid #acb6c1;
  background: #fff;
}

.template-thumb.tube {
  background:
    radial-gradient(circle at 19% 50%, #fff 0 8px, #cbd3db 9px 10px, transparent 11px),
    repeating-linear-gradient(90deg, transparent 0 23px, #26313d 24px 25px, transparent 26px 29px),
    #fff;
}

.template-thumb.rect {
  background:
    linear-gradient(#26313d, #26313d) 7px 7px / 24px 3px no-repeat,
    repeating-linear-gradient(90deg, #26313d 0 1px, transparent 1px 3px) 7px 15px / 31px 11px no-repeat,
    #fff;
}

.template-list-note {
  min-height: 49px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: #f8fafb;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.template-list-note svg {
  width: 15px;
  flex: 0 0 auto;
  color: var(--brand);
}

#templateSyncStatus[data-state="error"] {
  color: var(--red);
}

#templateSyncStatus[data-state="cache"],
#templateSyncStatus[data-state="saving"] {
  color: #976012;
}

.design-workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #e8edf1;
}

.design-toolbar {
  min-height: 52px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.tool-group,
.zoom-control {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tool-btn {
  width: 32px;
  height: 32px;
}

.tool-btn.active {
  border-color: #9dc9c0;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.zoom-control span {
  min-width: 48px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

.design-stage {
  position: relative;
  min-height: 540px;
  overflow: auto;
  background-color: #f1f3f5;
  background-image:
    linear-gradient(#dfe5ea 1px, transparent 1px),
    linear-gradient(90deg, #dfe5ea 1px, transparent 1px);
  background-size: 10px 10px;
}

.design-stage-center {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  padding: 38px;
  display: grid;
  place-items: center;
}

.design-ruler {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  background: #fff;
  border: 1px solid var(--line);
  color: #73808e;
  font: 8px/1 var(--mono);
}

.design-ruler.top {
  top: 7px;
  height: 20px;
}

.design-ruler.left {
  left: 7px;
  width: 20px;
}

.design-ruler span {
  position: absolute;
}

.design-ruler.top span {
  top: 5px;
  transform: translateX(-50%);
}

.design-ruler.left span {
  left: 4px;
  transform: translateY(-50%);
}

.design-label {
  position: relative;
  flex: 0 0 auto;
  border: 2px solid #2d3742;
  background: #fff;
  box-shadow: 0 9px 24px rgba(24, 33, 43, 0.15);
  overflow: visible;
  touch-action: none;
}

.design-object {
  position: absolute;
  z-index: 1;
  min-width: 2px;
  min-height: 2px;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  border: 1px dashed transparent;
  border-radius: 2px;
  background: transparent;
  color: #111827;
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: move;
  touch-action: none;
  user-select: none;
  appearance: none;
}

.design-object:hover {
  border-color: #7a9ad0;
  background: rgba(237, 243, 255, 0.42);
}

.design-object.selected {
  z-index: 2;
  border-color: var(--blue);
  background: rgba(237, 243, 255, 0.5);
  box-shadow: 0 0 0 1px #fff, 0 0 0 2px var(--blue);
}

.design-object.locked {
  cursor: default;
}

.design-object.not-printable {
  opacity: 0.46;
}

.design-object-text {
  overflow: visible;
}

.design-object-pdf417,
.design-object-code128,
.design-object-qrcode {
  overflow: hidden;
  background: #fff;
}

.design-object-circle,
.design-object-rectangle {
  border: var(--shape-stroke, 1px) solid #111827;
  background: rgba(255, 255, 255, 0.01);
}

.design-object-circle {
  border-radius: 50%;
}

.design-object-circle:hover,
.design-object-rectangle:hover {
  border-color: #111827;
  background: rgba(237, 243, 255, 0.18);
}

.design-object-circle.selected,
.design-object-rectangle.selected {
  border-color: #111827;
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  background: rgba(237, 243, 255, 0.18);
}

.design-object-circle.not-printable,
.design-object-rectangle.not-printable {
  border-style: dashed;
  opacity: 0.58;
}

.design-barcode-canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  pointer-events: none;
}

.design-resize-handle {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 9px;
  height: 9px;
  border: 1px solid #fff;
  border-radius: 1px;
  background: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
  cursor: nwse-resize;
}

.design-status {
  min-height: 34px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 10px;
}

.design-status span,
.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.design-status svg,
.status-toggle svg {
  width: 13px;
}

.status-toggle {
  min-height: 26px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.status-toggle.active {
  border-color: #9dc9c0;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.wysiwyg-badge {
  color: var(--brand-dark);
  font-weight: 850;
}

.property-empty {
  min-height: 210px;
  padding: 28px 18px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.property-empty svg {
  width: 32px;
  height: 32px;
  color: #8794a2;
}

.property-empty span {
  font-size: 11px;
}

.page-property {
  padding: 13px;
  display: grid;
  gap: 11px;
  border-bottom: 1px solid var(--line);
}

.page-property-head {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.page-property-head span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 850;
}

.page-property-head svg {
  width: 15px;
  color: var(--brand);
}

.page-property-head small {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f9fa;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
}

.size-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.size-presets button {
  min-height: 30px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
}

.size-presets button.active {
  border-color: #9dc9c0;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.property-form {
  padding: 13px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.property-form label {
  min-width: 0;
}

.property-subgroup {
  display: grid;
  gap: 10px;
}

.property-subgroup small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.property-type-row {
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.property-type-row span {
  padding: 3px 7px;
  border: 1px solid #a8d7ca;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 10px;
  font-weight: 850;
}

.property-type-row small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font: 9px/1 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.switch-row {
  min-height: 38px;
  padding: 7px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch-row input {
  width: 36px;
  min-height: 20px;
  accent-color: var(--brand);
}

.layer-panel {
  min-height: 180px;
}

.layer-panel-head {
  min-height: 39px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
  font-size: 11px;
}

.layer-panel-head span {
  color: var(--muted);
  font: 10px/1 var(--mono);
}

.layer-list {
  display: grid;
}

.layer-row {
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.layer-row.active {
  box-shadow: inset 3px 0 0 var(--blue);
  background: var(--blue-soft);
}

.layer-select {
  min-width: 0;
  height: 41px;
  padding: 6px 9px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.layer-select span {
  color: var(--muted);
  font-size: 9px;
}

.layer-select strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-actions {
  padding-right: 5px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-btn.tiny {
  width: 24px;
  height: 24px;
  border-color: transparent;
  background: transparent;
}

.icon-btn.tiny svg {
  width: 13px;
}

.device-list {
  display: grid;
}

.device-row {
  min-height: 88px;
  padding: 12px 13px;
  display: grid;
  grid-template-columns: auto minmax(160px, 1.4fr) minmax(140px, 1fr) 90px auto auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.device-row:last-child {
  border-bottom: 0;
}

.device-row.active {
  box-shadow: inset 3px 0 0 var(--brand);
  background: #fbfefd;
}

.device-icon {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f6f8;
  color: #43515f;
}

.device-icon .status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
}

.device-name,
.device-media {
  min-width: 0;
  display: grid;
}

.device-name span,
.device-media span {
  color: var(--muted);
  font-size: 11px;
}

.device-capabilities {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.device-capabilities span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f5f7f9;
  color: #4e5b68;
  font-size: 9px;
  font-weight: 850;
}

.device-settings {
  position: sticky;
  top: 88px;
}

.settings-group {
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.settings-group h3 {
  margin-bottom: 10px;
}

.device-command-grid {
  padding: 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.jobs-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.jobs-metrics > div {
  min-height: 88px;
  padding: 16px;
  display: grid;
  border-right: 1px solid var(--line);
}

.jobs-metrics > div:last-child {
  border-right: 0;
}

.jobs-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.jobs-metrics strong {
  margin-top: 4px;
  font-size: 27px;
}

.red {
  color: var(--red);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(24, 33, 43, 0.42);
}

.modal {
  width: min(520px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(24, 33, 43, 0.25);
}

.catalog-modal {
  width: min(980px, 100%);
  max-height: calc(100vh - 40px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.catalog-manager-body {
  min-height: 0;
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto auto minmax(180px, 1fr);
  gap: 12px;
  overflow: hidden;
}

.catalog-source-bar {
  min-height: 52px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  border: 1px solid #a8d7ca;
  background: var(--brand-soft);
}

.catalog-source-bar > svg {
  color: var(--brand);
}

.catalog-source-bar > div {
  min-width: 0;
  display: grid;
}

.catalog-source-bar span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-add-form {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(170px, 1fr) minmax(190px, 1.2fr) minmax(150px, 0.9fr);
  gap: 9px;
  align-items: end;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.catalog-add-form label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.catalog-add-form label > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.catalog-add-form input,
.catalog-add-form select {
  width: 100%;
  min-height: 40px;
}

.catalog-add-form .primary-btn {
  min-height: 42px;
  grid-column: 1 / -1;
  justify-self: end;
}

.catalog-manager-toolbar {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.catalog-manager-toolbar > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.catalog-manager-toolbar > div span {
  color: var(--muted);
  font-size: 10px;
}

.catalog-manager-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.catalog-manager-row {
  min-height: 54px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.catalog-manager-row:last-child {
  border-bottom: 0;
}

.catalog-manager-row:hover {
  background: #f8fafb;
}

.catalog-manager-row > div {
  min-width: 0;
  display: grid;
}

.catalog-manager-row > div span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-category {
  min-height: 26px;
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b8ddd5;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.icon-btn.danger {
  color: var(--red);
}

.icon-btn.danger:hover {
  border-color: #e6b0b0;
  background: var(--red-soft);
}

.connection-options {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.connection-option {
  min-height: 72px;
  padding: 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.connection-option:hover {
  border-color: #93c0b7;
  background: #f8fcfb;
}

.connection-option > svg:first-child {
  width: 25px;
  height: 25px;
  color: var(--brand);
}

.connection-option span {
  display: grid;
}

.connection-option small {
  margin-top: 3px;
  color: var(--muted);
}

.diagnostic-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(430px, 100%);
  height: 100vh;
  border-left: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: -18px 0 50px rgba(24, 33, 43, 0.18);
  transform: translateX(105%);
  transition: transform 0.22s ease;
}

.diagnostic-drawer.open {
  transform: translateX(0);
}

.drawer-body {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.diagnostic-alert {
  padding: 10px;
  display: flex;
  gap: 8px;
  border: 1px solid #e0c18e;
  border-radius: 5px;
  background: var(--orange-soft);
  color: #87501c;
  font-size: 11px;
  font-weight: 750;
}

.drawer-body textarea {
  min-height: 210px;
  resize: vertical;
  font: 11px/1.5 var(--mono);
}

.diagnostic-log {
  min-height: 140px;
  max-height: 240px;
  padding: 10px;
  overflow: auto;
  border: 1px solid #263343;
  border-radius: 5px;
  background: #111a26;
  color: #d9f1e8;
  font: 10px/1.55 var(--mono);
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 110;
  min-width: 310px;
  max-width: calc(100vw - 44px);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid #9bcfc2;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast > svg {
  width: 22px;
  height: 22px;
  color: var(--brand);
}

.toast div {
  display: grid;
}

.toast span {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .brand {
    justify-content: center;
    padding-inline: 8px;
  }

  .brand-copy,
  .station-select div,
  .station-select > svg:last-child,
  .nav-item span,
  .nav-item kbd,
  .printer-mini div,
  .printer-mini .icon-btn,
  .prototype-note span {
    display: none;
  }

  .station-select {
    margin: 10px;
    padding: 0;
    grid-template-columns: 1fr;
    place-items: center;
  }

  .nav-item {
    grid-template-columns: 1fr;
    place-items: center;
    padding: 0;
  }

  .printer-mini {
    grid-template-columns: 1fr;
    place-items: center;
  }

  .workbench-grid {
    grid-template-columns: minmax(0, 1fr) 350px;
  }

  .template-editor {
    grid-template-columns: 200px minmax(460px, 1fr) 280px;
  }

  .device-row {
    grid-template-columns: auto minmax(150px, 1fr) 100px auto auto;
  }

  .device-capabilities {
    display: none;
  }
}

@media (max-width: 920px) {
  .workbench-grid,
  .batch-layout,
  .device-layout {
    grid-template-columns: 1fr;
  }

  .preview-column,
  .device-settings {
    position: static;
  }

  .preview-column {
    order: -1;
  }

  .template-editor {
    grid-template-columns: 174px minmax(0, 1fr);
  }

  .property-panel {
    grid-column: 1 / -1;
    max-height: none;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 62px;
  }

  body.sidebar-collapsed {
    padding-bottom: 0;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    height: 62px;
    display: block;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .brand,
  .station-select,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    height: 100%;
    padding: 4px 3px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
  }

  .nav-item {
    min-height: 52px;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    gap: 1px;
    padding: 3px;
    font-size: 9px;
  }

  .nav-item span {
    display: block;
  }

  .nav-item svg {
    width: 19px;
    height: 19px;
  }

  .topbar {
    height: 62px;
    padding: 0 12px;
  }

  .breadcrumb,
  .connection-copy small,
  .top-actions > .icon-btn,
  .avatar {
    display: none;
  }

  .top-actions > .icon-btn.preview-toggle {
    display: inline-grid;
  }

  h1 {
    font-size: 17px;
  }

  .connection-button {
    min-height: 38px;
    padding: 5px 8px;
  }

  .connection-copy strong {
    font-size: 10px;
  }

  .page {
    padding: 10px;
  }

  .printer-strip {
    align-items: flex-start;
  }

  .printer-strip-actions {
    display: none;
  }

  .separator,
  .printer-strip-main > span:not(.status-dot) {
    display: none;
  }

  .workbench-grid {
    margin-top: 10px;
    gap: 10px;
  }

  .preview-column {
    order: 0;
  }

  .scan-section,
  .result-section,
  .print-content-section,
  .queue-section {
    padding: 13px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
  }

  .scan-input-wrap {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .scan-input-wrap input {
    font-size: 16px;
  }

  .clear-scan {
    display: none;
  }

  .scan-input-wrap .primary-btn {
    min-width: 44px;
    padding: 0;
  }

  .scan-input-wrap .primary-btn span {
    display: none;
  }

  .scan-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .scan-meta-actions {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }

  .result-actions .check-control {
    display: none;
  }

  .result-table {
    min-width: 690px;
  }

  .result-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sample-filter {
    grid-column: 1 / -1;
  }

  .manual-context-bar {
    top: 68px;
    align-items: stretch;
    flex-direction: column;
  }

  .print-content-actions,
  .manual-context-actions {
    width: 100%;
    justify-content: space-between;
  }

  .apply-scope {
    width: 100%;
  }

  .apply-scope button {
    min-width: 0;
    flex: 1;
  }

  .quick-print-btn {
    width: 100%;
    min-width: 0;
    order: -1;
  }

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

  .category-selector .category-tile {
    min-height: 60px;
  }

  .label-list-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  .label-filter {
    width: 100%;
  }

  .label-option-list {
    max-height: 340px;
  }

  .label-option-group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .queue-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }

  .queue-row > .state-badge {
    display: none;
  }

  .primary-print-actions {
    grid-template-columns: 1fr;
  }

  .primary-print-actions .print-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .print-runtime-status {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .print-runtime-status .text-btn {
    grid-column: 2;
    justify-self: start;
  }

  .catalog-manager-body {
    overflow: auto;
  }

  .catalog-add-form {
    grid-template-columns: 1fr;
  }

  .catalog-add-form .primary-btn {
    grid-column: auto;
    width: 100%;
  }

  .catalog-manager-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .catalog-manager-toolbar .label-filter {
    width: 100%;
  }

  .catalog-manager-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .catalog-manager-row .catalog-category {
    grid-column: 1;
    justify-self: start;
  }

  .catalog-manager-row > div {
    grid-column: 1;
  }

  .catalog-manager-row > .icon-btn {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .label-stage {
    min-height: 240px;
  }

  .tube-label {
    width: 300px;
  }

  .page-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .page-intro .inline-actions,
  .page-intro > .primary-btn {
    width: 100%;
  }

  .page-intro .inline-actions > * {
    flex: 1;
  }

  .batch-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .template-editor {
    min-height: 630px;
    display: block;
    overflow: visible;
  }

  .template-list {
    max-height: 190px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #templateList {
    display: flex;
    overflow-x: auto;
  }

  .template-item {
    width: 210px;
    flex: 0 0 210px;
  }

  .design-stage {
    min-height: 360px;
  }

  .design-toolbar {
    overflow-x: auto;
  }

  .design-status {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .property-panel {
    display: block;
  }

  .device-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .device-media,
  .device-row > .state-badge {
    display: none;
  }

  .device-row > .secondary-btn {
    padding-inline: 9px;
  }

  .jobs-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .jobs-metrics > div:nth-child(2) {
    border-right: 0;
  }

  .jobs-metrics > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .toast {
    right: 12px;
    bottom: 74px;
    left: 12px;
    min-width: 0;
    max-width: none;
  }
}
