/* Staging print UI. Every value comes from DESIGN.md; change it there first. */

:root {
  color-scheme: light;

  --desk: #f1f1ee;
  --paper: #fdfdfb;
  --field: #ffffff;
  --tray: #f6f6f3;

  --text: #1b1b19;
  --text-2: #4a4945;
  --text-3: #6b6a64;

  --rule: rgb(27 27 25 / 0.1);
  --rule-strong: rgb(27 27 25 / 0.16);
  --line: #8a8983;

  --ink: #22409a;
  --ink-hover: #1a3380;
  --ink-wash: #eef1f8;
  --on-ink: #ffffff;

  --ok: #1d6b3d;
  --warn: #8a5200;
  --bad: #b3261e;

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

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
  --s12: 48px;
  --s16: 64px;

  --r-sheet: 4px;
  --r-control: 4px;
  --r-mark: 2px;
  --shadow-sheet: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-float: 0 8px 24px rgb(0 0 0 / 0.08);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 140ms;
  --t-enter: 320ms;

  --control-h: 40px;
  --page-max: 1200px;
  --gutter: 32px;
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }
}

/* Base */

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd,
figure {
  margin: 0;
  padding: 0;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

ol,
ul {
  list-style: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--ease);
}

a:hover {
  color: var(--ink-hover);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -48px;
  z-index: 10;
  padding: var(--s2) var(--s3);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
}

.skip:focus {
  top: var(--s2);
}

/* Top bar */

.topbar {
  border-bottom: 1px solid var(--rule-strong);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--s3);
  max-width: var(--page-max);
  height: 56px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.wordmark {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--text);
}

.env {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-left: auto;
}

@media (max-width: 420px) {
  .env {
    display: none;
  }

  .topbar__nav {
    gap: var(--s1);
  }
}

.demo-note {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.demo-note p {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s2) var(--gutter);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
}

/* Page */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s10) var(--gutter) var(--s16);
}

.page:focus {
  outline: none;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s4);
  margin-bottom: var(--s6);
}

.page-head--stack {
  flex-direction: column;
  align-items: flex-start;
}

.title {
  font-size: 28px;
  line-height: 32px;
  font-weight: 500;
}

.title:focus {
  outline: none;
}

.page-head__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

.lede {
  max-width: 36rem;
  margin-top: var(--s2);
  color: var(--text-2);
}

@media (max-width: 640px) {
  .page {
    padding-top: var(--s8);
  }

  .title {
    font-size: 24px;
    line-height: 28px;
  }
}

/* Sheets */

.sheet {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow-sheet);
}

.boxes {
  display: grid;
  gap: var(--s6);
}

.box__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s6);
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--rule);
}

.box__id {
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.box__id:focus {
  outline: none;
}

.box__status {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
}

.box__fw {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

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

.dot--on {
  background: var(--ok);
  border-color: var(--ok);
}

.box__body {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  padding: var(--s6);
}

.box__print {
  display: grid;
  align-content: start;
  gap: var(--s5);
  padding-right: var(--s8);
}

.box__jobs {
  min-width: 0;
  padding-left: var(--s8);
  border-left: 1px solid var(--rule);
}

@media (max-width: 880px) {
  .box__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .box__print {
    padding-right: 0;
  }

  .box__jobs {
    margin-top: var(--s8);
    padding-top: var(--s6);
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
  }
}

@media (max-width: 640px) {
  .box__head,
  .box__body {
    padding-left: var(--s4);
    padding-right: var(--s4);
  }

  .box__fw {
    width: 100%;
    margin-left: 0;
  }
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
}

.section-title {
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
}

.section-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

/* Fields */

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

.label {
  margin-bottom: var(--s2);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-2);
}

.optional {
  margin-left: var(--s1);
  font-size: 13px;
  color: var(--text-3);
}

.input {
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--s3);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-size: 16px;
  line-height: 24px;
  transition: border-color var(--t-fast) var(--ease);
}

.input:hover {
  border-color: var(--text-2);
}

.input:focus-visible {
  border-color: var(--ink);
  outline-offset: 1px;
}

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

.input--mono {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input--mono::placeholder {
  text-transform: none;
  letter-spacing: 0;
}

.input--copies {
  width: 96px;
  font-variant-numeric: tabular-nums;
}

.hint {
  margin-top: var(--s1);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-3);
}

.msg {
  font-size: 13px;
  line-height: 20px;
}

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

.msg--note {
  color: var(--text-2);
}

.notice {
  margin-bottom: var(--s6);
  padding: var(--s3) var(--s4);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-control);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-2);
}

.notice--warn {
  border-color: var(--warn);
  color: var(--warn);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: var(--control-h);
  padding: 0 var(--s4);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--ink);
  color: var(--on-ink);
}

.btn--primary:hover:not(:disabled) {
  background: var(--ink-hover);
  color: var(--on-ink);
}

.btn--secondary {
  background: var(--paper);
  border-color: var(--line);
  color: var(--text);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--tray);
  color: var(--text);
}

.btn--quiet {
  color: var(--text-2);
}

.btn--quiet:hover:not(:disabled) {
  background: var(--tray);
  color: var(--text);
}

.btn--danger {
  background: var(--paper);
  border-color: var(--bad);
  color: var(--bad);
}

.btn--danger:hover:not(:disabled) {
  background: var(--tray);
}

.btn--small {
  height: 32px;
  padding: 0 var(--s3);
  font-size: 14px;
}

.btn--secondary[aria-current="page"] {
  background: var(--tray);
}

.btn:disabled {
  background: var(--tray);
  border-color: var(--rule-strong);
  color: var(--text-3);
  cursor: not-allowed;
}

.textbtn {
  height: 24px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--r-mark);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease);
}

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

.textbtn:disabled {
  color: var(--text-3);
  text-decoration: none;
  cursor: default;
}

/* Printers */

.printer-slot {
  display: grid;
  gap: var(--s3);
}

.printers legend {
  margin-bottom: var(--s2);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-2);
}

.printer {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: var(--s3);
  padding: var(--s3);
  background: var(--field);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-control);
  cursor: pointer;
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}

.printer + .printer {
  margin-top: var(--s2);
}

.printer:hover {
  border-color: var(--line);
}

.printer.is-selected {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.printer input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--ink);
}

.printer__name {
  display: block;
  overflow-wrap: anywhere;
}

.printer__langs {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.printer__note {
  display: block;
  margin-top: var(--s1);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
}

.printer.is-disabled {
  background: var(--tray);
  cursor: default;
}

.printer.is-disabled:hover {
  border-color: var(--rule-strong);
}

.printer.is-disabled .printer__name {
  color: var(--text-2);
}

/* Drop zone and staged file */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 136px;
  padding: var(--s5) var(--s4);
  background: var(--tray);
  border: 1px dashed var(--line);
  border-radius: var(--r-control);
  text-align: center;
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.dropzone:hover {
  border-color: var(--text-2);
}

.file-slot.is-over .dropzone,
.file-slot.is-over .staged {
  background: var(--ink-wash);
  border-style: solid;
  border-color: var(--ink);
}

.dropzone .icon {
  margin-bottom: var(--s2);
  color: var(--text-3);
}

.dropzone__title {
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
}

.dropzone__or {
  font-weight: 400;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.dropzone__hint {
  margin-top: var(--s1);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-3);
}

.only-touch {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .only-touch {
    display: inline;
  }

  .only-pointer {
    display: none;
  }
}

.staged {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--s3);
  min-height: 56px;
  padding: var(--s2) var(--s3);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
}

.staged .icon {
  color: var(--text-3);
}

.staged__text {
  min-width: 0;
}

.staged__name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staged__size {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

.print-actions {
  display: flex;
  align-items: flex-end;
  gap: var(--s3);
}

.print-actions .btn {
  flex: 1;
}

.upload {
  display: grid;
  gap: var(--s2);
}

.upload progress {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--rule-strong);
  border: 0;
  border-radius: 0;
  color: var(--ink);
}

.upload progress::-webkit-progress-bar {
  background: var(--rule-strong);
}

.upload progress::-webkit-progress-value {
  background: var(--ink);
}

.upload progress::-moz-progress-bar {
  background: var(--ink);
}

.upload__label {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
}

/* Job ledger */

.box__body .section-head {
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule-strong);
}

.ledger > li {
  border-bottom: 1px solid var(--rule);
}

.job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name mark"
    "meta action";
  align-items: center;
  column-gap: var(--s4);
  row-gap: var(--s1);
  min-height: 64px;
  padding: var(--s3) 0;
}

.job.has-detail {
  grid-template-areas:
    "name mark"
    "meta action"
    "detail detail";
}

.job__name {
  grid-area: name;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job__mark {
  grid-area: mark;
  justify-self: end;
}

.job__meta {
  grid-area: meta;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.job__action {
  grid-area: action;
  justify-self: end;
  min-height: 24px;
}

.job__detail {
  grid-area: detail;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
}

.job__detail.is-bad {
  color: var(--bad);
}

.job.is-new {
  animation: fade var(--t-enter) var(--ease) both;
}

.job:focus {
  outline: none;
}

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

.running {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink);
}

.ticks {
  display: inline-grid;
  grid-auto-flow: column;
  gap: var(--s1);
}

.ticks i {
  display: block;
  width: 8px;
  height: 8px;
  border: 1px solid var(--line);
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.ticks i.is-done {
  background: var(--text-2);
  border-color: var(--text-2);
}

.ticks i.is-now {
  background: var(--ink);
  border-color: var(--ink);
}

.stamp {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: var(--r-mark);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

.stamp--ok {
  color: var(--ok);
}

.stamp--bad {
  color: var(--bad);
}

/* Empty, loading, error */

.empty {
  padding: var(--s5) 0 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-2);
}

.loading {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-3);
}

.box__jobs .loading {
  padding-top: var(--s5);
}

.inline-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  padding-top: var(--s5);
}

.state-block {
  display: grid;
  justify-items: start;
  gap: var(--s3);
  padding: var(--s8) var(--s6);
}

.state-block__title {
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
}

.state-block p {
  max-width: 36rem;
  color: var(--text-2);
}

/* Claim */

.claim-view {
  max-width: 880px;
}

.claim {
  display: grid;
  grid-template-columns: minmax(0, 560px) 280px;
  align-items: start;
  gap: var(--s10);
}

.claim__form {
  display: grid;
  gap: var(--s5);
  padding: var(--s8);
}

.claim__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3) var(--s5);
  padding-top: var(--s1);
}

.fp {
  max-width: 40ch; /* eight groups of four per line, like the slip */
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

@media (max-width: 880px) {
  .claim {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s8);
  }
}

@media (max-width: 640px) {
  .claim__form {
    padding: var(--s5) var(--s4);
  }
}

/* The slip drawing */

.slip-figure {
  display: grid;
  gap: var(--s3);
  max-width: 320px;
}

.slip {
  display: grid;
  gap: var(--s4);
  padding: var(--s5);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-mark);
  box-shadow: var(--shadow-sheet);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

.slip__head {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
  color: var(--text);
}

.slip__body {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: var(--s4);
}

.qr {
  position: relative;
  width: 72px;
  height: 72px;
  background: var(--tray);
}

.qr i {
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--paper);
  border: 4px solid var(--text);
}

.qr i::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  background: var(--text);
}

.qr .qr__tl {
  top: 0;
  left: 0;
}

.qr .qr__tr {
  top: 0;
  right: 0;
}

.qr .qr__bl {
  bottom: 0;
  left: 0;
}

.slip__rows {
  display: grid;
  gap: var(--s3);
}

.slip__row {
  display: grid;
  gap: var(--s1);
}

.bar {
  display: block;
  height: 8px;
  background: var(--rule-strong);
}

.bar--short {
  width: 64%;
}

.slip__row--code {
  color: var(--ink);
}

.slip__row--code .bar {
  background: var(--ink);
}

.slip__fp {
  display: grid;
  gap: var(--s1);
}

.slip__fp .bar + .bar {
  width: 82%;
}

.slip-figure figcaption {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
}

/* Dialog */

.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow-float);
  color: var(--text);
}

.dialog::backdrop {
  background: rgb(27 27 25 / 0.24);
}

.dialog__body {
  display: grid;
  gap: var(--s3);
  padding: var(--s6);
}

.dialog__title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
}

.dialog__body p {
  color: var(--text-2);
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s2);
  margin-top: var(--s3);
}

/* Motion */

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.enter {
  animation: enter var(--t-enter) var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .enter,
  .job.is-new {
    animation: none;
  }

  .btn:active:not(:disabled) {
    transform: none;
  }
}
