/*
 * Supplier portal styles.
 * Every colour, size, radius and shadow comes from the tokens below
 * (docs/ontwerp-en-bouwregels.md, sections 4 to 7). Components never use
 * raw values. Light theme follows PLAN.md section 10: white cards on #F1F1F1,
 * dark (#262626, the logo grey) primary buttons, colour only for status.
 * Light is the default (owner's choice, 21 Oct 2026); dark only when chosen
 * in the account menu, directly or as "Same as device".
 */

:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #f1f1f1;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --elevated: #ffffff;
  --scrim: rgba(17, 17, 17, 0.45);

  /* Borders: --border-strong is for inputs and controls (3:1 on white) */
  --border: #e1e1e1;
  --border-strong: #8a8a8a;

  /* Text */
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #5f5f5f;
  --text-on-accent: #ffffff;

  /* Accent: the logo's dark grey */
  --accent: #1a1a1a;
  --accent-solid: #262626;
  --accent-hover: #0d0d0d;

  /* Status: -text for words, -solid for filled shapes, -tint for pill backgrounds */
  --success-text: #0b5d34;
  --success-solid: #12804a;
  --success-tint: #dcf2e5;
  --warning-text: #6b4a00;
  --warning-solid: #a87400;
  --warning-tint: #fff0c4;
  --danger-text: #8c1d0e;
  --danger-solid: #c4290f;
  --danger-tint: #fde6e2;
  --info-text: #0a4a86;
  --info-solid: #1c62b3;
  --info-tint: #e1edfc;

  --focus-ring: #1c62b3;

  /* Sales channels in their own colours (owner's request): Shopify green, bol blue */
  --shopify-text: #00634b;
  --shopify-tint: #dff2ea;
  --bol-text: #0000a4;
  --bol-tint: #e6e6f7;

  /* Spacing: multiples of 4 only */
  --space-1: 0.25rem; /* 4 */
  --space-2: 0.5rem; /* 8 */
  --space-3: 0.75rem; /* 12 */
  --space-4: 1rem; /* 16 */
  --space-6: 1.5rem; /* 24 */
  --space-8: 2rem; /* 32 */
  --space-12: 3rem; /* 48 */

  /* Type scale (1.2x steps) */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 0.75rem; /* 12 / 16 */
  --text-sm: 0.875rem; /* 14 / 20 */
  --text-md: 1rem; /* 16 / 24 */
  --text-lg: 1.125rem; /* 18 / 28 */
  --text-xl: 1.25rem; /* 20 / 28 */
  --text-2xl: 1.5rem; /* 24 / 32 */
  --text-3xl: 1.875rem; /* 30 / 36 */

  /* Shape */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-full: 999px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow-popup: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-dialog: 0 12px 32px rgba(0, 0, 0, 0.18);

  /* Sizes */
  --topbar-height: 3.5rem; /* 56 */
  --sidebar-width: 14.5rem; /* 232 */
  --control-height: 2.5rem; /* 40 */
  --content-max: 75rem; /* 1200 */

  /* Stacking order, bottom to top */
  --z-dropdown: 10;
  --z-topbar: 20;
  --z-sidebar: 30;
  --z-dialog: 40;
  --z-toast: 50;
  --z-tooltip: 60;

  --duration-fast: 150ms;
  --duration-panel: 250ms;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #161616;
    --surface: #1f1f1f;
    --surface-2: #2a2a2a;
    --elevated: #2f2f2f;
    --scrim: rgba(0, 0, 0, 0.6);
    --border: #353535;
    --border-strong: #7a7a7a;
    --text-primary: #e8eaed;
    --text-secondary: #c4c4c4;
    --text-muted: #a3a3a3;
    --text-on-accent: #161616;
    --accent: #e8eaed;
    --accent-solid: #e8eaed;
    --accent-hover: #ffffff;
    --success-text: #7dd8a3;
    --success-solid: #3fa96c;
    --success-tint: rgba(63, 169, 108, 0.18);
    --warning-text: #f2cd6b;
    --warning-solid: #c99a1e;
    --warning-tint: rgba(201, 154, 30, 0.2);
    --danger-text: #ff9c8a;
    --danger-solid: #e0533a;
    --danger-tint: rgba(224, 83, 58, 0.2);
    --info-text: #9cc6f7;
    --info-solid: #4a8ad6;
    --info-tint: rgba(74, 138, 214, 0.2);
    --focus-ring: #7fb3f2;
    --shopify-text: #7fd8b8;
    --shopify-tint: rgba(0, 128, 96, 0.24);
    --bol-text: #b3b3ff;
    --bol-tint: rgba(64, 64, 230, 0.26);
    --shadow-card: none;
    --shadow-popup: none;
    --shadow-dialog: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161616;
  --surface: #1f1f1f;
  --surface-2: #2a2a2a;
  --elevated: #2f2f2f;
  --scrim: rgba(0, 0, 0, 0.6);
  --border: #353535;
  --border-strong: #7a7a7a;
  --text-primary: #e8eaed;
  --text-secondary: #c4c4c4;
  --text-muted: #a3a3a3;
  --text-on-accent: #161616;
  --accent: #e8eaed;
  --accent-solid: #e8eaed;
  --accent-hover: #ffffff;
  --success-text: #7dd8a3;
  --success-solid: #3fa96c;
  --success-tint: rgba(63, 169, 108, 0.18);
  --warning-text: #f2cd6b;
  --warning-solid: #c99a1e;
  --warning-tint: rgba(201, 154, 30, 0.2);
  --danger-text: #ff9c8a;
  --danger-solid: #e0533a;
  --danger-tint: rgba(224, 83, 58, 0.2);
  --info-text: #9cc6f7;
  --info-solid: #4a8ad6;
  --info-tint: rgba(74, 138, 214, 0.2);
  --focus-ring: #7fb3f2;
  --shopify-text: #7fd8b8;
  --shopify-tint: rgba(0, 128, 96, 0.24);
  --bol-text: #b3b3ff;
  --bol-tint: rgba(64, 64, 230, 0.26);
  --shadow-card: none;
  --shadow-popup: none;
  --shadow-dialog: none;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.4286; /* 20px on 14px */
  min-height: 100dvh;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-xl);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

h2,
h3 {
  font-size: var(--text-sm);
  line-height: 1.4286;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

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

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-4);
  background: var(--elevated);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popup);
}

.skip-link:focus {
  top: var(--space-2);
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
  flex: none;
}

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

.mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.muted {
  color: var(--text-muted);
}

.secondary {
  color: var(--text-secondary);
}

.small {
  font-size: var(--text-xs);
  line-height: 1.3333;
}

.nowrap {
  white-space: nowrap;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--topbar-height);
  padding: 0 var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  text-decoration: none;
  color: var(--text-secondary);
}

/* The logo PNG has a white background; on the dark theme it sits on its own
   white plate instead of being recoloured (house rule: never alter the logo). */
.topbar__logo {
  flex: none;
  height: 2rem;
  width: auto;
  border-radius: var(--radius-sm);
}

.topbar__product {
  font-weight: 500;
  white-space: nowrap;
}

.topbar__end {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.demo-label {
  display: inline-flex;
  align-items: center;
  height: 1.5rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
}

.viewing-as-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--warning-tint);
  color: var(--warning-text);
  border-bottom: 1px solid var(--border);
}

.viewing-as-bar p {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
}

.layout {
  display: flex;
  min-height: calc(100dvh - var(--topbar-height));
}

.sidebar {
  flex: none;
  width: var(--sidebar-width);
  padding: var(--space-3);
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.25rem;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}

.nav__link:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.nav__link[aria-current="page"] {
  background: var(--surface-2);
  color: var(--text-primary);
  font-weight: 600;
}

.main {
  flex: 1;
  min-width: 0;
  padding: var(--space-6) var(--space-8) var(--space-12);
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Narrow pages keep the same left edge as every other page. */
.container--narrow > * {
  max-width: 40rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.page-header__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.page-header__meta {
  margin-top: var(--space-1);
  color: var(--text-secondary);
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* A button wrapped in its own form still lines up with the other actions. */
.page-header__actions > form {
  display: contents;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 2rem;
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.stack > * + * {
  margin-top: var(--space-4);
}

.stack-sm > * + * {
  margin-top: var(--space-2);
}

.section-gap {
  margin-top: var(--space-4);
}

.layout-2col {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  min-height: 3.25rem;
  padding: var(--space-3) var(--space-4);
}

.card__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.card__section {
  padding: var(--space-4);
}

.card__header + .card__section {
  padding-top: 0;
}

.card__section + .card__section,
.card__header + .card__section--ruled,
.card__footer {
  border-top: 1px solid var(--border);
}

.card__header + .card__section--ruled {
  padding-top: var(--space-4);
}

.card__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}

/* A small heading inside a card section ("Shipping address") */
.label-heading {
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.3333;
}

.address {
  font-style: normal;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.link-list > * + * {
  margin-top: var(--space-1);
}

.link-list a {
  overflow-wrap: anywhere;
}

/* Key and value rows with a line between them (supplier details, order details) */
.kv {
  margin: 0;
}

/* Label left, value right; a long label wraps instead of pushing the value down. */
.kv__row {
  display: grid;
  grid-template-columns: minmax(6rem, 1fr) minmax(0, max-content);
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}

.kv__row--stacked {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
}

.kv .kv__row--stacked dd {
  margin: 0;
  text-align: left;
}

.kv__row:first-child {
  border-top: 0;
  padding-top: 0;
}

.kv__row:last-child {
  padding-bottom: 0;
}

.kv dt {
  color: var(--text-secondary);
}

.kv dd {
  margin: 0 0 0 auto;
  text-align: right;
  overflow-wrap: anywhere;
}

/* Tracking number and carrier side by side, as in Shopify */
.tracking-fields {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-1) var(--space-3);
}

.tracking-fields .label {
  margin-bottom: var(--space-1);
}

.tracking-fields__error {
  grid-column: 1 / -1;
}

.fulfill__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.fulfill__footer .button-row {
  margin-left: auto;
}

.toggle--inline {
  align-items: center;
  gap: var(--space-2);
}

.toggle--inline .checkbox {
  margin-top: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.section-title-row .label-heading {
  margin-bottom: 0;
}

.btn--icon-small {
  width: 2rem;
  height: 2rem;
  margin: calc(var(--space-2) * -1) calc(var(--space-2) * -1) calc(var(--space-2) * -1) 0;
}

.input--postcode {
  max-width: 10rem;
}

/* Order timeline: the shop's events and the portal's own, newest first */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) auto;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: calc(0.5rem - 1px);
  top: 1rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__item:last-child::before {
  display: none;
}

.timeline__dot {
  width: 0.625rem;
  height: 0.625rem;
  margin: 0.3125rem 0 0 0.1875rem;
  border-radius: var(--radius-full);
  background: var(--border-strong);
}

.timeline__body p + p {
  margin-top: 2px;
}

/* Bigger photo when a thumbnail is clicked */
.thumb-button {
  display: inline-flex;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: zoom-in;
}

.lightbox {
  width: min(40rem, calc(100vw - 2rem));
}

.lightbox__image {
  width: 100%;
  height: auto;
  max-height: 70dvh;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
}

.tracking-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.tracking-link:hover {
  border-color: var(--border-strong);
}

.tracking-link__carrier {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.3333;
}

/* ---------- Stat tiles ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

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

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

.stat {
  padding: var(--space-4);
}

.stat__label {
  color: var(--text-secondary);
}

.stat__value {
  margin-top: var(--space-1);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.3333;
  font-variant-numeric: tabular-nums;
}

.stat__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  font-weight: 500;
  text-decoration: none;
}

.stat__link:hover {
  text-decoration: underline;
}

.stat__note {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  color: var(--text-secondary);
}

.stat__value--danger,
.stat__note--danger {
  color: var(--danger-text);
}

/* Week against last week: green up, red down. */
.stat__trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.stat__trend--up {
  background: var(--success-tint);
  color: var(--success-text);
}

.stat__trend--down {
  background: var(--danger-tint);
  color: var(--danger-text);
}

/* ---------- Needs attention: one line per order ---------- */

.attention-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.attention-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  text-decoration: none;
}

.attention-item:hover {
  background: var(--surface-2);
}

.attention-item__icon {
  display: inline-flex;
}

.attention-item__icon--danger {
  color: var(--danger-text);
}

.attention-item__icon--warning {
  color: var(--warning-solid);
}

.attention-item__number {
  flex: none;
  min-width: 7rem;
  font-weight: 600;
}

.attention-item__text {
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
}

.attention-item > svg:last-child {
  color: var(--text-secondary);
}

/* ---------- Banner (one line that needs action, with its button) ---------- */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.banner__title {
  font-weight: 600;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 2.25rem;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast) ease-out, border-color var(--duration-fast) ease-out;
}

.btn--primary {
  background: var(--accent-solid);
  color: var(--text-on-accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

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

.btn--secondary:hover {
  background: var(--surface-2);
}

.btn--tertiary {
  background: transparent;
  color: var(--text-primary);
  padding: 0 var(--space-2);
}

.btn--tertiary:hover {
  background: var(--surface-2);
}

.btn--danger {
  background: var(--danger-solid);
  color: #ffffff;
}

.btn--danger:hover {
  background: var(--danger-text);
}

.btn--icon {
  width: 2.25rem;
  padding: 0;
}

.btn--small {
  height: 2rem;
  padding: 0 var(--space-3);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.is-loading {
  pointer-events: none;
}

.btn .spinner {
  display: none;
}

.btn.is-loading .spinner {
  display: inline-block;
}

.btn.is-loading .btn__icon {
  display: none;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 700ms linear infinite;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

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

.field + .field {
  margin-top: var(--space-4);
}

.label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 500;
}

.hint {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.3333;
}

.input,
.select {
  width: 100%;
  height: 2.25rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
}

.select {
  appearance: none;
  padding-right: var(--space-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
}

.input--mono {
  font-family: var(--font-mono);
}

.input--narrow {
  width: 6rem;
}

.input--tracking {
  min-width: 14rem;
}

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

.field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  margin-top: var(--space-1);
  color: var(--danger-text);
  font-size: var(--text-xs);
  line-height: 1.3333;
}

/* What Shopify or bol answered, under our own sentence. */
.field-error__detail {
  display: block;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.field-intro {
  margin-bottom: var(--space-4);
}

.checkbox {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent-solid);
  cursor: pointer;
}

.check-target {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

.toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.toggle .checkbox {
  margin-top: 2px;
}

.toggle__text strong {
  display: block;
  font-weight: 500;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.form-error {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--danger-tint);
  color: var(--danger-text);
}

/* ---------- Status badges, channel tags and plain tags ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 1.375rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* Products: the chevron that opens a colour's sets turns when open. */
.data-table th.col-expand,
.data-table td.col-expand {
  width: 2.5rem;
  padding-right: 0;
}

.sets-toggle svg {
  transition: transform 150ms ease;
}

.sets-toggle[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

tr[data-toggle-row] {
  cursor: pointer;
}

tr[data-toggle-row]:hover td {
  background: var(--surface-2);
}

.reach-list {
  display: grid;
  gap: var(--space-2);
}

.reach-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Flags and the Bol label share one column, so the texts line up. */
.reach-list__mark {
  display: inline-flex;
  justify-content: center;
  flex: none;
  width: 2.25rem;
}

/* A pill with an icon has no dot. */
.pill--icon::before {
  content: none;
}

.pill--icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

.pill--unfulfilled {
  background: var(--warning-tint);
  color: var(--warning-text);
}

.pill--fulfilled,
.pill--neutral {
  background: var(--surface-2);
  color: var(--text-secondary);
  box-shadow: inset 0 0 0 1px var(--border);
}

.pill--success {
  background: var(--success-tint);
  color: var(--success-text);
}

.pill--info {
  background: var(--info-tint);
  color: var(--info-text);
}

.pill--danger,
.pill--hold {
  background: var(--danger-tint);
  color: var(--danger-text);
}

.channel {
  display: inline-flex;
  align-items: center;
  height: 1.375rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.channel--shopify {
  background: var(--shopify-tint);
  color: var(--shopify-text);
}

.channel--bol {
  background: var(--bol-tint);
  color: var(--bol-text);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 1.375rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

/* Rule chips on the supplier page */
.chips {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: var(--space-2) var(--space-3);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-secondary);
}

.chip strong {
  color: var(--text-primary);
  font-weight: 500;
}

.copy-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  border-radius: 6px;
  background: var(--surface-2);
}

.copy-field code {
  flex: 1 1 12rem;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

/* A Shopify tag, written exactly as it must be typed. */
.code-tag {
  padding: 0.125rem var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* ---------- Inline notices (next to the thing they are about) ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-weight: 500;
}

.notice--danger {
  background: var(--danger-tint);
  color: var(--danger-text);
}

.notice--warning {
  background: var(--warning-tint);
  color: var(--warning-text);
}

.notice--info {
  background: var(--info-tint);
  color: var(--info-text);
}

.notice--neutral {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 400;
}

.notice--success {
  background: var(--success-tint);
  color: var(--success-text);
}

/* A notice with its fix next to it, such as "Fix address". */
.notice--action {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.notice--action > span {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
  flex: 1 1 16rem;
}

.notice .icon-sm {
  margin-top: 2px;
}

/* ---------- Tabs and segmented control ---------- */

.tabs {
  display: flex;
  gap: var(--space-1);
  margin: 0;
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 2.75rem;
  padding: 0 var(--space-2);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

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

.tabs__tab[aria-selected="true"] {
  border-bottom-color: var(--accent-solid);
  color: var(--text-primary);
  font-weight: 600;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.segmented__option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 1.75rem;
  padding: 0 var(--space-3);
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.segmented__option[aria-current="true"] {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  font-weight: 600;
}

/* ---------- Data tables ---------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  height: 2.25rem;
  padding: 0 var(--space-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-2) var(--space-3);
  height: 3rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.card > .data-table:first-child thead tr:first-child th:first-child {
  border-top-left-radius: calc(var(--radius-md) - 1px);
}

.card > .data-table:first-child thead tr:first-child th:last-child {
  border-top-right-radius: calc(var(--radius-md) - 1px);
}

.data-table tr[data-href] {
  cursor: pointer;
}

.data-table tr[data-href]:hover td {
  background: var(--surface-2);
}

.data-table .col-check {
  width: 2.75rem;
  padding: 0 0 0 var(--space-2);
}

.data-table .col-menu {
  width: 3rem;
  padding: 0 var(--space-2) 0 0;
  text-align: right;
}

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

.data-table .col-status {
  text-align: center;
}

.data-table .col-thumb {
  width: 3.5rem;
  padding-right: 0;
}

/* Products: every colour group is its own table; fixed widths keep the
   Stock column and the buttons in the same place in all of them. */
@media (min-width: 768px) {
  .stock-table {
    table-layout: fixed;
  }

  .stock-table .col-linked {
    width: 13rem;
  }

  .stock-table .col-stock {
    width: 11rem;
  }

  .stock-table .col-menu {
    width: 12.5rem;
  }
}

.cell-title {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.cell-title:hover {
  text-decoration: underline;
}

/* Order number with its marks: red for an incomplete address, a badge when hidden. */
.cell-order {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.order-flag {
  display: inline-flex;
  color: var(--danger-solid);
}

/* Channel with, for the admin, a crossed-out eye when the supplier does not see the order. */
.cell-channel {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.hidden-mark {
  display: inline-flex;
  color: var(--text-muted);
}

/* Short reason on hover or focus, straight away (a title attribute waits and needs a still mouse). */
.tip {
  position: relative;
  cursor: help;
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  z-index: var(--z-dropdown);
  width: max-content;
  max-width: 18rem;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--accent-solid);
  color: var(--text-on-accent);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  box-shadow: var(--shadow-popup);
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tip:hover::after,
.tip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.cell-sub {
  color: var(--text-secondary);
}

.cell-customer {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 16rem;
}

.cell-customer__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flag {
  flex: none;
  width: 1.25rem;
  height: 0.875rem;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--border);
}

/* Less important columns step aside on smaller laptops; the order page shows everything. */
@media (max-width: 1279px) {
  .data-table .hide-lg-cell {
    display: none;
  }

  .data-table th,
  .data-table td {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }
}

@media (max-width: 1099px) {
  .data-table .hide-md-cell {
    display: none;
  }
}

/* Bulk actions take the place of the column headings while orders are selected. */
.thead-bulk {
  display: none;
}

.is-selecting .thead-default {
  display: none;
}

.is-selecting .thead-bulk {
  display: table-row;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.bulk-bar__count {
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--text-sm);
  margin-right: auto;
}

.thead-bulk th {
  padding-top: var(--space-1);
  padding-bottom: var(--space-1);
}

.only-mobile-cell {
  display: none;
}

/* Thumbnails of the ordered products in a table row */
.ordered {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.ordered__thumbs {
  display: inline-flex;
  gap: var(--space-1);
}

.ordered__count {
  white-space: nowrap;
}

.ordered__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-2);
}

/* ---------- Products in an order ---------- */

.product-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}

.product-row__title {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.product-row__meta {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.3333;
  overflow-wrap: anywhere;
}

.product-row__qty {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.thumb {
  flex: none;
  width: 3.5rem;
  max-width: none;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  object-fit: contain;
}

.thumb--small {
  width: 2.5rem;
}

.thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--surface-2);
}

/* Products by colour: one row per colour, its sets fold open below it */
.data-table tr[hidden] {
  display: none !important;
}

.set-row td {
  background: var(--surface-2);
}

.set-row td:nth-child(2) {
  padding-left: var(--space-6);
}

.plain-list {
  margin: 0;
  padding-left: var(--space-4);
}

/* Linked products, folded open inside a table cell */
.listing-details summary {
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
}

.listing-list {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.listing-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  overflow-wrap: anywhere;
}

/* ---------- Menus (details/summary) ---------- */

.menu {
  position: relative;
  display: inline-block;
}

.menu > summary {
  list-style: none;
}

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

.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-1));
  z-index: var(--z-dropdown);
  min-width: 13rem;
  padding: var(--space-1);
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popup);
  text-align: left;
}

.menu__label {
  padding: var(--space-2) var(--space-3) var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: normal;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 2.25rem;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.menu__item:hover {
  background: var(--surface-2);
}

.menu__item[aria-current="true"] {
  font-weight: 600;
}

.menu__item[aria-disabled="true"] {
  color: var(--text-muted);
  cursor: not-allowed;
}

.menu__item .check {
  margin-left: auto;
}

.menu__divider {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--border);
}

.menu__button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 2.25rem;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.menu__button:hover {
  background: var(--surface-2);
}

.menu__button--outlined {
  border-color: var(--border-strong);
}

.menu form {
  margin: 0;
}

/* ---------- Dialogs ---------- */

.dialog {
  width: min(32rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-dialog);
}

.dialog::backdrop {
  background: var(--scrim);
}

.dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in var(--duration-panel) ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.dialog__header h2 {
  font-size: var(--text-md);
  line-height: 1.5;
}

.dialog__body {
  padding: var(--space-4) var(--space-6);
  overflow-y: auto;
}

.dialog__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--border);
}

.dialog form {
  display: contents;
}

.dialog__body > .field + .notice {
  margin-top: var(--space-4);
}

/* ---------- Toast ---------- */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  z-index: var(--z-toast);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 2rem);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--accent-solid);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-popup);
  animation: toast-in var(--duration-panel) ease-out;
}

.toast p + p {
  margin-top: var(--space-1);
  opacity: 0.85;
}

.toast[hidden] {
  display: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Empty states ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-4);
  text-align: center;
}

.empty .icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--text-muted);
}

.empty h2 {
  font-size: var(--text-md);
  line-height: 1.5;
}

.empty p {
  max-width: 28rem;
  color: var(--text-secondary);
}

.empty .btn {
  margin-top: var(--space-2);
}

/* ---------- Login ---------- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-4);
}

.login-card {
  width: min(25rem, 100%);
  padding: var(--space-8) var(--space-6);
}

.login-card__logo {
  height: 2.5rem;
  width: auto;
  margin-bottom: var(--space-6);
}

.login-card h1 {
  margin-bottom: var(--space-6);
}

.login-card form + .login-card__footer,
.login-card .notice + .login-card__footer,
.login-card .form-error + .login-card__footer,
.login-card .secondary + .login-card__footer {
  margin-top: var(--space-6);
}

.login-card__footer {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.login-card .secondary {
  margin-bottom: var(--space-4);
}

/* ---------- Filters and search ---------- */

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.search {
  position: relative;
  width: min(20rem, 100%);
}

.search .icon-sm {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search .input {
  padding-left: var(--space-8);
}

.filters {
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.filters__row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: var(--space-3);
  align-items: end;
}

.filters .field + .field {
  margin-top: 0;
}

.filters__actions {
  display: flex;
  gap: var(--space-2);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */

.only-mobile,
.show-mobile {
  display: none;
}

.drawer-scrim {
  display: none;
}

@keyframes drawer-in {
  from {
    transform: translateX(-16px);
    opacity: 0;
  }
}

@media (max-width: 1023px) {
  .main {
    padding: var(--space-6);
  }

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

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

  .filters__actions {
    grid-column: 1 / -1;
  }

  /* Supplier navigation becomes a bottom tab bar; the longer admin
     navigation opens as a drawer from the menu button. */
  .sidebar {
    display: none;
  }

  .layout--tabbar .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-sidebar);
    display: block;
    width: auto;
    padding: 0 0 env(safe-area-inset-bottom);
    border-right: 0;
    border-top: 1px solid var(--border);
  }

  .layout--tabbar .nav {
    flex-direction: row;
    gap: 0;
  }

  .layout--tabbar .nav li {
    flex: 1;
  }

  .layout--tabbar .nav__link {
    flex-direction: column;
    justify-content: center;
    gap: var(--space-1);
    min-height: 3.5rem;
    padding: var(--space-1);
    border-radius: 0;
    font-size: var(--text-xs);
  }

  .layout--tabbar .nav__link[aria-current="page"] {
    background: transparent;
    box-shadow: inset 0 2px 0 var(--accent-solid);
  }

  .layout--tabbar .main {
    padding-bottom: calc(var(--space-12) + 3.5rem + env(safe-area-inset-bottom));
  }

  .layout--drawer .sidebar.is-open {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    z-index: var(--z-sidebar);
    display: block;
    width: min(18rem, 85vw);
    box-shadow: var(--shadow-dialog);
    animation: drawer-in var(--duration-panel) ease-out;
  }

  .drawer-scrim.is-open {
    position: fixed;
    inset: var(--topbar-height) 0 0 0;
    z-index: calc(var(--z-sidebar) - 1);
    display: block;
    background: var(--scrim);
  }

  .only-mobile {
    display: inline-flex;
  }
}

@media (max-width: 767px) {
  .main {
    padding: var(--space-4);
  }

  .topbar {
    gap: var(--space-2);
    padding: 0 var(--space-2) 0 var(--space-4);
  }

  .topbar__product,
  .hide-mobile {
    display: none;
  }

  .show-mobile {
    display: inline-flex;
  }

  .topbar__logo {
    height: 1.625rem;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
  }

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

  .stat {
    padding: var(--space-3);
  }

  .stat__label {
    font-size: var(--text-xs);
    line-height: 1.3333;
  }

  .stat__value {
    font-size: var(--text-xl);
  }

  .page-header__actions {
    width: 100%;
  }

  .page-header__actions > .btn,
  .page-header__actions > form > .btn {
    flex: 1;
  }

  .dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 90dvh;
    margin: auto 0 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .dialog__footer .btn {
    flex: 1;
  }

  .toast-region {
    bottom: calc(3.5rem + var(--space-4) + env(safe-area-inset-bottom));
  }

  /* Tables become one compact block per row. Order tables keep number,
     status and menu on one line; other tables stack their cells. */
  .data-table,
  .data-table thead,
  .data-table tbody {
    display: block;
    width: 100%;
  }

  .data-table thead tr {
    display: flex;
    align-items: center;
  }

  .data-table thead tr.thead-bulk,
  .is-selecting thead tr.thead-default {
    display: none;
  }

  .is-selecting thead tr.thead-bulk {
    display: flex;
  }

  .data-table thead tr {
    min-height: 2.75rem;
  }

  .data-table thead th {
    display: flex;
    align-items: center;
    height: auto;
    align-self: stretch;
  }

  .data-table thead th.only-mobile-cell {
    padding-left: 0;
  }

  .thead-bulk th[colspan] {
    flex: 1;
    padding-left: 0;
  }

  .bulk-bar {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .data-table:not(.data-table--selectable) thead {
    display: none;
  }

  .data-table thead .thead-default th:not(.col-check):not(.only-mobile-cell) {
    display: none;
  }

  .data-table thead th.only-mobile-cell {
    display: flex;
    flex: 1;
  }

  .data-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1) var(--space-2);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
  }

  .data-table--pair tbody tr {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .orders-table tbody tr {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding-right: var(--space-2);
  }

  .orders-table.data-table--selectable tbody tr {
    grid-template-columns: 2rem minmax(0, 1fr) auto auto;
    padding-left: var(--space-2);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table tbody td {
    height: auto;
    padding: 0;
    border: 0;
  }

  .data-table tbody td.hide-mobile-cell {
    display: none;
  }

  .data-table tbody td.only-mobile-cell {
    display: block;
    grid-column: 1 / -1;
    color: var(--text-secondary);
  }

  .data-table--selectable tbody td.only-mobile-cell {
    grid-column: 2 / -1;
  }

  .data-table .col-check {
    width: auto;
    padding: 0;
  }

  .data-table--selectable tbody .col-check {
    grid-row: span 2;
  }

  .data-table .col-menu {
    width: auto;
    padding: 0;
  }

  .data-table .col-num {
    text-align: left;
  }

  .product-row {
    grid-template-columns: 3rem minmax(0, 1fr) auto;
  }

  .tracking-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .fulfill__footer .button-row {
    width: 100%;
  }

  .fulfill__footer .btn {
    flex: 1;
  }

  .thumb {
    width: 3rem;
  }
}

@media (pointer: coarse) {
  .btn,
  .input,
  .select {
    min-height: 2.75rem;
  }

  .btn--small {
    height: 2.75rem;
  }

  .menu__item {
    min-height: 2.75rem;
  }

  .check-target {
    width: 2.75rem;
    height: 2.75rem;
  }

  .input,
  .select {
    font-size: var(--text-md);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
