/* Editor: bar / board (pasteboard with pages) / inspector. */

body.editor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--paste);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}

.link-btn:hover {
  text-decoration-color: var(--m);
}

/* ---- bar ---------------------------------------------------------------- */
.bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.bar .brand {
  padding-right: 14px;
  border-right: 1px solid var(--rule-2);
}

.bar-spacer {
  flex: 1;
}

.sheet-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s;
}

.sheet-chip:hover,
.sheet-chip[aria-expanded="true"] {
  border-color: var(--ink);
}

.chip-glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
}

.chip-glyph i {
  display: block;
  max-width: 24px;
  max-height: 24px;
  outline: 1px dashed var(--c);
  outline-offset: 2px;
  background: var(--y);
}

.chip-main {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-sub {
  color: var(--ink-3);
  font-size: 13px;
  white-space: nowrap;
}

.chip-caret {
  color: var(--ink-3);
  font-size: 11px;
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
}

.save-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.save-state.is-busy i {
  background: var(--c);
}

.save-state.is-error {
  color: var(--warn);
}

.save-state.is-error i {
  background: var(--warn);
}

/* menu */
.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 264px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--pop-shadow);
}

.menu button,
.menu a {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 2px;
  background: none;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
  text-decoration: none;
}

.menu button:hover,
.menu a:hover {
  background: var(--paste);
}

.menu small {
  color: var(--ink-3);
  font-size: 12px;
}

.menu hr {
  margin: 5px 0;
  border: 0;
  border-top: 1px solid var(--rule-2);
}

.menu .is-danger {
  color: #b3261e;
}

/* sheet popover */
.sheet-pop {
  position: absolute;
  top: 64px;
  left: 16px;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  width: min(700px, calc(100vw - 32px));
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--pop-shadow);
}

.pop-sec {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
}

.pop-sec + .pop-sec {
  border-left: 1px solid var(--rule-2);
}

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

.size-opt {
  display: grid;
  grid-template-rows: 46px auto auto;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px 7px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--paper);
  text-align: center;
}

.size-opt:hover {
  border-color: var(--ink-3);
}

.size-opt[aria-pressed="true"] {
  border-color: var(--m);
  box-shadow: inset 0 0 0 1px var(--m);
}

.size-opt .shape {
  align-self: center;
  background: var(--y);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.14);
}

.size-opt b {
  font: 600 12.5px/1.3 var(--mono);
}

.size-opt small {
  color: var(--ink-3);
  font-size: 11.5px;
}

.custom-size {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.custom-size label,
.pop-row label {
  display: grid;
  flex: 1;
  gap: 4px;
  color: var(--ink-2);
  font-size: 12.5px;
}

.custom-size .times {
  padding-bottom: 8px;
  color: var(--ink-3);
}

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

.pop-row.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.pop-note {
  padding: 10px 12px;
  border-left: 2px solid var(--c);
  background: var(--c-soft);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.55;
}

.pop-note.is-bad {
  border-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

/* ---- layout ------------------------------------------------------------- */
.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  min-height: 0;
}

.board {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}

.board-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 8px;
}

.tools-group {
  display: flex;
  gap: 8px;
}

.layers {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper);
}

.layers button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
}

.layers button[aria-pressed="false"] {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--ink-3);
}

.layers button[aria-pressed="false"] .plate {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ink-3);
}

.zoom {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper);
}

.zoom button {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  font-size: 14px;
}

.zoom button:hover {
  background: var(--paste);
}

.zoom #zoomFit {
  min-width: 58px;
  border-right: 1px solid var(--rule-2);
  border-left: 1px solid var(--rule-2);
  font-size: 12px;
}

.board-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.pages {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 44px 56px;
  min-width: min-content;
  padding: 30px 34px 44px;
}

.page-wrap {
  position: relative;
  flex: none;
}

/* Crop marks around each sheet, like a proof print. */
.page-wrap::before {
  position: absolute;
  inset: -16px -16px 8px;
  --crop: #8f9399;
  background:
    linear-gradient(var(--crop), var(--crop)) 0 16px / 10px 1px no-repeat,
    linear-gradient(var(--crop), var(--crop)) 16px 0 / 1px 10px no-repeat,
    linear-gradient(var(--crop), var(--crop)) 100% 16px / 10px 1px no-repeat,
    linear-gradient(var(--crop), var(--crop)) calc(100% - 15px) 0 / 1px 10px no-repeat;
  content: "";
  pointer-events: none;
}

.page {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--paper);
  box-shadow: var(--sheet-shadow);
  transform-origin: 0 0;
}

.page-slug {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}

.page-slug b {
  color: var(--ink);
  font-weight: 600;
}

.page-feed {
  position: absolute;
  right: 0;
  left: 0;
  color: #b3b6b0;
  font: 500 2.6mm/1 var(--mono);
  letter-spacing: 0.06em;
  text-align: center;
  pointer-events: none;
}

/* slots */
.slot {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
}

.slot > * {
  pointer-events: none;
}

.s-c {
  position: absolute;
  inset: 0;
  border: 0.3mm dashed var(--c);
}

.s-tick {
  position: absolute;
  background: var(--c);
}

.s-y {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--note-paper, #fff07a);
  box-shadow: 0 0.15mm 0.4mm rgb(0 0 0 / 0.18), 0 1.2mm 2.4mm -1mm rgb(0 0 0 / 0.16);
}

.s-y::before {
  position: absolute;
  inset: 0 0 auto;
  height: min(11mm, 22%);
  background: linear-gradient(to bottom, rgb(0 0 0 / 0.05), rgb(0 0 0 / 0.012));
  content: "";
}

.s-k {
  position: absolute;
  inset: 0;
}

.s-num {
  position: absolute;
  bottom: calc(100% + 1mm);
  left: 0;
  color: var(--ink-3);
  font: 600 2.8mm/1 var(--mono);
  letter-spacing: 0.04em;
}

.s-over {
  position: absolute;
  right: 1mm;
  bottom: 1mm;
  padding: 0.8mm 1.6mm;
  border-radius: 0.6mm;
  background: var(--m);
  color: #fff;
  font: 600 2.8mm/1 var(--sans);
}

.slot.is-used {
  cursor: grab;
}

.slot.is-used:hover .s-y {
  filter: brightness(0.985);
}

.slot.is-sel::after {
  position: absolute;
  inset: -1.4mm;
  border: calc(2.2px / var(--z, 1)) solid var(--m);
  content: "";
  pointer-events: none;
}

.slot.is-sel .s-num {
  color: var(--m);
}

.slot.is-over::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  box-shadow: inset 0 0 0 0.6mm var(--m);
  content: "";
}

.slot.is-drop::after {
  position: absolute;
  inset: -1.4mm;
  border: calc(2px / var(--z, 1)) dashed var(--ink);
  content: "";
}

.slot.is-dragging {
  opacity: 0.35;
}

.slot.is-empty {
  cursor: pointer;
}

.slot.is-empty .s-add {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1mm;
  color: var(--c-ink);
  font-size: 3.2mm;
  opacity: 0;
  transition: opacity 0.15s;
}

.slot.is-empty .s-add b {
  font: 300 9mm/1 var(--sans);
}

.slot.is-empty:hover .s-add,
.slot.is-empty:focus-visible .s-add {
  opacity: 1;
}

.slot.is-empty:hover .s-c {
  background: rgb(0 147 216 / 0.05);
}

.slot.is-empty.is-first .s-add {
  opacity: 0.8;
}

/* layer switches */
.hide-c .s-c,
.hide-c .s-tick,
.hide-c .page-feed { display: none; }

.hide-y .s-y { display: none; }

.hide-k .s-k { display: none; }

.hide-y .slot.is-used .s-c { border-style: solid; }

.board-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--m);
  border-radius: var(--r);
  background: var(--paper);
  font-size: 13.5px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
}

.board-alert b {
  color: var(--m);
}

/* first run */
.intro {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(228 229 224 / 0.82);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.intro-card {
  display: grid;
  gap: 12px;
  width: min(520px, 100%);
  padding: 26px 26px 22px;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--pop-shadow);
}

.intro-card .slug {
  display: flex;
  align-items: center;
  gap: 8px;
}

.intro-card h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.intro-lead,
.intro-foot {
  color: var(--ink-2);
  font-size: 14px;
}

.intro-sizes .size-opt {
  grid-template-rows: 58px auto auto;
}

/* ---- inspector ---------------------------------------------------------- */
.inspector {
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--rule);
  background: var(--paper);
  outline: 0;
}

.ins-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px 18px;
  border-bottom: 1px solid var(--rule-2);
  background: rgb(255 255 255 / 0.94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.ins-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ins-title strong {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.ins-total {
  color: var(--ink-3);
  font-size: 13px;
}

.ins-nav {
  display: flex;
  gap: 2px;
}

.ins-nav .icon-btn {
  font-size: 22px;
}

/* stage: the note enlarged, with dimension lines */
.stage {
  margin: 0;
  padding: 26px 18px 10px;
  background:
    radial-gradient(circle at 1px 1px, rgb(0 0 0 / 0.07) 1px, transparent 1.2px) 0 0 / 12px 12px,
    var(--panel);
  border-bottom: 1px solid var(--rule-2);
}

.stage-inner {
  position: relative;
  margin: 0 auto;
}

.stage-note {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.stage-note .nb {
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.1), 0 10px 22px -8px rgb(0 0 0 / 0.3);
}

.dim {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  pointer-events: none;
}

.dim b {
  padding: 0 5px;
  background: var(--panel);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.dim-w {
  top: -16px;
  right: 0;
  left: 0;
  height: 10px;
  border-right: 1px solid var(--ink-3);
  border-left: 1px solid var(--ink-3);
  background: linear-gradient(var(--ink-3), var(--ink-3)) center / 100% 1px no-repeat;
}

.dim-h {
  top: 0;
  right: -18px;
  bottom: 0;
  width: 10px;
  border-top: 1px solid var(--ink-3);
  border-bottom: 1px solid var(--ink-3);
  background: linear-gradient(var(--ink-3), var(--ink-3)) center / 1px 100% no-repeat;
}

.dim-h b {
  transform: rotate(90deg);
  white-space: nowrap;
}

.stage-cap {
  min-height: 20px;
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
}

.stage-cap.is-bad {
  color: var(--m);
  font-weight: 600;
}

.paper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--rule-2);
}

.paper-label {
  font-size: 13px;
}

.paper-label small {
  display: block;
  color: var(--ink-3);
  font-size: 11.5px;
}

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

.swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgb(0 0 0 / 0.14);
  border-radius: 2px;
  background: var(--sw);
}

.swatch[aria-pressed="true"] {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.swatch.is-custom {
  position: relative;
  overflow: hidden;
  background: conic-gradient(#e4007c, #ffe14a, #0093d8, #1d7c4d, #e4007c);
}

.swatch.is-custom input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.ins-sec {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule-2);
}

.sec-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  font-weight: 600;
}

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

.kind {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 62px;
  padding: 8px 2px 6px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--paper);
  font-size: 12.5px;
  line-height: 1.2;
}

.kind svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.kind:hover {
  border-color: var(--ink-3);
}

.kind[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

/* fields */
.field {
  display: grid;
  gap: 5px;
}

.field > span,
.field-label {
  color: var(--ink-2);
  font-size: 12.5px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-row.three {
  grid-template-columns: 1.2fr 1fr auto;
  align-items: end;
}

.hint {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.list-rows {
  display: grid;
  gap: 6px;
}

.list-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 6px;
}

.list-row .lead {
  color: var(--ink-3);
  font: 600 12px var(--mono);
  text-align: center;
}

.list-row .lead.box {
  width: 13px;
  height: 13px;
  border: 1.4px solid var(--ink-3);
  border-radius: 2px;
}

.list-row .icon-btn {
  width: 30px;
  height: 30px;
  color: var(--ink-3);
}

.add-row {
  justify-self: start;
}

.image-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px dashed var(--rule);
  border-radius: var(--r);
}

.image-box img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: var(--panel);
}

.image-box .grow {
  flex: 1;
  color: var(--ink-2);
  font-size: 12.5px;
}

.image-box .btns {
  display: flex;
  gap: 6px;
}

.style-grid {
  display: grid;
  gap: 12px;
}

.style-line {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.style-line > span {
  color: var(--ink-2);
  font-size: 12.5px;
}

.style-line .seg {
  flex-wrap: wrap;
}

.fonts button {
  font-size: 13.5px;
}

.size-ctl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper);
}

.stepper button {
  width: 30px;
  border: 0;
  background: none;
  font-size: 15px;
}

.stepper button:hover {
  background: var(--paste);
}

.stepper input {
  width: 58px;
  height: 32px;
  border: 0;
  border-right: 1px solid var(--rule-2);
  border-left: 1px solid var(--rule-2);
  font: 13px var(--mono);
  text-align: center;
}

.stepper input:focus {
  outline: 0;
  box-shadow: inset 0 0 0 2px var(--m-soft);
}

.stepper em {
  display: grid;
  place-items: center;
  padding: 0 8px 0 2px;
  color: var(--ink-3);
  font: normal 11.5px var(--mono);
}

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

.ins-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px 8px;
  padding: 14px 18px 26px;
}

.ins-actions .move,
.ins-actions .acts {
  display: flex;
  gap: 4px;
}

.ins-actions .link-btn {
  grid-column: 1 / -1;
  justify-self: start;
  color: var(--ink-2);
}

/* ---- modals ------------------------------------------------------------- */
.modal,
.wizard {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(19 20 22 / 0.42);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 12px;
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--pop-shadow);
}

.modal-card h2 {
  font-size: 22px;
  line-height: 1.3;
}

.modal-lead {
  color: var(--ink-2);
  font-size: 14px;
}

.modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--r);
  background: none;
  font-size: 22px;
  line-height: 1;
}

.modal-x:hover {
  background: var(--paste);
}

.batch-text {
  min-height: 180px;
  font-size: 15px;
}

.batch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}

.batch-count {
  margin-right: auto;
  color: var(--ink-2);
  font: 600 13px var(--mono);
}

/* ---- print wizard ------------------------------------------------------- */
.wz-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1040px, 100%);
  height: min(720px, calc(100dvh - 40px));
  overflow: hidden;
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--pop-shadow);
}

.wz-head {
  position: relative;
  padding: 18px 60px 12px 24px;
}

.wz-head h2 {
  margin-top: 2px;
  font-size: 22px;
}

.wz-head .modal-x {
  top: 14px;
}

.wz-steps {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--rule);
}

.wz-steps button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 14px;
  white-space: nowrap;
}

.wz-steps button b {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
}

.wz-steps button.is-done b {
  border-color: var(--ok);
  background: var(--ok);
  color: #fff;
}

.wz-steps button[aria-current="step"] {
  color: var(--ink);
  font-weight: 600;
}

.wz-steps button[aria-current="step"]::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 3px;
  background: var(--ink);
  content: "";
}

.wz-steps .wz-calib {
  margin-left: auto;
}

.wz-steps .wz-calib svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}

.wz-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  min-height: 0;
}

.wz-text {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px 28px;
}

.wz-text h3 {
  font-size: 20px;
  line-height: 1.35;
}

.wz-text p {
  color: var(--ink-2);
  font-size: 14.5px;
}

.wz-preview {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 24px;
  background: var(--paste);
}

.wz-preview .page-wrap::before {
  display: none;
}

.wz-pages {
  position: relative;
  isolation: isolate;
}

.wz-pages .page-wrap {
  position: absolute;
  top: 0;
  left: 0;
}

.wz-pages .page {
  box-shadow: var(--sheet-shadow);
}

.wz-pages.is-stack::before,
.wz-pages.is-stack::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #fff;
  box-shadow: var(--sheet-shadow);
  content: "";
}

.wz-pages.is-stack::before {
  transform: translate(12px, 12px);
}

.wz-pages.is-stack::after {
  transform: translate(6px, 6px);
}

/* print pages shown on screen (wizard previews) */
.wz-sheet {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--sheet-shadow);
  transform-origin: 0 0;
}

.wz-sheet .pr-svg {
  position: absolute;
  inset: 0;
}

.wz-sheet .pr-note {
  position: absolute;
  overflow: hidden;
}

.wz-sheet .pr-note.has-frame::after {
  position: absolute;
  inset: 0;
  border: 0.2mm solid #8a8f96;
  content: "";
}

.wz-sheet .pr-tag {
  position: absolute;
  right: 0;
  left: 0;
  color: #8a8f96;
  font: 6pt/1 var(--sans);
  text-align: center;
}

.wz-caption {
  position: absolute;
  right: 0;
  bottom: -26px;
  left: 0;
  text-align: center;
}

.spec {
  display: grid;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r);
}

.spec div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
}

.spec div + div {
  border-top: 1px solid var(--rule-2);
}

.spec dt {
  color: var(--ink-3);
}

.spec dd {
  margin: 0;
  font-weight: 600;
}

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

.checklist li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  font-size: 14.5px;
}

.checklist li i {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  font: normal 600 12px var(--mono);
}

.checklist small {
  display: block;
  color: var(--ink-3);
  font-size: 12.5px;
}

.note-box {
  padding: 12px 14px;
  border-left: 3px solid var(--c);
  background: var(--c-soft);
  font-size: 13.5px;
  line-height: 1.6;
}

.note-box.warn {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.note-box.bad {
  border-color: var(--m);
  background: var(--m-soft);
}

.note-box.ok {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.note-box b {
  display: block;
  margin-bottom: 2px;
}

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

.wz-actions .grow {
  flex: 1;
}

.page-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.radio-cards {
  display: grid;
  gap: 8px;
}

.radio-card {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.radio-card input {
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--m);
}

.radio-card b {
  display: block;
  font-size: 14px;
}

.radio-card span {
  color: var(--ink-3);
  font-size: 12.5px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ok);
  font-size: 13px;
  font-weight: 600;
}

.calib-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.noscript {
  padding: 20px;
}

/* ---- narrow screens ----------------------------------------------------- */
@media (max-width: 1080px) {
  .work {
    grid-template-columns: minmax(0, 1fr) 348px;
  }

  .save-state span {
    display: none;
  }
}

@media (max-width: 860px) {
  body.editor {
    display: block;
    height: auto;
    overflow: visible;
  }

  .bar {
    position: sticky;
    top: 0;
    gap: 8px;
    height: 54px;
    padding: 0 10px;
  }

  .bar .brand {
    padding-right: 8px;
  }

  .bar .brand-name,
  .chip-sub,
  .save-state {
    display: none;
  }

  .sheet-chip {
    min-width: 0;
    padding-right: 10px;
  }

  .sheet-pop {
    position: fixed;
    top: 60px;
    left: 8px;
    grid-template-columns: 1fr;
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 72px);
    overflow: auto;
  }

  .pop-sec + .pop-sec {
    border-top: 1px solid var(--rule-2);
    border-left: 0;
  }

  .work {
    display: block;
  }

  .board {
    display: block;
  }

  .board-tools {
    padding: 10px 12px 6px;
  }

  .board-scroll {
    height: 58vh;
    height: 58dvh;
    min-height: 320px;
  }

  .pages {
    padding: 24px 22px 40px;
  }

  .inspector {
    overflow: visible;
    border-top: 1px solid var(--rule);
    border-left: 0;
  }

  .ins-head {
    top: 54px;
  }

  .wz-card {
    height: calc(100dvh - 20px);
  }

  .modal,
  .wizard {
    padding: 10px;
  }

  .wz-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    overflow-y: auto;
  }

  .wz-preview {
    order: -1;
    height: 210px;
  }

  .wz-text {
    overflow: visible;
  }

  .wz-steps {
    overflow-x: auto;
    padding: 0 10px;
  }

  .wz-steps span {
    display: none;
  }

  .wz-steps button[aria-current="step"] span {
    display: inline;
  }
}

@media (max-width: 420px) {
  .kinds {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .layers button {
    padding: 0 7px;
  }

  .tools-group .btn {
    padding: 0 9px;
  }
}
