/* Little Prints additions to app.css (ported from Little Screens): the dashboard's event, terminal
   and alert views, and the print portal. Same tokens, no inline styles (the CSP forbids them). */

#view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#view > .page-head,
#view > .back-link {
  margin: 0;
}

.lp-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

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

.lp-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

a.lp-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.lp-card h3 {
  margin: 0;
  font-size: 16px;
}

.lp-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.lp-stat {
  display: flex;
  flex-direction: column;
}

.lp-stat strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.lp-code-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.lp-code {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.lp-qr {
  width: 160px;
  height: 160px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.lp-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--line-soft);
  color: var(--ink-2);
}

.lp-pill.live,
.lp-pill.ok {
  background: #e7f6ec;
  color: #1b6b37;
}

.lp-pill.warn {
  background: var(--warn-bg);
  color: var(--warning);
}

.lp-pill.bad {
  background: #fdeceb;
  color: var(--offline);
}

.lp-meter {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--line-soft);
  overflow: hidden;
}

.lp-meter > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.lp-meter.low > span {
  background: var(--warning);
}

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

.lp-form-row > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* A form whose labels sit above their fields. */
.lp-stacked > label:not(.login-check) {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lp-form-row > label.login-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 14px;
  color: var(--ink);
}

.lp-form-row > .lp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

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

/* Branding: a preview of the portal's header (drawn with the portal's own classes), a colour picker
   and the logo's buttons. */
.lp-brand-preview {
  --brand: var(--primary);
  --on-brand: var(--on-primary);
  padding: 20px;
  border-radius: 14px;
}

.lp-brand-name {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.lp-colour-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  min-height: 40px;
  color: var(--ink);
}

.lp-colour {
  width: 56px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.lp-colour:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.lp-logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.lp-location {
  margin-top: 6px;
}

.lp-location label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.lp-location-row {
  display: flex;
  gap: 8px;
}

.lp-location-row .field {
  flex: 1;
  min-width: 0;
}

/* ---------- The print portal ---------- */

/* The event's brand colour and the text on it. portal.js sets them (and --primary, so buttons follow)
   from the event's branding; without any, they're Little Prints' own. */
.portal-page {
  --brand: var(--primary);
  --on-brand: var(--on-primary);
}

.portal-brand {
  background: var(--brand);
  color: var(--on-brand);
}

.portal-brand-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 16px 22px;
}

.portal-brand-id {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* Logos are made for white, so they sit on a white tile whatever the brand colour. Wide ones get a
   wider tile rather than shrinking to nothing. */
.portal-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  max-width: 168px;
  height: 56px;
  padding: 7px;
  border-radius: 14px;
  background: #ffffff;
}

.portal-logo img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 154px;
  object-fit: contain;
}

.portal-brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.portal-tagline {
  margin: 3px 0 0;
  font-size: 14px;
  opacity: 0.88;
}

.portal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.portal-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 15%, transparent);
  font-size: 13px;
  font-weight: 600;
}

.portal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7ee2a8;
}

.portal-dot.warn {
  background: #f2b661;
}

.portal-dot.off {
  background: #f28b82;
}

.portal {
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 16px 32px;
}

/* The code page: before there's an event, so Little Prints' own, in its own blue. */
.portal-code {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 440px;
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
  margin: 0 auto;
}

.portal-code-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.portal-code-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
}

.portal-code-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.portal-code-form h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.portal-code-form h1 + p {
  margin: 0 0 18px;
  font-size: 16px;
  color: var(--ink-2);
}

.portal-code-form label {
  font-size: 15px;
  font-weight: 700;
}

.portal-code-input {
  min-height: 72px;
  border: 2px solid var(--primary);
  border-radius: 16px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.portal-code-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.portal-code .portal-code-go {
  min-height: 58px;
  margin-top: 14px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 800;
}

.portal-code-help {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
}

.portal-code-help svg {
  flex: 0 0 22px;
}

.portal-code-help p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}

/* For anyone who isn't a guest: what this is, and the way in for the event team. */
.portal-code-staff {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 24px;
  margin: -20px 0 0;
  text-align: center;
  font-size: 14px;
}

.portal-code-staff a {
  color: var(--muted);
}

.portal-code-staff .portal-code-about {
  color: var(--link);
  font-weight: 700;
}

/* Home: one column on a phone; on a laptop, your name and the upload beside your documents. */
.portal-home {
  display: grid;
  grid-template-areas: 'side' 'docs' 'privacy';
  gap: 24px;
}

.portal-side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-side .message {
  margin: 0;
}

.portal-docs {
  grid-area: docs;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.portal-docs h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
}

.portal-privacy {
  grid-area: privacy;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.portal-privacy p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.portal-delete-all {
  align-self: flex-start;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--offline);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

@media (min-width: 900px) {
  .portal,
  .portal-brand-inner {
    max-width: 1160px;
  }

  .portal {
    padding: 28px 32px 40px;
  }

  .portal-brand-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 30px 32px 28px;
  }

  .portal-brand h1 {
    font-size: 32px;
  }

  .portal-logo {
    height: 72px;
    min-width: 72px;
    max-width: 200px;
    padding: 9px;
    border-radius: 18px;
  }

  .portal-logo img {
    max-width: 182px;
  }

  .portal-home {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: 'side docs' 'privacy docs';
    align-items: start;
    column-gap: 32px;
  }
}

.portal-name {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.portal-name label {
  font-size: 15px;
  font-weight: 700;
}

.portal-name .field {
  min-height: 48px;
  font-size: 16px;
}

/* Choosing a file: one big button in the brand colour, which is also where files can be dropped. */
.portal-drop {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 20px;
  border: 2px dashed transparent;
  border-radius: 18px;
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.14);
  cursor: pointer;
}

.portal-drop:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.portal-drop.over {
  border-color: var(--on-brand);
}

.portal-drop-icon {
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: color-mix(in srgb, currentColor 18%, transparent);
}

.portal-drop-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.portal-drop-text strong {
  font-size: 19px;
  font-weight: 800;
}

.portal-drop-text span {
  font-size: 13px;
  opacity: 0.9;
}

.portal-credit {
  padding: 0 16px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.portal-credit a {
  color: inherit;
}

/* ---------- Your documents ----------

   A row each on a phone (picture, then words and buttons); cards in a grid on a laptop. */

.docs-head {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.docs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 22px;
  border: 2px dashed var(--line-strong);
  border-radius: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-2);
}

.docs-empty strong {
  font-size: 15px;
  color: var(--ink);
}

.doc-card {
  display: flex;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.doc-thumb {
  flex: 0 0 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 92px;
  padding: 6px;
  border: 0;
  border-radius: 10px;
  background: var(--table);
}

button.doc-thumb {
  cursor: pointer;
}

.doc-thumb img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.16);
}

.doc-blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.doc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.doc-name {
  display: flex;
  flex-direction: column;
}

.doc-name strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.doc-name span {
  font-size: 12px;
  color: var(--muted);
}

.doc-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.doc-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.doc-status.tone-brand {
  color: var(--ink);
}

.doc-status.tone-brand .doc-dot {
  background: var(--brand);
}

.doc-status.tone-ok {
  color: var(--online);
}

.doc-status.tone-warn {
  color: var(--warning);
}

.doc-status.tone-bad {
  color: var(--offline);
}

.doc-status.tone-muted {
  color: var(--ink-2);
}

.doc-status.tone-muted .doc-dot {
  background: var(--muted);
}

.doc-detail {
  margin: -2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Uploading fills; anything else under way is a bar that moves. */
.doc-bar {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.doc-bar-fill,
.doc-bar-busy {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: var(--brand);
}

.doc-bar-fill {
  left: 0;
  width: 0;
  transition: width 0.2s;
}

.doc-bar-busy {
  width: 40%;
  animation: doc-busy 1.4s ease-in-out infinite;
}

@keyframes doc-busy {
  from {
    left: -40%;
  }

  to {
    left: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .doc-bar-busy {
    left: 30%;
    animation: none;
  }
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.doc-actions .button {
  min-height: 44px;
  border-radius: 12px;
  font-size: 14px;
}

.doc-actions .button svg {
  flex: 0 0 auto;
}

.doc-icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.doc-icon-button:hover {
  background: var(--hover-2);
  color: var(--ink);
}

@media (min-width: 900px) {
  .docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
  }

  .doc-card {
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
  }

  .doc-thumb {
    flex: 0 0 auto;
    height: 180px;
    padding: 14px;
    border-radius: 0;
  }

  .doc-main {
    padding: 12px 14px 14px;
  }
}

/* "Deleted …  Undo" */
.portal-toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(440px, calc(100% - 32px));
  min-height: 56px;
  padding: 6px 6px 6px 18px;
  border-radius: 14px;
  background: #1f2733;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.3);
  transform: translateX(-50%);
}

.portal-toast span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.portal-toast button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #c9d3ff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

/* ---------- A document's progress (job-status.js) ---------- */

.status .status-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--paper);
}

.status-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 600px;
  margin: 0 auto;
  padding: 18px 16px 24px;
}

.status-hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-2);
}

.status-hero.tone-brand .status-icon {
  background: var(--brand);
  color: var(--on-brand);
}

.status-hero.tone-warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.status-hero.tone-warn .status-icon {
  background: var(--warning-dot);
  color: #ffffff;
}

.status-hero.tone-ok {
  border-color: color-mix(in srgb, var(--online) 30%, transparent);
  background: var(--ok-bg);
}

.status-hero.tone-ok .status-icon {
  background: var(--online);
  color: #ffffff;
}

.status-hero.tone-bad {
  border-color: color-mix(in srgb, var(--offline) 30%, transparent);
  background: var(--bad-bg);
}

.status-hero.tone-bad .status-icon {
  background: var(--offline);
  color: #ffffff;
}

.status-words h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.status-words p {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--ink-2);
}

.status-queue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  background: var(--paper);
  color: var(--muted);
}

.queue-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-align: center;
  color: var(--ink-2);
}

.queue-sheet {
  width: 30px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
}

.queue-item.mine {
  font-weight: 800;
  color: var(--ink);
}

.queue-item.mine .queue-sheet {
  border: 2px solid var(--brand);
  box-shadow: inset 0 7px 0 var(--brand);
}

.status-bar {
  height: 10px;
}

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

.status-stats div {
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.status-stats dt {
  font-size: 12px;
  color: var(--ink-2);
}

.status-stats dd {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.status-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.status-steps {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 18px;
}

.status-step:last-child {
  padding-bottom: 0;
}

/* The line down to the next step: green once this one's done. */
.status-step:not(:last-child)::before {
  content: '';
  position: absolute;
  top: 30px;
  bottom: 2px;
  left: 13px;
  width: 2px;
  background: var(--line);
}

.status-step.done:not(:last-child)::before {
  background: var(--online);
}

.step-dot {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: #ffffff;
}

.status-step.done .step-dot {
  border-color: var(--online);
  background: var(--online);
}

.status-step.problem .step-dot {
  border-color: var(--warning-dot);
  background: var(--warning-dot);
}

.status-step.current .step-dot {
  border: 3px solid var(--brand);
}

.status-step.current .step-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
}

.step-words {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 3px;
}

.step-words strong {
  font-size: 15px;
  font-weight: 700;
}

.status-step.upcoming .step-words strong {
  color: var(--muted);
}

.step-words span {
  font-size: 13px;
  color: var(--muted);
}

.status-step.problem .step-words span {
  color: var(--warning);
}

.status-step time {
  padding-top: 4px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.status-where {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-pin {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--ink);
}

.status-where div {
  display: flex;
  flex-direction: column;
}

.status-where span {
  font-size: 13px;
  color: var(--muted);
}

.status-where strong {
  font-size: 16px;
  font-weight: 800;
}

.status-foot {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.status-foot > * {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.status-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-buttons:empty,
.status-note:empty {
  display: none;
}

.status-buttons .button {
  gap: 10px;
  min-height: 54px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
}

.status-buttons .status-cancel {
  color: var(--offline);
}

.status-note {
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Print settings (print-setup.js) ----------

   Over the whole page. Phone: the pages in a row to swipe through, the options below, Print stuck
   to the bottom. 900 px and wider: pages down the side, one big page, the options on the right. */

.portal-page {
  /* What paper sits on, the groove that buttons sit in, and a button raised out of it. */
  --table: #e9ecf1;
  --track: #eceff3;
  --raised: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .portal-page {
    --table: #0c0f14;
    --track: #111419;
    --raised: #2d3441;
  }
}

/* Words for narrow and wide screens, where they differ. */
.wide-only {
  display: none;
}

body.screen-open {
  overflow: hidden;
}

.setup {
  --slide-h: min(46vh, 420px);
  --slide-w: calc(var(--slide-h) / 1.414);
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
}

/* Focused when it opens (for screen readers), with nothing to show for it. */
.setup:focus {
  outline: none;
}

.setup-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 60px;
  padding: 0 16px 0 6px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.setup-back {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.setup-back:hover {
  background: var(--hover);
}

.setup-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.setup-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-title span {
  font-size: 12px;
  color: var(--muted);
}

.setup-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Whatever's scrolled to (tabbing through the options) stays clear of the Print bar. */
  scroll-padding-bottom: 150px;
  background: var(--table);
}

/* --- The pages --- */

.setup-rail {
  display: none;
}

.setup-preview {
  padding: 16px 0 24px;
}

.setup-carousel {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 4px 0 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.setup-carousel::-webkit-scrollbar {
  display: none;
}

/* Room either side, so the first and last pages can sit in the middle. */
.setup-carousel::before,
.setup-carousel::after {
  content: '';
  flex: 0 0 calc(50% - var(--slide-w) / 2 - 16px);
}

.setup-slide {
  position: relative;
  flex: 0 0 var(--slide-w);
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--slide-h);
  padding: 0;
  border: 0;
  background: transparent;
  scroll-snap-align: center;
  cursor: zoom-in;
}

.setup-slide img,
.setup-blank {
  max-width: 100%;
  max-height: 100%;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1), 0 10px 24px rgba(16, 24, 40, 0.16);
  transition: opacity 0.2s, filter 0.2s;
}

.setup-slide img {
  display: block;
}

/* A page without a preview: a blank sheet with its number. */
.setup-blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  color: #566173;
  font-size: 13px;
}

.setup-blank strong {
  font-size: 15px;
  color: #1f2733;
}

.setup-left-out {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.setup-slide.left-out img,
.setup-slide.left-out .setup-blank,
.setup-thumb.left-out img,
.setup-thumb.left-out .setup-blank {
  opacity: 0.3;
}

.setup-slide.left-out .setup-left-out {
  opacity: 1;
}

/* Black and white: so is the preview. */
.setup-mono .setup-slide img,
.setup-mono .setup-thumb img,
.setup-mono .setup-zoom img {
  filter: grayscale(1);
}

.setup-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.setup-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.setup-nav button:disabled {
  opacity: 0.4;
  cursor: default;
}

.setup-where {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 150px;
}

.setup-where strong {
  font-size: 15px;
  font-weight: 800;
}

.setup-where span {
  font-size: 12px;
  color: var(--ink-2);
}

/* A page full size, to read it. */
.setup-zoom {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  background: rgba(12, 15, 20, 0.95);
}

.setup-zoom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 20px;
  color: #ffffff;
  font-weight: 700;
}

.setup-zoom-bar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
}

.setup-zoom-scroll {
  flex: 1;
  overflow: auto;
  padding: 0 12px 24px;
}

.setup-zoom-scroll img {
  display: block;
  width: min(1200px, max(100%, 860px));
  margin: 0 auto;
  background: #ffffff;
}

/* --- The options --- */

.setup-panel {
  display: flex;
  flex-direction: column;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.06);
}

.setup-options {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: 6px 20px 20px;
}

.setup-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: 66px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}

.setup-row:first-child {
  border-top: 0;
}

.setup-row-label {
  font-size: 15px;
  font-weight: 700;
}

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

.setup-none {
  margin: 16px 0;
  color: var(--ink-2);
}

/* Buttons side by side in a groove, the chosen one raised. */
.choice {
  display: flex;
  gap: 4px;
  width: 210px;
  padding: 4px;
  border-radius: 12px;
  background: var(--track);
}

.choice button {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.choice button[aria-pressed='true'] {
  background: var(--raised);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.16), 0 1px 1px rgba(16, 24, 40, 0.06);
}

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

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--track);
}

.stepper button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 42px;
  border: 0;
  border-radius: 9px;
  background: var(--raised);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1);
  cursor: pointer;
}

.stepper button:disabled {
  opacity: 0.4;
  cursor: default;
}

.stepper input {
  width: 56px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 19px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.setup-printers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  flex-basis: 100%;
  gap: 10px;
}

.printer-choice,
.setup-printer-one {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
}

.printer-choice {
  min-height: 64px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.printer-choice[aria-pressed='true'] {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
}

.setup-printer-one {
  align-items: flex-end;
  text-align: right;
}

.printer-choice strong,
.setup-printer-one strong {
  font-size: 14px;
  font-weight: 800;
}

.printer-choice > span,
.setup-printer-one > span {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.printer-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.state-dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--online);
}

.state-dot.warn {
  background: var(--warning-dot);
}

.state-dot.off {
  background: var(--offline);
}

.setup-range {
  display: flex;
  flex-direction: column;
  flex-basis: 100%;
  gap: 6px;
}

.setup-range label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.setup-range .field {
  min-height: 50px;
  font-size: 17px;
  font-weight: 700;
}

.setup-range > span {
  font-size: 13px;
  color: var(--muted);
}

/* Print, always in reach: stuck to the bottom while the options scroll. */
.setup-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.setup-summary {
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--ink-2);
}

.setup-summary:empty {
  display: none;
}

.setup-error {
  margin: 0;
}

.setup .setup-print {
  gap: 10px;
  width: 100%;
  min-height: 56px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 800;
}

/* --- Laptops: pages down the side, one big page, options on the right --- */

@media (min-width: 900px) {
  .wide-only {
    display: inline;
  }

  .narrow-only {
    display: none;
  }

  .setup {
    --slide-h: min(calc(100vh - 220px), 880px);
  }

  .setup-body {
    flex-direction: row;
    overflow: hidden;
  }

  .setup-rail {
    flex: 0 0 156px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 18px 12px 24px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--paper);
  }

  .setup-preview {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 24px 0;
  }

  .setup-panel {
    flex: 0 0 400px;
    overflow-y: auto;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }

  .setup-options {
    padding: 12px 24px 20px;
  }

  .setup-row {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 0;
    padding: 12px 0;
    border-top: 0;
  }

  .setup-row-label {
    font-size: 14px;
  }

  .choice {
    width: auto;
  }

  .stepper {
    align-self: flex-start;
  }

  .setup-printer-one {
    align-items: flex-start;
    text-align: left;
  }

  .setup-foot {
    padding: 14px 24px 22px;
  }
}

.setup-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.setup-thumb-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 108px;
  height: 148px;
  padding: 5px;
  border: 2px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.setup-thumb-page[aria-current='true'] {
  border-color: var(--brand);
}

.setup-thumb-page img,
.setup-thumb-page .setup-blank {
  max-width: 100%;
  max-height: 100%;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.16);
}

.setup-thumb-page .setup-blank {
  font-size: 11px;
}

.setup-thumb-page .setup-blank strong {
  font-size: 12px;
}

.setup-thumb-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.setup-thumb-pick {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.setup-thumb-pick input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--brand);
}

.setup-choosing .setup-thumb-pick {
  display: flex;
}

.setup-choosing .setup-thumb-num {
  display: none;
}

/* A terminal's last check: one line per step, problems stand out. */
.lp-checks {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.lp-checks li {
  padding: 3px 0;
}
.lp-checks li.bad {
  color: var(--offline);
}
