/* kcnc print: the look of the page. Colors are tokens, redefined for dark mode. */

:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-sunken: #f5f6f8;
  --border: #e1e4ea;
  --border-strong: #c9ced6;
  --text: #1c2024;
  --text-dim: #60646c;
  --text-faint: #8b8d98;
  --accent: #3e63dd;
  --accent-hover: #3358d4;
  --accent-soft: #e6edfe;
  /* filled with the accent, with text on it */
  --accent-fill: #3e63dd;
  --on-accent: #ffffff;
  --focus-ring: rgba(62, 99, 221, 0.35);
  /* the track of sliders, outside of what is chosen */
  --track: #d3d7de;
  /* the layer being printed, as in the 3d view */
  --current: #f76b15;
  --good: #2a7e3b;
  --good-soft: #e9f6e9;
  --busy: #ab6400;
  --busy-soft: #fff3d0;
  --bad: #ce2c31;
  --bad-soft: #feebec;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-raised: 0 8px 24px rgba(16, 24, 40, 0.14);
  --radius: 12px;
  --radius-small: 8px;
  --topbar-height: 56px;
  --sidebar-width: 360px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1a1b1e;
    --surface-sunken: #222326;
    --border: #2e3035;
    --border-strong: #43464d;
    --text: #edeef0;
    --text-dim: #b0b4ba;
    --text-faint: #7b7f87;
    --accent: #6e8ff0;
    --accent-hover: #849ff3;
    --accent-soft: #1d2a50;
    --accent-fill: #4a6de0;
    --on-accent: #ffffff;
    --focus-ring: rgba(110, 143, 240, 0.45);
    --track: #3b3e45;
    --current: #ff8b3d;
    --good: #57c46a;
    --good-soft: #17301c;
    --busy: #f0b44b;
    --busy-soft: #3b2a0d;
    --bad: #ff6369;
    --bad-soft: #3d1517;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

#app {
  height: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  flex: none;
}

/* the frame of the page */

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--topbar-height);
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex: none;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand .icon {
  color: var(--accent);
  width: 22px;
  height: 22px;
}

.tabs {
  display: flex;
  gap: 4px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-small);
  color: var(--text-dim);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.tab .icon {
  width: 16px;
  height: 16px;
}

.tab:hover {
  color: var(--text);
  background: var(--surface-sunken);
}

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

.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* the tabs of the page: each a column filling the rest of the page under the header */
.tab-page,
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.statuses {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-dim);
  font-size: 13px;
  white-space: nowrap;
}

.status-link {
  flex: none;
}

.status-text {
  flex: none;
}

.status-printer .status-text,
.status-printer .status-short {
  color: var(--text);
  font-weight: 500;
}

/* the short text of a status, for small screens */
.status-short {
  display: none;
}

/* the firmware: the first to give way when space is short */
.status-detail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-faint);
}

.status-detail::before {
  content: "· ";
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}

[data-tone="good"] .dot {
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-soft);
}

[data-tone="busy"] .dot {
  background: var(--busy);
  box-shadow: 0 0 0 3px var(--busy-soft);
}

[data-tone="warning"] .dot {
  background: var(--busy);
  box-shadow: 0 0 0 3px var(--busy-soft);
}

[data-tone="bad"] .dot {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

/* cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-sunken);
  color: var(--text-dim);
}

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

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

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

.error-text {
  color: var(--bad);
  font-size: 13px;
}

/* something that went wrong, e.g. why a job failed */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  border-radius: var(--radius-small);
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 13px;
  line-height: 1.4;
}

.alert .icon {
  width: 18px;
  height: 18px;
}

.alert-text {
  min-width: 0;
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* something that may become an error */
.alert-warning {
  border-color: color-mix(in srgb, var(--busy) 40%, transparent);
  background: var(--busy-soft);
  color: var(--busy);
}

/* the job */

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

.job-title {
  min-width: 0;
}

.job-name {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-details,
.job-line {
  color: var(--text-faint);
  font-size: 12px;
}

.job-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.job-numbers div {
  display: flex;
  flex-direction: column;
}

.job-numbers dt {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.job-numbers dd {
  margin: 0;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.job-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

/* as wide as their content at least, sharing what is left */
.button-row > .button {
  flex: 1 1 auto;
  padding: 0 12px;
}

/* buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.button-primary {
  background: var(--accent-fill);
  color: var(--on-accent);
}

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

.button-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.button-secondary:hover:not(:disabled) {
  background: var(--surface-sunken);
}

.button-danger {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--bad);
}

.button-danger:hover:not(:disabled) {
  background: var(--bad-soft);
  border-color: var(--bad);
}

/* clearly out of use: grey whatever its tone */
.button:disabled {
  background: var(--surface-sunken);
  border-color: var(--border);
  color: var(--text-faint);
  cursor: not-allowed;
}

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

.button-icon-only {
  padding: 0;
  width: 36px;
}

.button-icon:empty {
  display: none;
}

.button-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.button[aria-busy="true"] .button-spinner {
  display: inline-block;
}

.button[aria-busy="true"] .button-icon {
  display: none;
}

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

/* progress */

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease;
}

.progress-bar.indeterminate .progress-bar-fill {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.35) 25%, transparent 25%, transparent 50%,
    rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 75%, transparent 75%);
  background-size: 16px 16px;
  animation: stripes 0.8s linear infinite;
}

@keyframes stripes {
  to {
    background-position: 16px 0;
  }
}

/* uploads */

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  color: var(--text-dim);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.file-drop .icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  margin-bottom: 4px;
}

.file-drop:hover:not(.disabled),
.file-drop.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file-drop.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.file-drop-title {
  font-weight: 600;
  color: var(--text);
}

.file-drop-hint {
  font-size: 12px;
}

.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-state {
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.upload-actions > div:empty,
.upload-actions > [hidden] {
  display: none;
}

/* temperatures */

.heater {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.heater + .heater {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.heater-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.heater-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--busy-soft);
  color: var(--busy);
}

.heater-bed .heater-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.heater-label {
  font-weight: 600;
}

.heater-current {
  margin-left: auto;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.heater-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 12px;
  min-height: 22px;
}

.heater-override {
  background: var(--busy-soft);
  color: var(--busy);
}

.heater-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.heater-message {
  margin-top: -2px;
  color: var(--bad);
  font-size: 12px;
}

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

/* one ring for the focus, on the field, in red while what is typed is not valid */
.input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.input input[aria-invalid="true"] {
  color: var(--bad);
}

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

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

.input:has(input:disabled) {
  background: var(--surface-sunken);
  border-color: var(--border);
}

.input input:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}

.input input:disabled::placeholder {
  color: var(--text-faint);
}

.input-unit {
  color: var(--text-faint);
  font-size: 12px;
}

/*
 * What a field takes, under it, making room for itself: while what is typed is not valid, as long as the field has the
 * focus; then a moment longer, dimmer, as the reason why it was put back
 */
.input-hint {
  display: block;
  margin-top: 4px;
  color: var(--bad);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.input:not(:focus-within) + .input-hint:not(.after) {
  display: none;
}

.input-hint.after {
  color: var(--text-dim);
}

/* speed */

.speed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.speed-value {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.speed-reset {
  display: flex;
  justify-content: flex-end;
}

.slider {
  width: 100%;
  height: 24px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--track) var(--fill, 0%));
}

.slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--track) var(--fill, 0%));
}

.slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}

.slider:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* the focus shows on the thumb, not as a box around the track */
.slider:focus,
.range-slider-input:focus {
  outline: none;
}

.slider:focus-visible::-webkit-slider-thumb,
.range-slider-input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.slider:focus-visible::-moz-range-thumb,
.range-slider-input:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px var(--focus-ring);
}

/* the viewer */

.viewer {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.viewer-canvas {
  position: absolute;
  inset: 0;
}

.viewer-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.viewer-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: calc(100% - 120px);
}

.choice {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-sunken);
}

.choice button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

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

/* the option chosen, filled */
.choice button[aria-checked="true"] {
  background: var(--accent-fill);
  color: var(--on-accent);
  box-shadow: var(--shadow);
}

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

.toggle {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

/* the icon stands in for the switch and the label where space is short */
.toggle-icon {
  display: none;
}

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

.toggle input {
  appearance: none;
  width: 30px;
  height: 18px;
  margin: 0;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background-color 0.15s;
}

.toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.15s;
}

.toggle input:checked {
  background: var(--accent);
}

.toggle input:checked::after {
  transform: translateX(12px);
}

/* the layer slider: opaque, as the toolpath behind a see-through one shows as a blurred patch */
.viewer-layers {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.viewer-layers-slider {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.viewer-layers-text {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.range-slider {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  gap: 6px;
}

.range-slider-label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: pre-line;
}

.range-slider-track {
  position: relative;
  flex: 1;
  width: 28px;
  min-height: 60px;
}

.range-slider-track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 11px;
  bottom: 11px;
  width: 6px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--track);
}

.range-slider-fill {
  position: absolute;
  left: 50%;
  width: 6px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--accent);
  bottom: calc(11px + (100% - 22px) * var(--from, 0));
  top: calc(11px + (100% - 22px) * (1 - var(--to, 1)));
}

/* the layer being printed */
.range-slider-marker {
  position: absolute;
  left: 50%;
  width: 18px;
  height: 4px;
  border-radius: 2px;
  background: var(--current);
  box-shadow: 0 0 0 2px var(--surface);
  bottom: calc(11px + (100% - 22px) * var(--marker, 0));
  transform: translate(-50%, 50%);
  pointer-events: none;
}

.range-slider-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
  writing-mode: vertical-lr;
  direction: rtl;
}

.range-slider-input::-webkit-slider-runnable-track {
  background: transparent;
}

.range-slider-input::-webkit-slider-thumb {
  appearance: none;
  pointer-events: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
  cursor: grab;
}

.range-slider-input::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  cursor: grab;
}

.viewer-status {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-raised);
  color: var(--text-dim);
  font-size: 13px;
}

/* notices and the overlay */

/* at the top of the viewer, under its toolbar, where it covers nothing that matters */
.notice {
  position: fixed;
  top: calc(var(--topbar-height) + 72px);
  left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width) - 120px) / 2);
  transform: translate(-50%, -8px);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(480px, calc(100vw - var(--sidebar-width) - 160px));
  padding: 8px 8px 8px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-raised);
  visibility: hidden;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s;
  z-index: 20;
}

.notice.visible {
  transform: translate(-50%, 0);
  visibility: visible;
  opacity: 1;
}

.notice-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notice .button {
  background: transparent;
  border-color: transparent;
  color: inherit;
}

/* over the page, which still shows the last state it knows */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: grayscale(0.6);
  z-index: 30;
}

.overlay.visible {
  display: flex;
}

.overlay-card {
  max-width: 420px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-raised);
  text-align: center;
}

.overlay-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.overlay-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  margin-bottom: 10px;
  border: 3px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.overlay-card p {
  margin: 0;
  color: var(--text-dim);
}

.overlay-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* smaller screens: the viewer on top, the cards below, all of it scrolling */

@media (max-width: 900px) {
  .workspace {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }

  .viewer {
    order: -1;
    flex: none;
    height: 45vh;
    min-height: 300px;
    border-bottom: 1px solid var(--border);
  }

  .sidebar {
    flex: none;
    border-right: none;
    overflow: visible;
  }

  .status-detail {
    display: none;
  }

  /* under the header, across the page */
  .notice {
    top: calc(var(--topbar-height) + 8px);
    left: 50%;
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 8px;
    padding: 0 10px;
  }

  /* the brand as its icon, the tabs by their names */
  .brand span {
    display: none;
  }

  .tab {
    padding: 6px 8px;
  }

  .tab .icon {
    display: none;
  }

  .statuses {
    gap: 12px;
  }

  /* the short texts of the statuses; the long ones for screen readers and as the title */
  .status .status-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .status .status-short {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar {
    padding: 12px;
  }

  .viewer-toolbar {
    left: 8px;
    top: 8px;
    gap: 4px;
    padding: 4px;
    max-width: calc(100% - 100px);
  }

  .choice button {
    padding: 4px 8px;
    font-size: 12px;
  }

  /* the toggles as icons, the switches still there for the keyboard and screen readers */
  .toggle input,
  .toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-small);
    color: var(--text-dim);
  }

  .toggle:has(input:checked) .toggle-icon {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .toggle:has(input:focus-visible) .toggle-icon {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
  }

  .toggle:has(input:disabled) .toggle-icon {
    opacity: 0.5;
  }

  .viewer-layers {
    width: 76px;
    right: 8px;
    top: 8px;
    bottom: 8px;
  }

  .job-numbers dd {
    font-size: 14px;
  }
}

/* the smallest phones: the toolbar of the viewer keeps all its buttons visible next to the layer slider */

@media (max-width: 400px) {
  .viewer-toolbar {
    gap: 2px;
    padding: 3px;
  }

  .viewer-toolbar .choice button {
    padding: 4px 6px;
    font-size: 11px;
  }

  .viewer-toolbar .button-icon-only {
    width: 32px;
    min-height: 32px;
  }
}

/* ==================================================================================================================
 * the slicer tab, laid out like Cura: the bar with the printer, the stages and the print settings; the 3d view with the
 * tools and the objects on the left, the print settings and the action panel on the right
 * ================================================================================================================== */

.slicer-page {
  position: relative;
}

/* floating panels over the 3d view */
.slicer-left > *,
.slicer-tool-panel,
.slicer-objects,
.slicer-legend,
.slicer-layers,
.slicer-moves,
.settings-panel,
.slicer-action {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
}

.select {
  position: relative;
  display: inline-flex;
  min-width: 0;
}

.select select {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-overflow: ellipsis;
}

.select select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.select select:disabled {
  background: var(--surface-sunken);
  color: var(--text-faint);
  cursor: not-allowed;
}

/* the arrow of the list */
.select::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.text-area {
  width: 100%;
  min-height: 96px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font: 12px/1.5 var(--mono);
  resize: vertical;
}

.text-area:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* the bar */

.slicer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}

.slicer-printer {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.slicer-printer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-small);
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}

.slicer-printer-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.slicer-printer-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slicer-printer-size,
.slicer-caption,
.slicer-summary-details {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.slicer-stages {
  flex: none;
}

.slicer-stages .choice button {
  padding: 6px 18px;
  font-size: 14px;
}

.slicer-bar-end {
  flex: 1 1 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.slicer-material .select {
  width: 150px;
}

.slicer-summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 360px;
  height: 44px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.slicer-summary:hover {
  background: var(--surface-sunken);
}

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

.slicer-summary[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.slicer-summary > .icon {
  color: var(--accent);
}

.slicer-summary-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.slicer-summary-profile {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slicer-summary-details {
  overflow: hidden;
  text-overflow: ellipsis;
}

.slicer-summary-chevron {
  display: inline-flex;
  color: var(--text-dim);
  transition: transform 0.15s;
}

.slicer-summary[aria-expanded="true"] .slicer-summary-chevron {
  transform: rotate(180deg);
}

/* the 3d view and what floats over it */

.slicer-main {
  position: relative;
  flex: 1;
  min-height: 0;
  --right-width: 360px;
}

/* a container of sizes, so that what floats over it can be as high as a share of it */
.slicer-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
}

.slicer-canvas {
  position: absolute;
  inset: 0;
}

.slicer-left {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  z-index: 3;
}

/* the open button stands out of the floating panels as the main action */
.slicer-left > .slicer-open {
  background: none;
  border: none;
  box-shadow: var(--shadow-raised);
  backdrop-filter: none;
  border-radius: var(--radius-small);
}

.slicer-left > .slicer-fit {
  padding: 4px;
}

.slicer-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
}

.tool-button.button {
  width: 40px;
  min-height: 40px;
  border-color: transparent;
  background: transparent;
  color: var(--text-dim);
}

.tool-button.button:hover:not(:disabled) {
  background: var(--surface-sunken);
  color: var(--text);
}

.tool-button.button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.tool-button.button:disabled {
  background: transparent;
  border-color: transparent;
  opacity: 0.45;
}

.slicer-fit .button {
  border-color: transparent;
  background: transparent;
}

.slicer-main[data-stage="prepare"] .slicer-fit-preview,
.slicer-main[data-stage="preview"] .slicer-fit-prepare,
.slicer-main[data-stage="preview"] .slicer-tools,
.slicer-main[data-stage="preview"] .slicer-tool-panel,
.slicer-main[data-stage="preview"] .slicer-objects,
.slicer-main[data-stage="preview"] .slicer-hint,
.slicer-main[data-stage="preview"] .slicer-empty,
.slicer-main[data-stage="prepare"] .slicer-legend,
.slicer-main[data-stage="prepare"] .slicer-layers,
.slicer-main[data-stage="prepare"] .slicer-moves,
.slicer-main[data-stage="prepare"] .slicer-status {
  display: none !important;
}

/*
 * The panel of the tool next to the toolbar, and the objects at the bottom, below the toolbar: one column from below the
 * open button down, in which the panel of the tool takes what the objects leave
 */
.slicer-stack {
  position: absolute;
  top: 60px;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  z-index: 3;
}

.slicer-stack > * {
  pointer-events: auto;
}

.slicer-tool-panel {
  flex: 0 1 auto;
  min-height: 0;
  width: 300px;
  margin-left: 58px;
  overflow-y: auto;
  padding: 14px;
  container: tool-panel / inline-size;
}

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.tool-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* the axis stays level with its field, also while a hint under the field makes the row higher */
.tool-field {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.axis {
  font-weight: 700;
  font-size: 13px;
  line-height: 36px;
  text-align: center;
}

/* the axes in Cura's colors */
.axis-x {
  color: #e5484d;
}

.axis-y {
  color: #3fb950;
}

.axis-z {
  color: #3e7bff;
}

.tool-scale-grid {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.tool-caption {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.tool-rotate-grid {
  display: grid;
  grid-template-columns: 22px 1fr 1fr;
  align-items: center;
  gap: 8px;
}

.tool-rotate-grid .button,
.tool-row .button,
.tool-mirror .button,
.tool-add .button {
  width: 100%;
  padding: 0 10px;
}

.tool-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.tool-mirror {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tool-text {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}

.tool-categories {
  display: flex;
  flex-direction: column;
}

.tool-category + .tool-category {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tool-category-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.tool-category-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-panel .toggle {
  white-space: normal;
}

/* the settings of a model need room for their names and their choices */
.slicer-tool-panel:has(.tool-panel[data-tool="perModel"]) {
  width: 420px;
}

.tool-panel .setting-row {
  grid-template-columns: minmax(0, 1fr) 176px 30px;
  padding: 2px 0;
}

/* a narrow panel, e.g. on a phone: the name of a setting above its control, which takes the width */
@container tool-panel (max-width: 360px) {
  .tool-panel .setting-row:not(.setting-bool) {
    grid-template-columns: minmax(0, 1fr) 30px;
    row-gap: 2px;
  }

  .tool-panel .setting-row:not(.setting-bool) .setting-label {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .tool-panel .setting-row:not(.setting-bool) .setting-control {
    grid-column: 1;
    grid-row: 2;
  }

  .tool-panel .setting-row:not(.setting-bool) .setting-reset {
    grid-column: 2;
    grid-row: 2;
  }

  .tool-panel .setting-bool {
    grid-template-columns: minmax(0, 1fr) auto 30px;
  }
}

/* a hint of what a click does now */
.slicer-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 140px - var(--right-width));
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-raised);
  z-index: 2;
  pointer-events: none;
}

/* the empty plate */
.slicer-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 22px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text-dim);
  font-weight: 500;
  pointer-events: none;
}

.slicer-empty-icon .icon {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

/* files dragged over the view */
.slicer-drop {
  position: absolute;
  inset: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
}

.slicer-viewport.dragging .slicer-drop {
  display: flex;
}

/* the objects */
.slicer-objects {
  --objects-max: min(45cqh, 100cqh - 400px);
  flex: none;
  margin-top: auto;
  width: 320px;
  /* below the toolbar on the left, which is about 380 pixels high */
  max-height: var(--objects-max);
  min-height: 42px;
  overflow: hidden;
}

/* the list scrolls, the size and the actions under it stay */
.slicer-objects-body {
  display: flex;
  flex-direction: column;
  max-height: calc(var(--objects-max) - 42px);
}

.slicer-objects summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
  list-style: none;
}

.slicer-objects summary::-webkit-details-marker {
  display: none;
}

.slicer-objects summary::after {
  content: "";
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(-135deg);
  transition: transform 0.15s;
}

.slicer-objects:not([open]) summary::after {
  transform: rotate(45deg);
}

.slicer-objects-count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-sunken);
  font-size: 11px;
  line-height: 18px;
}

.slicer-objects-rows {
  flex: 0 1 auto;
  margin: 0;
  padding: 0 6px;
  list-style: none;
  overflow-y: auto;
  min-height: 0;
}

.slicer-objects-size,
.slicer-objects-actions {
  flex: none;
}

/* the copies in the row of the actions: what they take shows above them, over the list, in a bubble */
.slicer-copies {
  position: relative;
}

.slicer-copies .input-hint {
  position: absolute;
  bottom: calc(100% + 5px);
  left: -1px;
  z-index: 2;
  width: max-content;
  margin: 0;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bad);
  color: #ffffff;
  box-shadow: var(--shadow-raised);
  pointer-events: none;
}

.slicer-copies .input-hint.after {
  background: var(--text);
  color: var(--surface);
}

.object-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.object-row:hover:not(:disabled) {
  background: var(--surface-sunken);
}

.object-row.selected {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

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

.object-row:disabled {
  cursor: progress;
  color: var(--text-faint);
}

.object-icon {
  display: inline-flex;
  color: #d9a400;
}

.object-icon .icon,
.object-warning .icon {
  width: 16px;
  height: 16px;
}

[data-kind="blocker"] .object-icon {
  color: var(--accent);
}

.object-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-size {
  color: var(--text-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.object-warning {
  display: inline-flex;
  color: var(--busy);
}

.slicer-objects-size {
  padding: 6px 14px 0;
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.slicer-objects-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

.slicer-copies {
  width: 64px;
}

.slicer-objects-actions .button {
  width: 34px;
  min-height: 34px;
}

.slicer-objects-actions .input {
  height: 34px;
  padding: 0 8px;
}

/* the preview */
/* as wide as its longest name with its switch, at every size */
.slicer-legend {
  position: absolute;
  top: 110px;
  left: 12px;
  width: max-content;
  min-width: 180px;
  padding: 10px 12px;
  z-index: 2;
}

.slicer-legend-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
  list-style: none;
}

.slicer-legend-title::-webkit-details-marker {
  display: none;
}

.slicer-legend-title::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(-135deg);
}

.slicer-legend:not([open]) .slicer-legend-title::after {
  transform: rotate(45deg);
}

.slicer-legend[open] .slicer-legend-title {
  margin-bottom: 6px;
}

.slicer-legend-items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.legend-item.off .legend-swatch {
  opacity: 0.3;
}

/* the switch first, then the name */
.legend-toggle .toggle {
  flex-direction: row;
  width: 100%;
  justify-content: space-between;
  gap: 8px;
}

.legend-toggle {
  flex: 1;
}

.legend-toggle .toggle-label {
  order: -1;
  color: var(--text);
  white-space: nowrap;
}

.legend-item.off .toggle-label {
  color: var(--text-faint);
}

/*
 * The layer slider, as in Cura: at the right edge of the 3d view, above the action panel, in the right column; it
 * takes the height the print settings and the action panel leave
 */
.slicer-layers {
  flex: 1 1 0;
  min-height: 180px;
  align-self: flex-end;
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  pointer-events: auto;
}

/* the layer slider: opaque, as the toolpath behind a see-through one shows as a blurred patch */
.slicer-main .slicer-layers {
  background: var(--surface);
  backdrop-filter: none;
}

.slicer-layers-slider {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.slicer-layers-text,
.slicer-moves-text {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slicer-moves {
  position: absolute;
  bottom: 12px;
  left: 232px;
  right: calc(var(--right-width) + 24px);
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  z-index: 2;
}

.slicer-moves-slider {
  flex: 1;
}

.slicer-status {
  position: absolute;
  left: calc((100% - var(--right-width)) / 2);
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: min(420px, calc(100% - var(--right-width) - 120px));
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-raised);
  color: var(--text-dim);
  text-align: center;
  font-size: 13px;
  z-index: 2;
}

/* the toolpath is there: the status says it is out of date, at the top */
.slicer-main[data-stage="preview"]:has(.slicer-layers:not([hidden])) .slicer-status {
  top: 12px;
  transform: translateX(-50%);
}

/* the right column: the print settings, and the action panel under them */
.slicer-right {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: var(--right-width);
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  z-index: 4;
}

.slicer-settings {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.settings-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 4px 16px;
}

.settings-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.settings-head .button {
  border-color: transparent;
  background: transparent;
}

/* the material is in the bar, and here on small screens only */
.settings-material {
  display: none !important;
}

.settings-mode {
  padding: 4px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.settings-mode .choice {
  display: flex;
}

.settings-mode .choice button {
  flex: 1;
}

.settings-status {
  padding: 16px;
  color: var(--text-dim);
}

.settings-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-recommended {
  display: flex;
  flex-direction: column;
}

.rec-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.rec-section:last-child {
  border-bottom: none;
}

.rec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.rec-title .icon {
  color: var(--accent);
}

.rec-value {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.rec-profile .choice {
  display: flex;
}

.rec-profile .choice button {
  flex: 1;
  padding: 5px 4px;
  font-variant-numeric: tabular-nums;
}

.rec-profile-text,
.rec-note {
  font-size: 12px;
  color: var(--text-dim);
}

.rec-note:empty {
  display: none;
}

/* the switches of support and adhesion: the name first, the switch on the right */
.rec-switch .toggle,
.rec-gradual .toggle {
  width: 100%;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
}

.rec-switch .toggle-label,
.rec-gradual .toggle-label {
  order: -1;
  flex: 1;
}

.rec-switch .toggle-label {
  font-weight: 600;
}

.rec-switch .toggle-icon {
  display: inline-flex;
  order: -2;
  color: var(--accent);
}

.custom-tools {
  position: sticky;
  top: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

.custom-search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.custom-search > .icon {
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 9px;
  color: var(--text-faint);
  pointer-events: none;
}

.custom-search .input {
  padding-left: 34px;
}

.custom-empty {
  padding: 16px;
  color: var(--text-dim);
}

.setting-category + .setting-category {
  border-top: 1px solid var(--border);
}

.category-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.category-head:hover {
  background: var(--surface-sunken);
}

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

.category-chevron {
  display: inline-flex;
  color: var(--text-dim);
  transform: rotate(-90deg);
  transition: transform 0.15s;
}

.category-head[aria-expanded="true"] .category-chevron {
  transform: none;
}

.category-changed {
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--accent);
}

.category-rows {
  padding: 0 8px 8px;
}

.category-rows:empty {
  display: none;
}

/* a setting: its name, its control and its reset, the name and the control sharing the width */
/* the name stays level with the control, also while a hint under the control makes the row higher */
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 140px) 32px;
  align-items: start;
  gap: 8px;
  padding: 3px 6px;
  border-radius: var(--radius-small);
}

.setting-row:hover:not(:has(.input-hint.after)) {
  background: var(--surface-sunken);
}

.setting-label {
  display: flex;
  align-items: center;
  min-height: 30px;
  font-size: 13px;
  line-height: 1.25;
  color: var(--text);
  overflow-wrap: anywhere;
  cursor: help;
}

.setting-row.changed .setting-label {
  color: var(--accent);
  font-weight: 600;
}

.setting-control .input {
  height: 30px;
  padding: 0 8px;
}

.setting-control .select {
  width: 100%;
}

.setting-control .select select {
  height: 30px;
  font-size: 13px;
}

.setting-bool .setting-control {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 30px;
}

/* the switch alone: its name is the label of the row */
.setting-row .toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.setting-text {
  grid-template-columns: minmax(0, 1fr) 32px;
}

.setting-text .setting-label {
  grid-column: 1;
}

.setting-text .setting-control {
  grid-column: 1 / -1;
  grid-row: 2;
}

.setting-reset .button {
  width: 30px;
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}

.setting-reset.invisible {
  visibility: hidden;
}

/* the action panel */
.slicer-action {
  flex: none;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  pointer-events: auto;
}

.slicer-action > [hidden] {
  display: none;
}

.action-message {
  color: var(--text-dim);
  font-size: 13px;
}

.action-slice .button {
  width: 100%;
  min-height: 42px;
  font-size: 15px;
}

.action-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.action-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-estimates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  min-width: 0;
}

.estimate {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.estimate-icon {
  display: inline-flex;
  color: var(--accent);
}

.estimate-layers {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-buttons > div > .button {
  width: 100%;
  padding: 0 10px;
}

.action-load {
  grid-column: 1 / -1;
}

/* in the preview, saving takes the row alone */
.action-buttons:has(.action-preview[hidden]) .action-save {
  grid-column: 1 / -1;
}

.action-load .button {
  min-height: 42px;
}

.action-blocked {
  font-size: 12px;
  color: var(--busy);
}

.action-transfer,
.action-loaded {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.action-transfer-text,
.action-loaded-text {
  font-weight: 600;
}

.action-transfer-error {
  color: var(--bad);
}

.action-loaded-text {
  color: var(--good);
}

.slicer-notice {
  left: 50%;
}

/* a screen of a laptop: narrower panels */

@media (max-width: 1200px) {
  .slicer-main {
    --right-width: 320px;
  }

  /* the stages next to the printer, the material and the settings taking the rest */
  .slicer-printer {
    flex: 0 1 auto;
  }

  .slicer-bar-end {
    flex: 1 1 auto;
  }

  .slicer-material {
    flex: none;
  }

  .slicer-material .select {
    width: 136px;
  }

  .slicer-summary {
    flex: 0 1 auto;
  }

  .slicer-objects {
    width: 280px;
  }

  .slicer-summary {
    max-width: 280px;
  }

  .slicer-material .slicer-caption {
    display: none;
  }

  .slicer-moves {
    left: 12px;
  }
}

@media (max-width: 900px) {
  .slicer-printer-texts {
    display: none;
  }

  .slicer-printer {
    flex: 0 0 auto;
  }

  .slicer-bar-end {
    flex: 1 1 auto;
  }

}

/* a phone: the 3d view over the whole tab, the settings as a sheet over it, the action panel as a bar at the bottom */

@media (max-width: 560px) {
  .slicer-bar {
    gap: 8px;
    padding: 6px 10px;
    min-height: 50px;
  }

  .slicer-printer,
  .slicer-material {
    display: none !important;
  }

  .slicer-stages .choice button {
    padding: 5px 12px;
  }

  .slicer-summary {
    height: 38px;
    gap: 6px;
    padding: 0 8px;
  }

  .slicer-summary-details {
    display: none;
  }

  .slicer-summary-profile {
    font-size: 12px;
  }

  /* the 3d view, and the action panel under it, which the settings leave free */
  .slicer-main {
    --right-width: 0px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .slicer-viewport {
    grid-area: 1 / 1;
    position: relative;
    inset: auto;
    min-height: 0;
  }

  .slicer-right {
    display: contents;
  }

  /* the settings: a sheet over the 3d view */
  .slicer-settings {
    grid-area: 1 / 1;
    position: relative;
    min-height: 0;
    z-index: 20;
  }

  /*
   * The sheet scrolls as a whole, so that the material and the mode scroll away and leave the settings the room; its
   * head and the search stay at the top
   */
  .slicer-settings .settings-panel {
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: none;
    background: var(--surface);
    backdrop-filter: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .slicer-settings .settings-head {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 48px;
    padding: 0 8px 0 16px;
    background: var(--surface);
  }

  .slicer-settings .settings-body {
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .slicer-settings .custom-tools {
    top: 48px;
  }

  /* room for the longest choices, e.g. "Sharpest corner" */
  .slicer-settings .setting-row {
    grid-template-columns: minmax(0, 1fr) 156px 30px;
  }

  .settings-material {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 16px 10px;
  }

  .settings-material-select {
    flex: 0 1 60%;
    display: flex;
  }

  .settings-material .select {
    width: 100%;
  }

  .settings-caption {
    font-weight: 600;
  }

  .slicer-action {
    grid-area: 2 / 1;
    border-radius: 0;
    border-width: 1px 0 0;
    box-shadow: none;
    background: var(--surface);
    backdrop-filter: none;
    padding: 10px 12px;
    gap: 8px;
  }

  /* in one row, and the layers in a row of their own where that is too narrow */
  .action-estimates {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 14px;
  }

  .estimate-layers {
    margin-left: auto;
  }

  .action-buttons {
    grid-template-columns: 1fr auto auto;
  }

  .action-load,
  .action-buttons:has(.action-preview[hidden]) .action-save {
    grid-column: auto;
  }

  .action-buttons > div:not(.action-load) > .button .button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .action-buttons > div:not(.action-load) > .button {
    width: 42px;
    padding: 0;
  }

  .action-load .button,
  .action-slice .button {
    min-height: 40px;
  }

  .slicer-left {
    top: 8px;
    left: 8px;
    gap: 6px;
  }

  .slicer-open .button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .slicer-open .button {
    width: 40px;
    padding: 0;
  }

  .slicer-tools {
    padding: 3px;
    gap: 2px;
  }

  .tool-button.button {
    width: 38px;
    min-height: 38px;
  }

  /*
   * Beside the tool column, never over it: the objects at the top right, and the panel of the tool at the bottom, in
   * what the objects leave; they fold as a tool panel opens
   */
  .slicer-stack {
    top: 8px;
    left: 60px;
    right: 8px;
    bottom: 8px;
    align-items: flex-end;
    gap: 6px;
  }

  .slicer-objects {
    --objects-max: 50cqh;
    order: -1;
    margin-top: 0;
    width: min(252px, 100%);
  }

  .slicer-objects-body {
    max-height: calc(var(--objects-max) - 36px);
  }

  .slicer-tool-panel,
  .slicer-tool-panel:has(.tool-panel[data-tool="perModel"]) {
    width: 100%;
    margin-top: auto;
    margin-left: 0;
    padding: 12px;
  }

  .slicer-objects:not([open]) {
    width: auto;
  }

  .slicer-objects summary {
    padding: 8px 12px;
  }

  .slicer-objects-actions {
    flex-wrap: wrap;
  }

  /* the size of the selected model is under the list */
  .object-size {
    display: none;
  }

  .slicer-copies {
    width: 50px;
  }

  .slicer-objects-actions {
    gap: 3px;
    padding: 6px 8px 8px;
  }

  .slicer-objects-actions .button {
    width: 32px;
    min-height: 32px;
  }

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

  .slicer-hint {
    top: auto;
    bottom: 8px;
    max-width: calc(100% - 16px);
    font-size: 12px;
  }

  .slicer-legend {
    top: 104px;
    left: 8px;
    min-width: 0;
    padding: 8px 10px;
  }

  .slicer-legend:not([open]) {
    width: auto;
  }

  .slicer-legend .legend-item {
    font-size: 12px;
  }

  /* in the area of the 3d view, over it at its right edge, above the slider of the moves */
  .slicer-layers {
    grid-area: 1 / 1;
    justify-self: end;
    align-self: stretch;
    width: 72px;
    min-height: 0;
    margin: 8px 8px 64px 0;
    z-index: 2;
  }

  .slicer-moves {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-width: none;
    padding: 6px 12px;
  }

  .slicer-status {
    left: 50%;
    max-width: calc(100% - 32px);
  }

  /*
   * the switches of the slicer and of the camera keep their switch and name, unlike the toggles of the toolbar of the
   * print tab
   */
  .slicer-page .toggle input,
  .camera-watch .toggle input {
    position: relative;
    width: 30px;
    height: 18px;
    opacity: 1;
    overflow: visible;
    clip: auto;
  }

  .slicer-page .toggle-label,
  .camera-watch .toggle-label {
    position: static;
    width: auto;
    height: auto;
    opacity: 1;
    overflow: visible;
    clip: auto;
  }

  .slicer-page .toggle-icon,
  .camera-watch .toggle-icon {
    display: none;
  }

  .slicer-page .rec-switch .toggle-icon {
    display: inline-flex;
    width: auto;
    height: auto;
    background: none;
  }

  .slicer-page .setting-row .toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

/* ==================================================================================================================
 * the camera of the print tab: a card with the picture, and the picture large over the page
 * ================================================================================================================== */

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

.camera-picture {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-sunken);
  overflow: hidden;
  cursor: zoom-in;
  color: var(--text-dim);
  font: inherit;
}

.camera-picture:disabled {
  cursor: default;
}

/* nothing to show for a while: no room for a picture taken */
.camera-picture.compact {
  aspect-ratio: auto !important;
  height: 64px;
}

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

.camera-frame {
  position: absolute;
  inset: 0;
}

.camera-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000000;
}

.camera-status {
  position: relative;
  max-width: 85%;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  font-size: 13px;
  text-align: center;
}

/* the sign that the picture can be shown large, over its corner */
.camera-zoom {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  padding: 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.15s;
}

.camera-picture:not(:disabled):hover .camera-zoom,
.camera-picture:not(:disabled):focus-visible .camera-zoom {
  opacity: 1;
}

.camera-detail {
  margin-top: -4px;
  color: var(--text-faint);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-large {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.82);
  cursor: zoom-out;
  z-index: 40;
}

.camera-large.visible {
  display: flex;
}

/* the picture as large as fits, its ratio kept (--camera-aspect, from the view) */
.camera-large-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  container-type: size;
}

.camera-large-frame .camera-image {
  width: min(100cqw, 100cqh * var(--camera-aspect, 4 / 3));
  height: auto;
  aspect-ratio: var(--camera-aspect, 4 / 3);
  border-radius: var(--radius-small);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.camera-large-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.camera-large-close .button {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.camera-large-close .button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 560px) {
  .camera-large {
    padding: 8px;
  }

  .camera-large-close {
    top: 10px;
    right: 10px;
  }
}
