/*
 * foilo's look, shared by the site and the hub: Dash0's near-black, white
 * type, one accent. Pico's dark theme under it, re-pointed at our tokens;
 * everything else here is the few pieces Pico does not have. One font, Mona
 * Sans (SIL OFL), served from our own origin — nothing loads from anyone
 * else. Each app adds only what is its own (the site's hero, the hub's tables).
 */
@font-face {
  font-family: 'Mona Sans';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('/assets/mona-sans.8ki275q1cegh.woff2') format('woff2');
}

@font-face {
  font-family: 'Mona Sans';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('/assets/mona-sans.qup1xb7kotxj.woff2') format('woff2');
}

:root[data-theme='dark'] {
  --accent: #35e0c1;
  --accent-ink: #04221c;
  --accent-soft: rgb(53 224 193 / 12%);
  --surface: #161616;
  --line: #262626;
  --line-strong: #353535;
  --muted: #9a9a9a;
  /* The dimmest text colour: still 5.6:1 on the page, 5.2:1 on a card (WCAG AA wants 4.5:1). */
  --faint: #8a8a8a;
  /* Chrome on Linux resolves bare ui-monospace to a serif; name real faces first. */
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'DejaVu Sans Mono', Menlo, monospace;

  --pico-font-family: 'Mona Sans', system-ui, sans-serif;
  --pico-background-color: #0e0e0e;
  --pico-color: #e8e8e8;
  --pico-muted-color: var(--muted);
  --pico-muted-border-color: var(--line);
  --pico-card-background-color: var(--surface);
  --pico-primary: var(--accent);
  --pico-primary-hover: #5ceed3;
  --pico-primary-background: var(--accent);
  --pico-primary-hover-background: #5ceed3;
  --pico-primary-inverse: var(--accent-ink);
  --pico-primary-focus: rgb(53 224 193 / 35%);
  --pico-form-element-background-color: #121212;
  --pico-form-element-border-color: var(--line-strong);
  --pico-form-element-focus-color: var(--accent);
  --pico-h1-color: #fff;
  --pico-h2-color: #fff;
  --pico-h3-color: #fff;

  /*
   * Pico grows the root font from 100% to 131.25% across its breakpoints,
   * which is what made every line look oversized on a wide screen. One size.
   */
  --pico-font-size: 100%;
  --pico-line-height: 1.6;
}

/* Pico drops the side padding from 768px on, expecting its own narrower widths. */
.container {
  max-width: 74.5rem;
  padding-inline: 1.25rem;
}

body {
  background-image: radial-gradient(rgb(255 255 255 / 4.5%) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ---- Type ---------------------------------------------------------------- */

h1,
h2 {
  font-weight: 500;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  line-height: 1.1;
}

h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
}

h3 {
  margin-bottom: 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

p {
  color: var(--muted);
}

strong {
  color: #fff;
  font-weight: 600;
}

.accent {
  color: var(--accent);
}

.lead {
  max-width: 40rem;
  font-size: 1.125rem;
}

.note {
  font-size: 0.875rem;
  color: var(--faint);
}

.wordmark {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  text-decoration: none;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.25rem 0.55rem;
  font: 600 0.6875rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.eyebrow-accent {
  color: var(--accent);
  border-color: rgb(53 224 193 / 40%);
  background: var(--accent-soft);
}

/* ---- Calls to action ----------------------------------------------------- */

/* Links that act as calls to action. Links, not buttons: they navigate. */
.cta,
button.cta {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 0.55rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
}

.cta:hover {
  color: var(--accent-ink);
  background: var(--pico-primary-hover);
  border-color: var(--pico-primary-hover);
}

.cta.outline {
  color: #fff;
  background: transparent;
  border-color: var(--line-strong);
}

.cta.outline:hover {
  border-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* ---- Header -------------------------------------------------------------- */

/* Dash0's nav: a framed bar that stays at the top while the page scrolls. */
header.container {
  position: sticky;
  top: 0.75rem;
  z-index: 10;
  padding-block: 0;
}

header nav {
  padding-inline: 1.25rem;
  background: rgb(22 22 22 / 85%);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

header nav li {
  padding-block: 0.625rem;
}

header nav a {
  font-size: 0.9375rem;
  white-space: nowrap;
}

header nav a:not(.cta, .wordmark) {
  color: var(--muted);
}

header nav a:not(.cta, .wordmark):hover {
  color: #fff;
}

header nav .cta {
  padding: 0.35rem 0.8rem;
}

/* On a phone the bar holds the wordmark and the two buttons; the anchors are one scroll away anyway. */
@media (width < 48rem) {
  header nav li:has(> a[href^='/#']:not(.cta)) {
    display: none;
  }
}

/* ---- Status tags --------------------------------------------------------- */

.status {
  flex-shrink: 0;
  padding: 0.15rem 0.5rem;
  font: 600 0.6875rem var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.status-ready {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.status-building {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgb(53 224 193 / 45%);
}

.status-planned {
  color: var(--muted);
}

/* ---- Forms --------------------------------------------------------------- */

label,
legend {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #fff;
}

label small,
legend small {
  font-weight: 400;
  color: var(--faint);
}

/*
 * What only the hub has. The look itself — tokens, font, type, buttons, the
 * header bar — is @foilo/theme, served in front of this file.
 */

/* ---- Buttons ------------------------------------------------------------- */

/* Pico's buttons, set like the site's calls to action. */
button,
[type='submit'] {
  font-weight: 600;
  border-radius: 6px;
}

button.secondary.outline {
  color: #fff;
  border-color: var(--line-strong);
}

button.secondary.outline:hover {
  border-color: var(--accent);
}

/* ---- Sign-in ------------------------------------------------------------- */

/* One narrow card, a little above the middle, the way the site sets its forms. */
.sign-in {
  max-width: 25rem;
  margin: 0 auto;
  padding-top: clamp(3rem, 14vh, 8rem);
  text-align: center;
}

.sign-in .wordmark {
  display: inline-block;
  margin-bottom: 1.5rem;
}

.sign-in article {
  margin: 0 0 1.25rem;
  padding: 2rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}

.sign-in h1 {
  font-size: 1.75rem;
}

.sign-in hgroup p {
  font-size: 0.9375rem;
}

.sign-in form:last-of-type {
  margin-bottom: 0;
}

.sign-in article > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem -2rem -2rem;
  padding: 1rem 2rem;
  background: transparent;
  border-top: 1px solid var(--line);
}

.sign-in article > footer form {
  margin: 0;
}

.sign-in article > footer button {
  width: auto;
  margin: 0;
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}

.sign-in article > footer a {
  font-size: 0.875rem;
  color: var(--muted);
}

.sign-in small[id$='-error'] {
  color: #ff8a80;
}

/* ---- App shell ----------------------------------------------------------- */

/* The site's header bar, holding sections instead of anchors. */
header nav a[aria-current='page'] {
  color: #fff;
}

header nav a[aria-current='page']::after {
  display: block;
  height: 2px;
  margin-top: 0.2rem;
  content: '';
  background: var(--accent);
  border-radius: 1px;
}

header nav form {
  margin: 0;
}

/* Sections and sign-out sit together on the right. */
header nav ul:nth-of-type(2) {
  margin-left: auto;
}

header nav button.secondary.outline {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.875rem;
}

main.container {
  padding-block: 2.5rem 4rem;
}

/* App pages are read, not pitched: a working heading, not the site's hero. */
main h1 {
  font-size: clamp(1.625rem, 3vw, 2rem);
  line-height: 1.2;
}

main h2 {
  margin-bottom: 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

main hgroup {
  margin-bottom: 2rem;
}

main hgroup p {
  font-size: 0.9375rem;
}

main section {
  margin-bottom: 2.5rem;
}

/* ---- Cards --------------------------------------------------------------- */

/* Pico's cards, flattened to the site's: one surface, one line, no shadow. */
main article {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}

main article p:last-child,
main article ul:last-child {
  margin-bottom: 0;
}

.notice {
  margin-bottom: 2rem;
  border-color: rgb(53 224 193 / 40%);
}

.notice .status {
  display: inline-block;
  margin-bottom: 0.75rem;
}

.settings label.indented {
  margin-left: 2rem;
}

.setup h2 {
  margin-bottom: 0.5rem;
}

.steps {
  display: grid;
  gap: 0.75rem;
  padding: 0;
  margin: 1rem 0 0;
  list-style: none;
  counter-reset: step;
}

.steps .step {
  display: grid;
  grid-template-columns: 2rem 1fr;
  column-gap: 0.75rem;
  align-items: baseline;
  margin: 0;
  list-style: none;
  counter-increment: step;
}

.steps .step::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.steps .step.done::before {
  content: '✓';
  border-color: transparent;
  background: rgb(53 224 193 / 15%);
  color: var(--accent);
}

.steps .step.done a {
  color: var(--muted);
}

.steps .step[aria-current='step']::before {
  border-color: var(--accent);
  color: var(--accent);
}

.steps .step[aria-current='step'] a {
  font-weight: 600;
}

.steps .step small {
  grid-column: 2;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
}

.metric span {
  display: block;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.2;
  color: #fff;
}

.metric small {
  color: var(--muted);
}

.metric-attention span {
  color: var(--accent);
}

.attention {
  display: grid;
  gap: 0.75rem;
}

.attention ul,
.panel ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.attention li,
.panel li {
  font-size: 0.9375rem;
  color: var(--muted);
}

.attention li strong {
  color: #fff;
}

.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.panel h2 {
  font-size: 0.9375rem;
  color: var(--muted);
}

.panel p {
  margin-bottom: 0.5rem;
  color: var(--pico-color);
}

.panel p.note {
  color: var(--faint);
}

.panel form {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.panel form label {
  font-size: 0.875rem;
}

/* ---- Tables -------------------------------------------------------------- */

table {
  font-size: 0.9375rem;
}

th {
  font-weight: 500;
  color: var(--muted);
}

th,
td {
  --pico-background-color: transparent;
  border-color: var(--line);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td .status {
  margin-left: 0.5rem;
  vertical-align: 1px;
}

/* A table scrolls sideways on a phone rather than folding every cell. */
.overflow-auto td,
.overflow-auto th {
  white-space: nowrap;
}

header nav li.viewer {
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---- Phone --------------------------------------------------------------- */

@media (width < 48rem) {
  /* Wordmark and sign-out on top, the sections underneath. */
  header nav {
    flex-wrap: wrap;
  }

  header nav ul.account {
    margin-left: auto;
    min-width: 0;
  }

  header nav li.viewer {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  header nav ul:nth-of-type(2) {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  /* Pico pulls nav lists outward with negative margins; on a phone that is what overflowed. */
  header nav ul:nth-of-type(2) {
    margin-inline: 0;
  }

  header nav ul:nth-of-type(2) li {
    padding-inline: 0;
  }

  header nav {
    padding-inline: 0.75rem;
  }

  header nav li {
    padding-block: 0.4rem;
  }

  header nav a {
    font-size: 0.8125rem;
  }

  main.container {
    padding-top: 1.5rem;
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .metric {
    padding: 0.875rem 1rem;
  }

  .metric span {
    font-size: 1.5rem;
  }

  .metric small {
    display: block;
    font-size: 0.75rem;
    line-height: 1.3;
  }
}

/* ---- A document's pages -------------------------------------------------- */

.print-hint {
  max-width: 52rem;
  margin: 0 auto 1rem;
  font-size: 0.875rem;
  color: var(--faint);
}

/* ---- Print --------------------------------------------------------------- */

@media print {
  header.container,
  .print-hint {
    display: none;
  }

  :root[data-theme='dark'],
  body {
    --pico-background-color: #fff;

    /* Pico's dark theme declares a dark color-scheme, and Chrome paints the page margins in it. */
    color-scheme: light;
    background: #fff;
    background-image: none;
  }

  main.container {
    max-width: none;
    padding: 0;
  }

  @page {
    size: A4;
    margin: 20mm 18mm;
  }
}

/* ---- Settings ------------------------------------------------------------ */

.tabs {
  display: flex;
  justify-content: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  margin-bottom: -1px;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.tabs a:hover {
  color: #fff;
}

.tabs a[aria-current='page'] {
  color: #fff;
  border-bottom-color: var(--accent);
}

/* A section's own tabs, under the administration's. */
.tabs.subtabs {
  gap: 1.25rem;
  margin-top: -1rem;
  margin-bottom: 1.5rem;
  border-bottom: none;
}

.tabs.subtabs a {
  font-size: 0.875rem;
}

form.settings {
  max-width: 48rem;
}

/* On a wide screen the settings' sections become a menu beside the form, rather than tabs above a narrow column. */
@media (width >= 64rem) {
  .settings-layout {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
  }

  .settings-layout form.settings {
    max-width: none;
  }

  .settings-layout .tabs {
    position: sticky;
    top: 1.5rem;
    flex-direction: column;
    gap: 0.25rem;
    border-bottom: none;
  }

  .settings-layout .tabs a {
    margin-bottom: 0;
    padding: 0.4rem 0 0.4rem 0.9rem;
    border-bottom: none;
    border-left: 2px solid var(--line);
  }

  .settings-layout .tabs a[aria-current='page'] {
    border-left-color: var(--accent);
  }
}

form.settings fieldset {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem 0.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

form.settings legend {
  padding: 0 0.4rem;
  font-weight: 600;
}

form.settings label > span {
  display: block;
}

form.settings label > small:not(.refusal) {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 400;
  color: var(--faint);
}

form.settings label.choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

form.settings .note {
  display: block;
  margin: -0.5rem 0 1.25rem;
  font-size: 0.8125rem;
}

form.settings button[type='submit'] {
  width: auto;
  padding-inline: 1.5rem;
}

/* Only the chosen regime's fields: the radio decides, no script needed. */
form.settings:has(input[name='regime'][value='private']:checked) .regime,
form.settings:has(input[name='regime'][value='kleinunternehmer']:checked) .regime-regelbesteuerung,
form.settings:has(input[name='regime'][value='regelbesteuerung']:checked) .regime-kleinunternehmer {
  display: none;
}

small.refusal,
.sign-in small[id$='-error'] {
  color: #ff8a80;
}

.versions li {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Administration: buttons at their own width, as in the settings. */
form.export button,
form.sync button,
article.account-action button {
  width: auto;
  padding-inline: 1.5rem;
}

/* A table row's actions: one line, small, so the table stays readable. */
.row-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

.row-actions form {
  margin: 0;
}

.row-actions button {
  width: auto;
  margin: 0;
  padding: 0.2rem 0.6rem;
  font-size: 0.8125rem;
}

/* The sales list: one row per order, read across. */
table.sales td {
  vertical-align: middle;
}

/* ---- The drawer ---------------------------------------------------------- */

/* An order over the list it was opened from; on a phone, the whole width. */
.drawer:empty {
  display: none;
}

.drawer.open {
  position: fixed;
  margin: 0;
  inset: 0 0 0 auto;
  z-index: 10;
  width: min(66rem, 100%);
  overflow-y: auto;
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem;
  background: var(--pico-background-color);
  border-left: 1px solid var(--line-strong);
  box-shadow: -1.5rem 0 3rem rgb(0 0 0 / 50%);
}

.drawer > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.drawer > header h2 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
}

.drawer [data-close] {
  padding: 0.25rem 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
}

.drawer [data-close]:hover {
  color: #fff;
}

/* ---- Articles ------------------------------------------------------------ */

table.articles small {
  display: block;
}

.overflow-auto table.articles td.comment {
  min-width: 12rem;
  white-space: normal;
}

/* ---- Badges -------------------------------------------------------------- */

.badge,
.condition,
.state {
  display: inline-block;
  margin: 0 0.25rem 0.15rem 0;
  padding: 0.05rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.badge-language {
  font-weight: 500;
  color: var(--muted);
}

.badge-finish {
  color: #f4d35e;
  border-color: rgb(244 211 94 / 45%);
}

.badge-extra {
  color: #c9a7ff;
  border-color: rgb(201 167 255 / 45%);
}

/*
 * Cardmarket's own colour per grade, so a seller reads them as on the site:
 * `.condition-mt .badge` … `.condition-po .badge` in
 * static.cardmarket.com/…/static-code/public/styles/master.min.css (read 2026-10-18).
 */
.condition {
  min-width: 2.4rem;
  color: #fff;
  text-align: center;
  border: 0;
}

.condition-mt {
  background: #17a2b8;
}

.condition-nm {
  background: rgb(40 167 69 / 90%);
}

.condition-ex {
  background: #82891e;
}

.condition-gd {
  color: #212529;
  background: #ffc107;
}

.condition-lp {
  background: rgb(253 126 20 / 90%);
}

.condition-pl {
  background: rgb(220 53 69 / 75%);
}

.condition-po {
  background: #dc3545;
}

/* An order's state: what still needs the seller stands out, what is done recedes. */
.state {
  font-weight: 500;
  color: var(--muted);
}

.state-paid {
  color: var(--accent);
  border-color: rgb(53 224 193 / 45%);
}

.state-sent {
  color: #7cb7ff;
  border-color: rgb(124 183 255 / 40%);
}

.state-lost {
  color: #ff8a80;
  border-color: rgb(255 138 128 / 45%);
}

.state-cancelled {
  color: var(--faint);
  text-decoration: line-through;
}

tr.needs-attention td:first-child {
  box-shadow: inset 3px 0 0 #ffb74d;
}

/* ---- Filter -------------------------------------------------------------- */

/* One row of fields above the list, wrapping on a narrow screen. */
form.filter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

form.filter label {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

form.filter input,
form.filter select {
  height: 2.5rem;
  margin: 0.25rem 0 0;
  padding-block: 0;
  font-size: 0.875rem;
}

/* With script every change filters at once, so the button is for a page without it. */
html.js form.filter .no-js {
  display: none;
}

form.filter button {
  width: auto;
  height: 2.5rem;
  margin: 0;
  padding: 0 1.1rem;
  font-size: 0.875rem;
}

p.count {
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

p.count a {
  color: var(--muted);
}

/* ---- Copy ---------------------------------------------------------------- */

/* Only with script (`ui.js` marks the page), since copying needs it. */
.copy {
  display: none;
}

html.js .copy {
  display: inline-block;
  width: auto;
  margin: 0 0 0 0.4rem;
  padding: 0 0.3rem;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
  vertical-align: middle;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

/* The glyph is drawn, not written, so it is no part of the text around it; the label names it. */
html.js .copy::before {
  content: '⧉';
}

html.js .copy:hover {
  color: #fff;
  border-color: var(--accent);
}

html.js .copy.copied {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---- Preview ------------------------------------------------------------- */

/*
 * The invoice sheet beside the list, opened by `ui.js` (which sets its place).
 * Pico sets every dialog as a full-window modal; this one is a panel.
 */
dialog.preview {
  position: fixed;
  inset: auto;
  z-index: 20;
  display: block;
  width: 46rem;
  min-width: 0;
  max-width: none;
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 1rem);
  margin: 0;
  padding: 0;
  overflow: auto;
  background: transparent;
  border: 0;
  border-radius: 4px;
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 60%);
  backdrop-filter: none;
}

dialog.preview:not([open]) {
  display: none;
}

/* A larger image takes its own width, not a sheet's. */
dialog.preview.image {
  width: auto;
  background: var(--surface);
}

dialog.preview.image img {
  display: block;
  width: 372px;
  max-width: none;
  height: auto;
}

/* The original: its own size, never taller than the window. */
dialog.preview.image.original img {
  width: auto;
  max-height: calc(100vh - 1rem);
}

td.image img {
  display: block;
  width: 50px;
  height: auto;
  border-radius: 3px;
}

/* ---- Source links -------------------------------------------------------- */

/* The order or article on the marketplace; drawn, so the id beside it reads alone. */
a.source {
  margin-left: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  vertical-align: middle;
}

a.source::before {
  content: '↗';
}

a.source:hover {
  color: var(--accent);
}

/* ---- Image sources (admin) ----------------------------------------------- */

/* A source's states, one line each; its buttons in one row beneath, small. */
.sources .paused {
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
}

.sources .source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.sources .source-actions form {
  margin: 0;
  padding: 0;
  border: 0;
}

.sources .source-actions button {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.8125rem;
}

/* Another printing's image, standing in for a product that has none of its own. */
img.other-printing {
  outline: 1px dashed var(--line-strong);
  outline-offset: 2px;
  opacity: 0.85;
}

/* ---- The catalogue ------------------------------------------------------- */

/* One wide field: typing searches. */
form.catalogue-search {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

form.catalogue-search input[type='search'] {
  margin: 0;
}

/* The game beside the field, as wide as its longest name needs, never the row. */
form.catalogue-search select {
  width: auto;
  flex: none;
  margin: 0;
}

/* "Nur Sealed" beside the game, on one line with it. */
form.catalogue-search label.sealed {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.375rem;
  margin: 0;
  white-space: nowrap;
}

form.catalogue-search label.sealed input {
  margin: 0;
}

.catalogue .narrowed {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
}

form.catalogue-search button {
  width: auto;
  margin: 0;
}

html.js form.catalogue-search .no-js {
  display: none;
}

/* The grid, and beside it the panel once one is open. */
.catalogue {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.catalogue .hint {
  color: var(--muted);
}

ul.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 1.25rem 1rem;
  margin: 0;
  padding: 0;
}

ul.tiles > li {
  margin: 0;
  list-style: none;
}

/* The next page's way in: across the whole row, under the last tiles. */
ul.tiles > li.more {
  grid-column: 1 / -1;
  text-align: center;
}

a.tile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: inherit;
  text-decoration: none;
}

/*
 * At the file's own size, which the server writes on the `<img>` from what the
 * fetch measured: a file stretched by a fraction of a pixel is resampled whole
 * and blurs on a 1× screen. One whose size is not known yet (`unsized`) is
 * fitted into a card's frame instead. Narrower than a column only on a phone.
 */
a.tile img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4.5% / 3.2%;
}

a.tile img.unsized,
a.tile .no-image {
  width: 150px;
  aspect-ratio: 63 / 88;
  object-fit: contain;
}

a.tile .no-image {
  background: var(--line);
}

a.tile strong {
  font-size: 0.875rem;
  line-height: 1.25;
}

a.tile small {
  font-size: 0.75rem;
  color: var(--muted);
}

a.tile:hover strong {
  text-decoration: underline;
}

/* The panel: beside the grid, staying in view as the grid scrolls; on a phone, over it. */
.panel:empty {
  display: none;
}

.catalogue:has(> .panel.open) {
  grid-template-columns: minmax(0, 1fr) min(24rem, 40%);
}

.panel.open {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  margin: 0;
  padding: 1.25rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

@media (width < 48rem) {
  .catalogue:has(> .panel.open) {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel.open {
    position: fixed;
    inset: 0;
    z-index: 10;
    max-height: none;
    border-radius: 0;
    background: var(--pico-background-color, #0d0d0d);
  }
}

.panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel > header h2 {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.panel [data-close] {
  padding: 0 0.25rem;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
}

.panel > img,
.panel > .no-image {
  display: block;
  width: 100%;
  max-width: 18rem;
  height: auto;
  margin: 0 auto 1rem;
  aspect-ratio: 63 / 88;
  object-fit: contain;
  border-radius: 4.5% / 3.2%;
}

.panel .no-image {
  background: var(--line);
}

.panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

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

.panel dd {
  margin: 0;
}

.panel h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.9375rem;
}

.panel .links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
}

ul.printings {
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
}

ul.printings > li {
  margin: 0;
  list-style: none;
}

ul.printings a {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.25rem 0;
  color: inherit;
  text-decoration: none;
}

ul.printings img,
ul.printings .no-image {
  display: block;
  width: 2rem;
  height: auto;
  aspect-ratio: 63 / 88;
  border-radius: 2px;
}

ul.printings small {
  color: var(--muted);
}

ul.printings > li[aria-current='true'] a {
  font-weight: 600;
}

/* What an admin is told of a search: how many, how fast. */
p.said {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---- Live downloads ------------------------------------------------------ */

/* Re-rendered every second: fixed columns and one line per cell, so a swap
   never moves the table — a long name is cut, its whole text in the title. */
table.live {
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

table.live td,
table.live th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.live .held {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.live .slot + .slot {
  margin-top: 0.25rem;
}

table.live small.held {
  color: var(--muted);
}

table.live-lanes th:nth-child(1) {
  width: 7rem;
}

table.live-lanes :is(th, td):nth-child(2) {
  width: 17rem;
}

table.live-lanes :is(th, td):nth-child(3) {
  width: 19rem;
}

table.live-failures :is(th, td):nth-child(1) {
  width: 6rem;
}

table.live-failures :is(th, td):nth-child(2) {
  width: 7rem;
}

table.live-failures :is(th, td):nth-child(4) {
  width: 14rem;
}

/* A phone stacks each row: the source, then each cell on a line of its own. */
@media (width < 48rem) {
  table.live,
  table.live tbody,
  table.live tr,
  table.live th,
  table.live td {
    display: block;
    width: auto !important;
  }

  table.live thead {
    display: none;
  }

  table.live tr {
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0;
  }

  table.live th,
  table.live td {
    border: 0;
    padding: 0.125rem 0;
  }

  table.live td {
    font-size: 0.875rem;
  }

  table.live td[data-label]::before {
    content: attr(data-label) ': ';
    color: var(--muted);
  }
}

/* ---- A link that is an action ---------------------------------------------- */

/* A link set like a button: it navigates (or htmx swaps a part), and keeps working without script. */
a.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--accent-ink);
  text-decoration: none;
  white-space: nowrap;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
}

a.button:hover {
  background: var(--pico-primary-hover-background);
}

a.button.secondary {
  color: #fff;
  background: transparent;
  border-color: var(--line-strong);
}

a.button.secondary:hover {
  border-color: var(--accent);
}

button.danger {
  color: #fff;
  background: #b3261e;
  border-color: #b3261e;
}

button.link {
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  background: none;
  border: 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-head h1 {
  margin: 0;
}

/* ---- The order in the drawer ------------------------------------------------ */

.sale > * + * {
  margin-top: 1.25rem;
}

.sale-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

/* The status box open as its form under the heading: ⋯ and ✕ stay beside the heading, the form full width below. */
.sale-head:has(> hgroup form.editor) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.sale-head:has(> hgroup form.editor) > hgroup {
  display: contents;
}

.sale-head:has(> hgroup form.editor) > hgroup > form.editor {
  grid-column: 1 / -1;
}

.sale-head:has(> hgroup form.editor) > .sale-actions {
  grid-row: 1;
  grid-column: 2;
}

.sale-head h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
}

.sale-head p {
  margin: 0;
  font-size: 0.9375rem;
}

.sale-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The order's other actions, behind ⋯: a disclosure, so it opens without script too. */
details.menu {
  position: relative;
  margin: 0;
}

details.menu > summary {
  padding: 0.45rem 0.7rem;
  font-size: 1.1rem;
  line-height: 1;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
}

details.menu > summary::after,
details.menu > summary::-webkit-details-marker {
  display: none;
}

details.menu > ul {
  position: absolute;
  right: 0;
  z-index: 5;
  min-width: 14rem;
  margin: 0.35rem 0 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 45%);
}

details.menu li {
  margin: 0;
  list-style: none;
}

details.menu li a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--pico-color);
  text-decoration: none;
  border-radius: 6px;
}

details.menu li a:hover {
  background: var(--accent-soft);
}

/* The order's state as a pill beside its dates. */
.state {
  border: 0;
}

.state-open {
  color: #f4d35e;
  background: rgb(244 211 94 / 14%);
}

.state-paid {
  color: var(--accent);
  background: var(--accent-soft);
}

.state-sent,
.state-done {
  color: #9ecbff;
  background: rgb(158 203 255 / 14%);
}

.state-problem,
.state-cancelled {
  color: #ff9e9e;
  background: rgb(255 120 120 / 14%);
}

.confirm {
  padding: 1rem 1.25rem;
  background: rgb(179 38 30 / 10%);
  border: 1px solid rgb(255 120 120 / 35%);
  border-radius: 10px;
}

.confirm p {
  margin-bottom: 0.75rem;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.choices button {
  width: auto;
  margin: 0;
}

.sale-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  align-items: start;
}

.sale-cards address {
  display: grid;
  margin-bottom: 0.5rem;
  font-style: normal;
  line-height: 1.5;
}

.sale-section > h2 {
  margin-bottom: 0.75rem;
  font-size: 1.125rem;
}

.sale-section .panel + .panel {
  margin-top: 1rem;
}

.conflicts {
  border-color: rgb(244 211 94 / 45%);
}

.conflicts ul {
  display: grid;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.conflicts li {
  padding: 0.75rem 0 0;
  color: var(--pico-color);
  border-top: 1px solid var(--line);
}

.conflicts dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.15rem 1rem;
  margin: 0.4rem 0 0.6rem;
}

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

.conflicts dd {
  margin: 0;
}

/* Articles as cards: what, how, how many for how much — wrapping, never scrolling sideways. */
ol.articles {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

li.article {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  gap: 0.25rem 1rem;
  align-items: start;
  padding: 0.75rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.article-thumb {
  width: 3.5rem;
  height: auto;
  border-radius: 4px;
}

.article-thumb.none {
  display: grid;
  place-items: center;
  height: 4.9rem;
  font-size: 0.6875rem;
  line-height: 1.2;
  color: var(--faint);
  text-align: center;
  background: #121212;
  border: 1px dashed var(--line-strong);
}

.article-main p {
  margin: 0 0 0.25rem;
}

.article-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.4rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  font-size: 0.875rem;
}

.article-meta > * {
  margin: 0;
}

.article-comment {
  font-size: 0.875rem;
  font-style: italic;
  color: var(--muted);
}

.article-price {
  display: grid;
  justify-items: end;
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.article-price strong {
  font-size: 1.0625rem;
}

dl.totals-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1.5rem;
  max-width: 24rem;
  margin: 0.75rem 0 0 auto;
  font-variant-numeric: tabular-nums;
}

dl.totals-line dt {
  color: var(--muted);
  text-align: right;
}

dl.totals-line dd {
  margin: 0;
  text-align: right;
}

dl.totals-line dt:last-of-type,
dl.totals-line dd:last-of-type {
  padding-top: 0.25rem;
  font-weight: 600;
  color: #fff;
  border-top: 1px solid var(--line-strong);
}

ul.documents {
  display: grid;
  gap: 0.35rem;
  margin-top: 1rem;
  padding: 0;
  list-style: none;
}

ul.documents li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
}

/* ---- The order editor -------------------------------------------------------- */

form.editor > * + * {
  margin-top: 1.25rem;
}

/* Out of sight but not display:none, so Enter in a field still clicks it (`ArticlesSection`). */
form.editor .default-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}

.editor-head h2 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
}

.editor-head p {
  margin: 0;
}

.draft-note {
  padding: 0.6rem 0.9rem;
  font-size: 0.9375rem;
  background: var(--accent-soft);
  border: 1px solid rgb(53 224 193 / 35%);
  border-radius: 8px;
}

.editor-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  align-items: start;
}

form.editor fieldset.card {
  margin: 0;
  padding: 1rem 1.25rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

form.editor fieldset.card > legend {
  float: left;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
}

form.editor label {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

form.editor label > span:first-child,
form.editor legend > span:first-child {
  display: inline-flex;
  gap: 0.4rem;
  align-items: baseline;
}

/* Fields a size smaller than a sign-in form's: an order has many, and they sit in cards. */
form.editor {
  --pico-form-element-spacing-vertical: 0.45rem;
  --pico-form-element-spacing-horizontal: 0.7rem;
}

form.editor input:not([type='checkbox'], [type='radio']),
form.editor select {
  margin: 0.25rem 0 0;
  font-size: 0.9375rem;
}

form.editor small.refusal {
  display: block;
  margin-top: 0.25rem;
}

form.editor .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
}

form.editor .row > label {
  flex: 1 1 8rem;
}

form.editor .row > label.narrow {
  flex: 0 1 6.5rem;
}

form.editor .dates > label {
  flex: 1 1 8.5rem;
}

/* A value of the seller's own, beside its label. */
.mine {
  padding: 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--accent);
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  border-radius: 4px;
}

/* A choice of a few, side by side. */
fieldset.segmented {
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
}

fieldset.segmented > legend {
  margin-bottom: 0.3rem;
  padding: 0;
  font-size: 0.875rem;
}

fieldset.segmented > label {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
}

fieldset.segmented input {
  position: absolute;
  opacity: 0;
}

fieldset.segmented input + span {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  font-size: 0.875rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}

fieldset.segmented input:checked + span {
  color: var(--accent-ink);
  font-weight: 600;
  background: var(--accent);
  border-color: var(--accent);
}

fieldset.segmented input:focus-visible + span {
  outline: 2px solid var(--pico-primary-focus);
  outline-offset: 2px;
}

details.more {
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
}

details.more > summary {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--accent);
}

details.more > summary::after {
  display: none;
}

details.more > summary::before {
  content: '+ ';
}

details.more[open] > summary::before {
  content: '− ';
}

label.tick {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

label.tick input {
  flex: none;
  margin: 0.2rem 0 0;
}

/* An article in the editor: what it is and how, left; how many for how much, right. */
.editor-articles h3 {
  margin-bottom: 0.75rem;
  font-size: 1.125rem;
}

ol.article-cards {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

li.article-card {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  padding: 0.9rem 1rem 0.75rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

li.article-card .article-thumb {
  grid-row: span 2;
  width: 3.5rem;
}

li.article-card .article-thumb img {
  width: 100%;
  border-radius: 4px;
}

li.article-card .article-thumb span {
  display: block;
  height: 4.9rem;
  background: #121212;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
}

/* What a seller changes most, in one line: the article, how many, for how much, the sum. */
.article-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0 0.75rem;
}

.article-line > * {
  margin: 0;
}

.article-search {
  position: relative;
  flex: 1 1 15rem;
}

.article-search label {
  margin: 0;
}

.article-line .stepper {
  flex: 0 0 8.5rem;
}

.article-line label.price {
  flex: 0 0 6.5rem;
  margin: 0;
}

.article-line label.price input {
  text-align: right;
}

.article-sum {
  flex: 0 0 6rem;
  align-self: center;
  margin-top: 1.4rem;
  font-size: 1.0625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stepper {
  display: grid;
  grid-template-columns: 2.25rem 1fr 2.25rem;
  align-items: end;
  gap: 0;
}

.stepper-label {
  display: inline-flex;
  grid-column: 1 / -1;
  gap: 0.4rem;
  font-size: 0.875rem;
}

form.editor .stepper input {
  margin-top: 0.25rem;
  text-align: center;
  border-radius: 0;
}

.stepper button.step {
  height: 100%;
  margin: 0.25rem 0 0;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: #fff;
  background: #121212;
  border: 1px solid var(--line-strong);
}

.stepper button.step:first-of-type {
  border-right: 0;
  border-radius: 6px 0 0 6px;
}

.stepper button.step:last-of-type {
  border-left: 0;
  border-radius: 0 6px 6px 0;
}

.stepper small.refusal {
  grid-column: 1 / -1;
}

/* What the article is, one line of facts, opening into its fields. */
details.article-details {
  margin: 0.4rem 0 0;
  padding: 0;
  border: 0;
}

details.article-details > summary {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  list-style: none;
}

details.article-details > summary::after,
details.article-details > summary::-webkit-details-marker {
  display: none;
}

.details-toggle {
  flex: none;
  color: var(--accent);
}

details.article-details[open] .details-toggle::after {
  content: ' ▴';
}

details.article-details:not([open]) .details-toggle::after {
  content: ' ▾';
}

.article-detail-fields {
  margin-top: 0.75rem;
}

.article-how {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0 0.75rem;
}

.article-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
}

.article-flags label.tick {
  margin-bottom: 0.5rem;
}

li.article-card label.remove {
  grid-column: 2;
}

/* Removing an article: a checkbox that reads as a toggle; with it ticked, the card is struck. */
label.remove {
  justify-self: end;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
}

label.remove input {
  position: absolute;
  opacity: 0;
}

label.remove .when-removed,
li.article-card:has([data-remove]:checked) label.remove .when-kept {
  display: none;
}

li.article-card:has([data-remove]:checked) label.remove .when-removed {
  display: inline;
  color: var(--accent);
}

label.remove:hover {
  color: #ff9e9e;
}

label.remove:has(input:focus-visible) {
  outline: 2px solid var(--pico-primary-focus);
}

li.article-card:has([data-remove]:checked) {
  opacity: 0.55;
}

li.article-card:has([data-remove]:checked) [data-field='name'] {
  text-decoration: line-through;
}

/* The catalogue's picks under an article's name: a short list over what follows. */
.pick-list:empty {
  display: none;
}

.pick-list {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 6;
  margin-top: -0.5rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 50%);
}

ul.picks {
  display: grid;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
}

ul.picks li {
  margin: 0;
  list-style: none;
}

ul.picks button {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0 0.65rem;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0.35rem 0.5rem;
  font-weight: 400;
  /* Pico sets a button's own colour to the accent's ink; a pick reads as text. */
  color: #e8e8e8;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

ul.picks button small {
  color: var(--muted);
}

ul.picks button:hover,
ul.picks button:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.pick-thumb {
  grid-row: span 2;
  width: 2.25rem;
  height: 3.15rem;
  object-fit: cover;
  background: #121212;
  border-radius: 3px;
}

.pick-name {
  font-weight: 600;
}

.picks-empty {
  display: block;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

button.add-article {
  width: auto;
}

dl.editor-totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1.5rem;
  max-width: 22rem;
  margin: 0.75rem 0 0 auto;
  font-variant-numeric: tabular-nums;
}

dl.editor-totals dt {
  color: var(--muted);
  text-align: right;
}

dl.editor-totals dd {
  margin: 0;
  text-align: right;
}

dl.editor-totals dt:last-of-type,
dl.editor-totals dd:last-of-type {
  padding-top: 0.25rem;
  font-weight: 600;
  color: #fff;
  border-top: 1px solid var(--line-strong);
}

/* Save and discard, always in reach at the drawer's foot while it scrolls. */
.savebar {
  position: sticky;
  bottom: -3rem;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin: 1.5rem calc(-1 * clamp(1rem, 3vw, 2.5rem)) -3rem;
  padding: 0.9rem clamp(1rem, 3vw, 2.5rem) 1.1rem;
  background: rgb(14 14 14 / 94%);
  border-top: 1px solid var(--line-strong);
  backdrop-filter: blur(6px);
}

.savebar button {
  width: auto;
  margin: 0;
}

.savebar .dirty {
  margin-right: auto;
  font-size: 0.875rem;
  color: #f4d35e;
}

.savebar .dirty::before {
  content: '● ';
}

/* On a phone the money goes under what the article is, and the cards stack. */
@media (width < 640px) {
  li.article {
    grid-template-columns: 3rem minmax(0, 1fr);
  }

  li.article .article-price {
    grid-column: 2;
    justify-items: start;
    grid-auto-flow: column;
    gap: 0.75rem;
  }

  li.article-card {
    grid-template-columns: 2.75rem minmax(0, 1fr);
    gap: 0.25rem 0.75rem;
  }

  li.article-card .article-thumb {
    width: 2.75rem;
  }
}

#sale-confirm:empty {
  display: none;
}

/* The article line's fields, one height, so name, quantity and price line up. */
form.editor .article-line input,
form.editor .stepper button.step {
  height: 2.5rem;
}

.sale-head,
.sale-head hgroup,
.editor-head,
.editor-head hgroup {
  margin-bottom: 0;
}

/* ---- Editing one box ---------------------------------------------------------- */

/* A box's pen, beside its heading: opens that box alone as a form. */
a.pen {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  color: var(--muted);
  border-radius: 6px;
}

a.pen:hover,
a.pen:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
}

.panel h2,
.sale-section > h2 {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.sale-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

/* One box as a form: the box's own card, and its Abbrechen and Speichern under it. */
form.editor.part {
  margin: 0;
}

form.editor.part > * + * {
  margin-top: 0.75rem;
}

form.editor.part fieldset.card {
  border-color: rgb(53 224 193 / 45%);
}

.part-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.part-actions button {
  width: auto;
  margin: 0;
}

.part-actions .dirty {
  margin-right: auto;
  font-size: 0.875rem;
  color: #f4d35e;
}

.part-actions .dirty::before {
  content: '● ';
}

/* The status box opens where the state and dates were, under the order's name. */
form.editor.part-status {
  margin-top: 0.75rem;
}

/* ---- A document's pages ----------------------------------------------------- */

/* The PDF's own pages, one image each, a sheet of paper on the page. */
.document-pages {
  display: grid;
  gap: 1.25rem;
  justify-items: center;
}

.document-page {
  width: min(100%, 52rem);
  height: auto;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 55%);
}

/* Over the drawer, as a button asks for it: the pages and what can be done with them. */
.document-view {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 12;
  width: min(66rem, 100%);
  overflow-y: auto;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem) 3rem;
  background: rgb(14 14 14 / 97%);
}

.document-view > header {
  position: sticky;
  top: -1.25rem;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: -1.25rem calc(-1 * clamp(1rem, 3vw, 2.5rem)) 1rem;
  padding: 1rem clamp(1rem, 3vw, 2.5rem);
  background: rgb(14 14 14 / 95%);
  border-bottom: 1px solid var(--line-strong);
}

.document-view > header h2 {
  margin: 0 auto 0 0;
  font-size: 1.25rem;
}

.document-view > header form {
  margin: 0;
}

.document-view .close-view {
  padding: 0.25rem 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
}

#invoice-view:empty {
  display: none;
}

/* The list's hover preview: the first page, at the dialog's width. */
#preview .document-pages {
  gap: 0.5rem;
}

#preview .document-page {
  width: 100%;
  box-shadow: none;
}

.deliveries h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.deliveries ul,
.requests {
  padding: 0;
  margin: 0;
  list-style: none;
}

.deliveries li,
.requests li {
  margin: 0 0 0.35rem;
  list-style: none;
}

.requests li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.requests li p {
  margin: 0 0 0.5rem;
}

/* A request's actions, and mailing an invoice: one row of small controls, wrapping on a phone. */
.request-actions,
.mail-invoice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.request-actions form {
  margin: 0;
}

/* The mail form takes the row's room; its field and button stay one line. */
.request-actions .mail-invoice {
  flex: 1 1 28rem;
  max-width: 34rem;
}

.mail-invoice {
  flex-wrap: nowrap;
}

form.mail-invoice input[type='email'] {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
}

.mail-invoice button {
  white-space: nowrap;
}

.request-actions button,
.request-actions .button,
.mail-invoice button {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.85rem;
  font-size: 0.875rem;
}

.device-list {
  padding: 0;
  margin: 0 0 1.5rem;
  list-style: none;
}

.device-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.device-list li .status {
  margin-left: 0.5rem;
}

.device-list form {
  margin: 0;
}

/* Actions in a list row, and the one under it, are small and outlined: the row is what matters. */
.device-list button,
.list-actions button {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.85rem;
  font-size: 0.875rem;
}

.device-list small {
  color: var(--muted);
}

/* "Umbenennen": a quiet link that opens a one-line form, not an accordion. */
details.rename {
  margin: 0.2rem 0 0;
  padding: 0;
  border: none;
}

details.rename summary {
  display: inline;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

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

details.rename summary::after {
  display: none;
}

details.rename summary:hover {
  color: var(--accent);
}

details.rename[open] summary {
  margin-bottom: 0.4rem;
}

details.rename form {
  display: flex;
  gap: 0.5rem;
  max-width: 26rem;
}

details.rename input {
  margin: 0;
  padding: 0.35rem 0.6rem;
  height: auto;
}

/* The extension's content script marks the connect page done or failed (`pairing.routes.tsx`). */
.pairing .pairing-done,
.pairing .pairing-failed,
.pairing[data-state] .pairing-waiting {
  display: none;
}

.pairing[data-state='done'] .pairing-done,
.pairing[data-state='failed'] .pairing-failed {
  display: block;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgb(255 184 76 / 50%);
  border-radius: 12px;
  background: rgb(255 184 76 / 8%);
}

.banner p {
  margin: 0;
}

.banner form {
  margin: 0;
}

.banner button {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.75rem;
}

/* A form of one or two short values — an address, a code — need not span the page. */
form.narrow input {
  max-width: 26rem;
}
