/* The debug page of the print server: light and dark, from a phone to a wide screen. */

:root {
  color-scheme: light dark;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --muted: #6b7484;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eaf1ff;
  --accent-ring: rgba(37, 99, 235, 0.22);
  --good: #0f8a43;
  --good-soft: #e5f6ec;
  --busy: #2563eb;
  --busy-soft: #eaf1ff;
  --warning: #a95a06;
  --warning-soft: #fff2db;
  --bad: #d22f22;
  --bad-soft: #fdebe9;
  --neutral: #5f6878;
  --neutral-soft: #eef0f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-raised: 0 4px 14px rgba(16, 24, 40, 0.12);
  --radius: 14px;

  --segment-on: #ffffff;
  --stage-bg: #e9ecf1;
  --stage-dot: rgba(16, 24, 40, 0.09);
  --paper: #ffffff;
  --liner: #efe7d4;
  --liner-edge: #d8ccb0;
  --label-edge: #b9bfc9;
  --ink: #1a1a1a;
  --printable: #2563eb;
  --placement: #db2777;
  --outside: #d22f22;

  --printer-base: #22262d;
  --printer-edge: #4b525d;
  --printer-lid-front: #4a515c;
  --printer-lid-middle: #393f48;
  --printer-lid-back: #2b3037;
  --printer-panel: #1b1e23;
  --printer-button: #3b414b;
  --printer-well: #121418;
  --metal-light: #e2e5ea;
  --metal-dark: #8b929c;
  --roll-edge: #cfc6b2;
  --roll-light: #fbf8f1;
  --shadow-drawing: rgba(16, 24, 40, 0.38);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13;
    --surface: #161920;
    --surface-2: #1c2028;
    --border: #262b34;
    --border-strong: #353b46;
    --text: #e8eaee;
    --text-2: #b4bac5;
    --muted: #8a93a3;
    --accent: #4f8cff;
    --accent-hover: #6b9fff;
    --accent-soft: #172440;
    --accent-ring: rgba(79, 140, 255, 0.3);
    --good: #4ade80;
    --good-soft: #13291d;
    --busy: #6ea2ff;
    --busy-soft: #172440;
    --warning: #fbbf24;
    --warning-soft: #2e2410;
    --bad: #f87171;
    --bad-soft: #351817;
    --neutral: #a3abb8;
    --neutral-soft: #22262e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-raised: 0 6px 18px rgba(0, 0, 0, 0.5);

    --segment-on: #2b313b;
    --stage-bg: #11141a;
    --stage-dot: rgba(255, 255, 255, 0.06);
    --paper: #f4f3ef;
    --liner: #d9cfb8;
    --liner-edge: #b5a888;
    --label-edge: #8d939d;
    --printable: #6ea2ff;

    --printer-base: #2a2f37;
    --printer-edge: #5a626e;
    --printer-lid-front: #586170;
    --printer-lid-middle: #444b56;
    --printer-lid-back: #353b44;
    --printer-panel: #1f2329;
    --printer-button: #48505c;
    --printer-well: #0b0d10;
    --shadow-drawing: rgba(0, 0, 0, 0.7);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* header */

.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 34px;
  height: 34px;
  flex: none;
}

.logo-label {
  fill: var(--paper);
  stroke: var(--label-edge);
  stroke-width: 1.2;
}

.logo-lines {
  fill: var(--text);
}

.logo-printer {
  fill: var(--accent);
}

.logo-slot {
  fill: rgba(0, 0, 0, 0.45);
}

.header-names {
  min-width: 0;
  flex: 1;
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-server {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

/* banner */

.banner {
  max-width: 1360px;
  margin: 14px auto 0;
  padding: 10px 12px 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  border: 1px solid;
  width: calc(100% - 40px);
}

.banner[data-tone="bad"] {
  background: var(--bad-soft);
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
  color: var(--bad);
}

.banner[data-tone="warning"] {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  color: var(--warning);
}

.banner-text {
  flex: 1;
  font-weight: 600;
}

/* layout */

.page-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

.page-column,
.page-server {
  display: contents;
}

.card-config { order: 1; }
.card-source { order: 2; }
.card-stage { order: 3; }
.card-print { order: 4; }
.card-emulator { order: 5; }
.card-printed { order: 6; }
.card-status { order: 7; }
.card-jobs { order: 8; }
.card-log { order: 9; }

@media (min-width: 1080px) {
  .page-main {
    grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
    grid-template-areas:
      "controls printer"
      "server server";
    align-items: start;
  }

  .page-column {
    display: grid;
    gap: 16px;
    align-content: start;
  }

  .page-controls {
    grid-area: controls;
  }

  .page-printer {
    grid-area: printer;
  }

  .page-server {
    grid-area: server;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr);
    align-items: start;
  }
}

/* cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 0;
}

.card-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.005em;
}

.card-step {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.card-body {
  padding: 14px 18px 18px;
}

.placeholder {
  color: var(--muted);
  font-size: 13px;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
}

.hint:empty {
  display: none;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2px 0;
}

/* forms */

.form {
  display: grid;
  gap: 14px;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  align-items: start;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.spacer {
  flex: 1;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.field-control {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.field-control:has([aria-invalid="true"]) {
  border-color: var(--bad);
}

.field-control:has([aria-invalid="true"]):focus-within {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent);
}

.field-control input,
.field-control select {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.select-control {
  position: relative;
  padding-right: 30px;
}

.select-control select {
  appearance: none;
  cursor: pointer;
}

.select-control::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 14px;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.select-control select option {
  background: var(--surface);
  color: var(--text);
}

.field-unit {
  color: var(--muted);
  font-size: 13px;
}

.field-hint {
  color: var(--bad);
  font-size: 12px;
}

.field-hint:empty {
  display: none;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: 12.5px/1.55 var(--mono);
  outline: 0;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* segmented choice */

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.segment {
  flex: 1;
  min-height: 30px;
  padding: 4px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}

.segment:hover:not(:disabled) {
  color: var(--text);
}

.segment[aria-checked="true"] {
  background: var(--segment-on);
  color: var(--text);
  box-shadow: var(--shadow), 0 0 0 1px var(--border);
}

.segment:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.source-kind {
  margin-bottom: 14px;
}

/* slider */

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.slider-value {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

input[type="range"] {
  --fill: 50%;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill), var(--border-strong) var(--fill));
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill), var(--border-strong) var(--fill));
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* switch */

.switches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-2);
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 36px;
  height: 22px;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  position: relative;
  width: 36px;
  height: 22px;
  border-radius: 11px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(14px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* buttons */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.button:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--muted);
}

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

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.button-quiet:hover:not(:disabled) {
  border-color: var(--border);
}

.button-small {
  height: 30px;
  padding: 0 11px;
  font-size: 13px;
  border-radius: 8px;
}

.button-large {
  height: 44px;
  padding: 0 24px;
  font-size: 15px;
}

.button[aria-busy="true"]::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

.button[aria-busy="true"]:disabled {
  opacity: 0.75;
}

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

/* badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge[data-tone="good"] {
  background: var(--good-soft);
  color: var(--good);
}

.badge[data-tone="busy"] {
  background: var(--busy-soft);
  color: var(--busy);
}

.badge[data-tone="busy"] .badge-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

.badge[data-tone="warning"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge[data-tone="bad"] {
  background: var(--bad-soft);
  color: var(--bad);
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.badge-hint {
  height: auto;
  min-height: 28px;
  padding: 4px 12px;
  white-space: normal;
  margin-top: 12px;
}

/* drop zone */

.drop-zone {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone[data-state="ready"] {
  border-style: solid;
}

.drop-zone[data-state="failed"] {
  border-color: var(--bad);
}

.drop-zone-icon {
  width: 30px;
  height: 30px;
  color: var(--muted);
}

.drop-zone[data-state="ready"] .drop-zone-icon {
  color: var(--accent);
}

.drop-zone-texts {
  display: grid;
  min-width: 0;
}

.drop-zone-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-zone-detail {
  font-size: 12.5px;
  color: var(--muted);
}

.drop-zone[data-state="failed"] .drop-zone-detail {
  color: var(--bad);
}

/* the scale: its label above the slider and the field, which are on one line */

.scale-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: start;
}

.scale-controls .slider {
  min-height: 38px;
  align-content: center;
}

.field-label-hidden .field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.row-offset {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.row-offset .button {
  margin-bottom: 4px;
}

/* samples of ZPL */

.samples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.samples-label {
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.samples-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* print */

.print-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.field-copies {
  width: 96px;
}

.print-row .button-primary {
  flex: 1;
  min-width: 140px;
}

/* stage */

.card-stage {
  position: relative;
}

/* an image dragged over the card: what a drop does */

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  place-items: center;
  padding: 16px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 80%, transparent);
  pointer-events: none;
}

.card-drop-over .drop-overlay {
  display: grid;
}

.drop-overlay-text {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  color: var(--accent);
  font-size: 15px;
  font-weight: 650;
  text-align: center;
}

.stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  min-height: 36px;
}

.stage-toolbar .field {
  grid-template-columns: auto auto;
  align-items: center;
  margin-left: auto;
}

.stage-toolbar .segment {
  min-height: 26px;
  padding: 2px 12px;
}

.stage-canvas {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background-color: var(--stage-bg);
  background-image: radial-gradient(var(--stage-dot) 1px, transparent 1.2px);
  background-size: 14px 14px;
  padding: 10px 10px 0;
}

.stage-drawing {
  display: block;
  width: 100%;
  height: auto;
  max-height: 74vh;
}

.stage-message {
  flex: 1 1 180px;
  color: var(--text-2);
  font-size: 13px;
}

.stage-legend {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--text-2);
  font-size: 12.5px;
}

.stage-legend:empty {
  display: none;
}

.stage-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  flex: none;
  width: 20px;
  height: 12px;
  border-radius: 2px;
}

.legend-swatch[data-key="printable"] {
  border: 1.5px dashed var(--printable);
}

.legend-swatch[data-key="placement"] {
  border: 1.5px dashed var(--placement);
}

.legend-swatch[data-key="outside"] {
  border: 1px solid var(--label-edge);
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--outside) 55%, transparent) 0 1px,
    var(--paper) 1px 4px
  );
}

.stage-caption {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

.stage-caption li:first-child {
  color: var(--text);
  font-weight: 600;
}

/* the printer, drawn in mm */

.stage-drawing[data-stale="true"] .printer-below,
.stage-drawing[data-stale="true"] .printer-above {
  filter: grayscale(1);
  opacity: 0.5;
}

.printer-shadow {
  fill: var(--shadow-drawing);
}

.base {
  fill: var(--printer-base);
  stroke: var(--printer-edge);
  stroke-width: 0.5;
}

.slot {
  fill: #040506;
}

.lid {
  stroke: var(--printer-edge);
  stroke-width: 0.6;
}

.lid-stop-front { stop-color: var(--printer-lid-front); }
.lid-stop-middle { stop-color: var(--printer-lid-middle); }
.lid-stop-back { stop-color: var(--printer-lid-back); }
.metal-stop-light { stop-color: var(--metal-light); }
.metal-stop-dark { stop-color: var(--metal-dark); }
.roll-stop-edge { stop-color: var(--roll-edge); }
.roll-stop-light { stop-color: var(--roll-light); }

.lid-parting {
  fill: none;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 0.8;
}

.lid-highlight {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 0.6;
}

.latch {
  fill: var(--printer-edge);
}



.well {
  fill: var(--printer-well);
}

.platen {
  fill: #060606;
  stroke: #2a2d33;
  stroke-width: 0.5;
}

.paper-path {
  fill: var(--paper);
}

.guide {
  fill: #7b8390;
}

.tear-bar {
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 0.2;
}

.head-line {
  stroke: var(--printable);
  stroke-width: 0.6;
  stroke-linecap: round;
}

.head-label {
  fill: rgba(255, 255, 255, 0.4);
  font: 700 2.8px var(--font);
  letter-spacing: 0.45px;
}

.panel-plate {
  fill: var(--printer-panel);
}

.feed-button {
  fill: var(--printer-button);
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 0.4;
}

.feed-text {
  fill: #cfd4db;
  font: 700 3.3px var(--font);
  letter-spacing: 0.3px;
}

.light {
  fill: #3a3f47;
}

.light-glow {
  fill: transparent;
}

.light-group[data-color="green"] .light,
.light-group[data-color="green"] .light-glow {
  fill: #3ee08f;
}

.light-group[data-color="amber"] .light,
.light-group[data-color="amber"] .light-glow {
  fill: #ffb020;
}

.light-group[data-color="red"] .light,
.light-group[data-color="red"] .light-glow {
  fill: #ff4d4d;
}

.light-group[data-blinking="true"] {
  animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.15;
  }
}

.power-switch {
  fill: #474e59;
}

.power-switch[data-on="true"] {
  fill: #6b7380;
}

.plug {
  fill: #9aa1ab;
}

.wire {
  fill: none;
  stroke: #30353c;
  stroke-width: 3;
  stroke-linecap: round;
}

@media (prefers-color-scheme: dark) {
  .wire {
    stroke: #5a626e;
  }
}

/* the paper on the printer */

.strip {
  fill: var(--paper);
  stroke: var(--label-edge);
  stroke-width: 0.3;
}

.strip-gap {
  fill: var(--liner);
  stroke: var(--liner-edge);
}

.label {
  fill: var(--paper);
  stroke: var(--label-edge);
  stroke-width: 0.3;
}

.paper-continuous .label,
.paper-mark .label {
  fill: none;
  stroke: none;
}

.label-dots {
  image-rendering: pixelated;
}

.printable {
  fill: none;
  stroke: var(--printable);
  stroke-width: 0.35;
  stroke-dasharray: 1.4 1;
}

.hatch-line {
  stroke: var(--outside);
  stroke-width: 0.45;
  opacity: 0.55;
}

.mark {
  fill: #111111;
  opacity: 0.55;
}

.cut {
  stroke: var(--label-edge);
  stroke-width: 0.35;
  stroke-dasharray: 1 0.8;
}

.placement {
  fill: none;
  stroke: var(--placement);
  stroke-width: 0.35;
  stroke-dasharray: 1.2 0.8;
}

.quantity-plate {
  fill: var(--accent);
}

.quantity text {
  fill: #ffffff;
  font-family: var(--font);
  font-weight: 700;
}

.dimension-line {
  stroke: var(--muted);
  stroke-width: 0.25;
}

.dimension-text {
  fill: var(--muted);
  font-family: var(--font);
  font-weight: 600;
}

.paper-ghost .strip,
.paper-ghost .label {
  fill: none;
  stroke: var(--muted);
  stroke-dasharray: 1.5 1;
}

.paper-ghost .label-dots {
  opacity: 0.35;
}

/* emulator */

.emulator-state {
  margin-bottom: 12px;
}

.emulator-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.button-emulator {
  height: auto;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  white-space: normal;
  text-align: left;
  justify-content: flex-start;
}

/* printed labels */

.printed-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
}

.printed {
  margin: 0;
  display: grid;
  gap: 6px;
  align-content: start;
}

.printed-paper {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 70px;
  padding: 6px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--label-edge);
  box-shadow: var(--shadow);
}

.printed-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: zoom-in;
}

.printed-open:disabled {
  cursor: default;
}

.printed-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.printed-open:hover:not(:disabled) .printed-paper {
  border-color: var(--accent);
  box-shadow: var(--shadow-raised);
}

.printed-dots {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.printed-message {
  font-size: 12px;
  color: #6b7484;
}

.printed-message:empty {
  display: none;
}

.printed figcaption {
  display: grid;
  font-size: 12px;
}

.printed-title {
  font-weight: 700;
}

.printed-detail {
  color: var(--muted);
}

/* a printed label, large */

.label-dialog {
  width: min(94vw, 960px);
  max-width: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-raised);
}

.label-dialog::backdrop {
  background: rgba(10, 14, 20, 0.55);
}

.label-dialog-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.label-dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.label-dialog-title {
  font-size: 16px;
  font-weight: 650;
}

.label-dialog-detail {
  color: var(--muted);
  font-size: 12.5px;
}

.label-dialog-paper {
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--label-edge);
  border-radius: 6px;
  background: var(--paper);
}

.label-dialog-dots {
  display: block;
  height: auto;
  image-rendering: pixelated;
}

/* status */

.status-head {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-bottom: 12px;
}

.status-detail {
  color: var(--text-2);
  font-size: 13px;
}

.flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.flag {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}


.flag[data-active="true"][data-tone="warning"] {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning);
}

.flag[data-active="true"][data-tone="bad"] {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
}

/* what the server told last, while the page is not connected to it */

.card-status[data-stale="true"] .flags,
.card-status[data-stale="true"] .facts {
  opacity: 0.5;
  filter: grayscale(1);
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* jobs */

.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.job {
  display: grid;
  grid-template-columns: 42px auto minmax(0, 1fr) auto;
  grid-template-areas:
    "id state amount cancel"
    "id mode size cancel"
    "id error error error";
  align-items: center;
  gap: 2px 10px;
  padding: 8px 10px;
  border-radius: 10px;
}

.job:nth-child(odd) {
  background: var(--surface-2);
}

.job[data-highlighted="true"] {
  box-shadow: inset 3px 0 0 var(--accent);
}

.job-id {
  grid-area: id;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.job .badge {
  grid-area: state;
  justify-self: start;
}

.job-mode {
  grid-area: mode;
  color: var(--muted);
  font-size: 12px;
}

.job-amount {
  grid-area: amount;
  font-size: 13px;
}

.job-size {
  grid-area: size;
  color: var(--muted);
  font-size: 12px;
}

.job .button {
  grid-area: cancel;
}

.job-error {
  grid-area: error;
  color: var(--bad);
  font-size: 12px;
}

/* log */

.log {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 340px;
  overflow: auto;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font: 12px/1.5 var(--mono);
}

.log-line {
  display: grid;
  grid-template-columns: auto 14px minmax(0, 1fr);
  gap: 8px;
  padding: 1px 12px;
}

.log-time {
  color: var(--muted);
}

.log-arrow {
  font-weight: 700;
  text-align: center;
}

.log-line[data-direction="out"] .log-arrow {
  color: var(--accent);
}

.log-line[data-direction="in"] .log-arrow {
  color: var(--good);
}

.log-line[data-direction="info"] {
  color: var(--muted);
}

.log-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log:empty {
  display: none;
}

/* narrow screens */

.row-wide {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

@media (max-width: 560px) {
  .page-header {
    position: static;
  }

  .page-main {
    padding: 12px;
    gap: 12px;
  }

  .header-inner {
    padding: 10px 12px;
    flex-wrap: wrap;
  }

  .header-badges {
    width: 100%;
    justify-content: flex-start;
  }

  .banner {
    width: calc(100% - 24px);
  }

  .card-head {
    padding: 12px 14px 0;
  }

  .card-body {
    padding: 12px 14px 14px;
  }

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

  .drop-zone .button {
    grid-column: 1 / -1;
  }

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

  .row-offset .button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .stage-canvas {
    padding: 4px;
  }
}

/* on a phone or a touch screen, all there is to tap is at least 36 px high */

@media (max-width: 560px), (pointer: coarse) {
  .segment,
  .stage-toolbar .segment {
    min-height: 36px;
  }

  .switch {
    min-height: 36px;
  }

  .button-small {
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
