/* ============================================================
   Fruitly design system — from Brand System v3
   Palette: Warm Paper / Natural Green / Citrus Orange / Deep Leaf
   Type: Archivo Expanded (display) · Instrument Sans (UI)
         Instrument Serif italic (brand line, once per page)
   ============================================================ */

:root {
  /* colour */
  --paper: #FBF8F3;
  --sand: #F4F1EA;
  --green: #157A3E;
  --orange: #F26B1D;
  --orange-deep: #C2500F;
  --leaf: #132A1D;
  --mango: #FFC233;
  --kiwi: #A8C64D;
  --melon: #FF6B5A;
  --berry: #8E3B6B;

  --ink: #132A1D;
  --ink-75: rgba(19, 42, 29, 0.75);
  --ink-60: rgba(19, 42, 29, 0.6);
  --ink-50: rgba(19, 42, 29, 0.5);
  --ink-42: rgba(19, 42, 29, 0.42);
  --hairline: rgba(19, 42, 29, 0.08);
  --hairline-soft: rgba(19, 42, 29, 0.06);
  --outline: rgba(19, 42, 29, 0.14);

  --green-tint: rgba(21, 122, 62, 0.1);
  --orange-tint: rgba(242, 107, 29, 0.12);
  --berry-tint: rgba(142, 59, 107, 0.1);

  /* shape + depth */
  --r-chip: calc(12px * var(--ui));
  --r-input: calc(20px * var(--ui));
  --r-card: calc(28px * var(--ui));
  --r-band: calc(32px * var(--ui));
  --shadow-rest: 0 1px 2px rgba(18, 37, 26, 0.04), 0 18px 40px -26px rgba(18, 37, 26, 0.2);
  --shadow-lift: 0 2px 4px rgba(18, 37, 26, 0.06), 0 30px 60px -28px rgba(18, 37, 26, 0.36);

  /* --ui scales the whole interface on large displays. It is 1 up to a
     normal desktop and is raised in tiers further down, keyed on width AND
     height so a short ultrawide never scales like a 4K panel. */
  --ui: 1;

  /* spacing — one 4pt-based scale, fluid where it should breathe */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: calc(12px * var(--ui));
  --space-md: calc(16px * var(--ui));
  --space-lg: calc(clamp(20px, 2.2vw, 24px) * var(--ui));
  --space-xl: calc(clamp(24px, 3vw, 32px) * var(--ui));
  --space-2xl: calc(clamp(32px, 4.5vw, 48px) * var(--ui));
  --space-3xl: calc(clamp(40px, 6vw, 72px) * var(--ui));
  --gutter: clamp(18px, 4.5vw, 64px);   /* page side padding */
  --card-pad: calc(clamp(22px, 2.6vw, 34px) * var(--ui)); /* inner padding of a card */

  /* the reading column; content wider than this is a layout, not prose */
  --measure: 68ch;
  --page-max: 1312px;

  /* control sizing — grows on touch, stays tight for the mouse */
  --tap: calc(40px * var(--ui));
  --day-size: calc(34px * var(--ui));

  /* motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* type */
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Archivo", "Archivo Black", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}

/* Touch devices get real hit areas; pointer devices keep the tighter rhythm. */
@media (pointer: coarse) {
  :root { --tap: 44px; --day-size: 42px; }
}

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

/* The hidden attribute only carries `display: none` from the UA sheet, so any
   author rule that sets display — a .field class, an inline style="display:flex"
   — silently outranks it and el.hidden = true does nothing. Every toggle in this
   codebase uses .hidden, so make it win. */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 calc(16px * var(--ui))/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--orange); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(255, 194, 51, 0.4); }

/* ---------- layout ---------- */
.wrap {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right));
}
.section { padding-block: var(--space-3xl); }
.section--tight { padding-block: clamp(24px, 4vw, 44px); }

.grid { display: grid; gap: var(--space-lg); }
/* auto-fit keeps cards at a comfortable size at every width, so the layout
   reflows continuously instead of snapping at two hard breakpoints. */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(320px * var(--ui))), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(280px * var(--ui))), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(250px * var(--ui))), 1fr)); }

/* ---------- type ---------- */
.display {
  max-width: 18ch;
  font-family: var(--display);
  font-variation-settings: "wdth" 122;
  font-weight: 800;
  font-size: calc(clamp(38px, 4.8vw, 68px) * var(--ui));
  line-height: 0.98;
  letter-spacing: -0.05em;
  margin: 0;
  text-wrap: balance;
}
.h1 {
  font-family: var(--display);
  font-variation-settings: "wdth" 120;
  font-weight: 800;
  font-size: calc(clamp(32px, 3.4vw, 48px) * var(--ui));
  line-height: 1;
  letter-spacing: -0.045em;
  margin: 0;
}
.h2 {
  font-family: var(--display);
  font-variation-settings: "wdth" 118;
  font-weight: 800;
  font-size: calc(clamp(26px, 2.7vw, 38px) * var(--ui));
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0;
}
.h3 {
  font-family: var(--display);
  font-variation-settings: "wdth" 112;
  font-weight: 700;
  font-size: calc(clamp(19px, 1.6vw, 22px) * var(--ui));
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
}
.lede { font-size: calc(clamp(16px, 1.35vw, 19px) * var(--ui)); line-height: 1.55; color: var(--ink-60); max-width: min(60ch, var(--measure)); text-wrap: pretty; margin: 0; }
.label {
  font: 600 calc(clamp(11.5px, 0.78vw, 12px) * var(--ui))/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-42);
}
.label--green { color: var(--green); }
.brandline { font-family: var(--serif); font-style: italic; font-size: calc(clamp(20px, 2vw, 26px) * var(--ui)); line-height: 1.2; color: var(--mango); }
.muted { color: var(--ink-60); }
.small { font-size: calc(14px * var(--ui)); }
.price { font-family: var(--display); font-variation-settings: "wdth" 112; font-weight: 700; letter-spacing: -0.02em; }
.price--card { font-size: calc(19px * var(--ui)); }
.price--total { font-size: calc(26px * var(--ui)); }
.price--mango { color: var(--mango); }
.h3--step { font-size: calc(22px * var(--ui)); }
.lede--sm { font-size: calc(17px * var(--ui)); }
.wordmark--sm { font-size: calc(23px * var(--ui)); }
.wordmark--lg { font-size: calc(27px * var(--ui)); }
.wordmark--xl { font-size: calc(32px * var(--ui)); }

/* ---------- navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid rgba(19, 42, 29, 0.07);
}
.navbar__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); min-height: calc(76px * var(--ui)); }
.navbar__brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); }
.navbar__brand:hover { color: var(--ink); }
.wordmark {
  font-family: var(--display);
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: calc(26px * var(--ui));
  line-height: 0.9;
  letter-spacing: -0.055em;
}
.navbar__links { display: flex; align-items: center; gap: clamp(18px, 2.4vw, 34px); }
.navbar__links a {
  font: 500 calc(15px * var(--ui))/1 var(--sans); color: var(--ink-75);
  display: inline-flex; align-items: center;
  min-height: var(--tap); padding: 0 2px;
}
.navbar__links a:hover { color: var(--green); }
.navbar__links a[aria-current="page"] { color: var(--green); font-weight: 600; }
.navbar__actions { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: calc(40px * var(--ui)); height: calc(40px * var(--ui)); border-radius: 999px;
  background: var(--sand);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
}
.avatar:hover { background: #ece7db; color: var(--ink); }
.nav-toggle { display: none; width: 44px; height: 44px; border-radius: 12px; align-items: center; justify-content: center; }
.nav-toggle:hover { background: var(--sand); }

/* box badge on the nav basket */
.boxbadge { position: relative; }
.boxbadge[data-count]:not([data-count="0"])::after {
  content: attr(data-count);
  position: absolute; top: -4px; right: -6px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px;
  background: var(--orange); color: #fff;
  font: 600 11px/19px var(--sans); text-align: center;
}

/* ---------- buttons, chips, pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: calc(52px * var(--ui)); padding: 0 calc(30px * var(--ui));
  border-radius: 999px;
  font: 600 calc(16px * var(--ui))/1 var(--sans);
  white-space: nowrap;
  transition: transform 120ms var(--ease), background 160ms var(--ease), box-shadow 160ms var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--orange); color: #fff; }
.btn--primary:hover { background: #e05f14; color: #fff; }
.btn--green { background: var(--green); color: #fff; }
.btn--green:hover { background: #106232; color: #fff; }
.btn--outline { background: #fff; color: var(--ink); border: 1px solid var(--outline); }
.btn--outline:hover { border-color: rgba(19, 42, 29, 0.3); color: var(--ink); }
.btn--ghost-dark { background: rgba(255, 255, 255, 0.12); color: #fff; }
.btn--ghost-dark:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.btn--white { background: #fff; color: var(--leaf); }
.btn--white:hover { background: var(--sand); color: var(--leaf); }
.btn--sm { height: calc(44px * var(--ui)); padding: 0 calc(22px * var(--ui)); font-size: calc(14px * var(--ui)); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: max(44px, var(--tap)); padding: 0 calc(20px * var(--ui));
  border-radius: var(--r-chip);
  background: var(--sand);
  font: 500 calc(15px * var(--ui))/1 var(--sans);
  color: var(--ink);
  transition: background 140ms var(--ease), color 140ms var(--ease), transform 120ms var(--ease);
}
.chip:hover { background: #ece7db; }
.chip:active { transform: scale(0.97); }
.chip.is-on { background: var(--leaf); color: #fff; }
.chip.is-on:hover { background: #1d3c2b; }
.chip--sm { height: max(36px, var(--tap)); padding: 0 16px; font-size: calc(14px * var(--ui)); }
.chip--never { background: var(--berry-tint); color: var(--berry); }
.chip--never:hover { background: rgba(142, 59, 107, 0.16); }
.chip--add { background: transparent; border: 1px dashed rgba(19, 42, 29, 0.25); color: var(--ink-50); }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: calc(30px * var(--ui)); padding: 0 calc(13px * var(--ui));
  border-radius: 999px;
  font: 600 clamp(11.5px, 0.8vw, 12px)/1 var(--sans);
  white-space: nowrap;
}
.pill--fresh, .pill--ok { background: var(--green-tint); color: var(--green); }
.pill--warn { background: var(--orange-tint); color: var(--orange-deep); }
.pill--neutral { background: var(--sand); color: var(--ink-60); }
.pill--dark { background: rgba(255, 255, 255, 0.12); color: #fff; }
.pill--mango { background: rgba(255, 194, 51, 0.18); color: #8a6414; }
.pill .dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }

/* ---------- cards ---------- */
.card {
  background: #fff;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-rest);
}
.card--pad { padding: var(--card-pad); }
.card--dark { background: var(--leaf); color: #fff; box-shadow: none; }
.card--sand { background: var(--sand); box-shadow: none; }
.card--lift { box-shadow: var(--shadow-lift); }

/* product card */
.product { display: flex; flex-direction: column; overflow: hidden; }
.product__art { height: 160px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.product__body { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 8px; flex-grow: 1; }
.product__meta { font-size: calc(14px * var(--ui)); color: var(--ink-60); }
.product__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 10px; }
.product.is-out .h3, .product.is-out .price { color: var(--ink-50); }
.product.is-out .product__art { filter: saturate(0.35) opacity(0.75); }

/* rows in list cards */
.rowlist { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--hairline-soft); }
.row:last-child { border-bottom: 0; }
.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.datechip {
  flex: none;
  width: calc(44px * var(--ui)); height: calc(44px * var(--ui)); border-radius: 14px;
  background: var(--sand);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font: 600 calc(10.5px * var(--ui))/1.2 var(--sans); color: var(--ink-60); text-transform: uppercase;
}
.datechip b { font: 700 calc(15px * var(--ui))/1 var(--sans); color: var(--ink); }

/* ---------- day dots / week strip ---------- */
.days { display: flex; gap: clamp(4px, 1.2vw, 7px); }
.day {
  flex: 1 1 0;
  min-width: 0;
  max-width: var(--day-size);
  aspect-ratio: 1;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sand); color: var(--ink-42);
  font: 600 calc(12px * var(--ui))/1 var(--sans);
  transition: background 140ms var(--ease), color 140ms var(--ease), transform 120ms var(--ease);
}
button.day:hover { background: #ece7db; }
button.day:active { transform: scale(0.94); }
.day.is-on { background: var(--green); color: #fff; }
.days--dark .day { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.45); }
.days--dark .day.is-on { background: var(--mango); color: var(--leaf); }

/* ---------- stepper ---------- */
.stepper { display: inline-flex; align-items: center; gap: 14px; }
.stepper__btn {
  width: var(--tap); height: var(--tap); border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 500 calc(18px * var(--ui))/1 var(--sans);
  transition: transform 120ms var(--ease), background 140ms var(--ease);
}
.stepper__btn:active { transform: scale(0.92); }
.stepper__btn--minus { background: #fff; border: 1px solid var(--outline); }
.stepper__btn--minus:hover { border-color: rgba(19, 42, 29, 0.3); }
.stepper__btn--plus { background: var(--green); color: #fff; }
.stepper__btn--plus:hover { background: #106232; }
.stepper__count { font: 600 calc(16px * var(--ui))/1 var(--sans); min-width: calc(58px * var(--ui)); text-align: center; }

/* Inline text actions ("Browse all fruit →") still need a finger-sized target. */
@media (pointer: coarse) {
  .wrap a:not(.btn):not(.navbar__brand):not(.avatar),
  .footer__links a,
  main > div a:not(.btn):not(.navbar__brand) {
    display: inline-flex; align-items: center; justify-content: inherit;
    min-height: var(--tap);
  }
}

/* ---------- rating stars ---------- */
.stars { display: inline-flex; gap: 2px; }
.star {
  width: var(--tap); height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  transition: background 140ms var(--ease), transform 120ms var(--ease);
}
.star:hover { background: rgba(255, 194, 51, 0.16); }
.star:active { transform: scale(0.9); }

/* Text-style actions ("Skip", "Remove", "Reorder") — look like links, sized like controls. */
.textbtn {
  display: inline-flex; align-items: center;
  min-height: var(--tap);
  font: 600 calc(14px * var(--ui))/1 var(--sans);
  color: var(--green);
  border-radius: 8px;
  transition: color 140ms var(--ease);
}
.textbtn:hover { color: var(--orange); }
.textbtn--danger { color: #B3330E; }
.textbtn--danger:hover { color: #8f2909; }

/* Text-style actions inside rows still need a real hit area. */
.row button:not(.btn):not(.day):not(.stepper__btn),
.row a:not(.btn) { min-height: var(--tap); display: inline-flex; align-items: center; }

/* ---------- status timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 16px; }
.timeline__item { display: flex; align-items: center; gap: 14px; }
.timeline__dot { width: calc(11px * var(--ui)); height: calc(11px * var(--ui)); border-radius: 999px; flex: none; background: rgba(19, 42, 29, 0.15); }
.timeline__item.is-done .timeline__dot { background: var(--kiwi); }
.timeline__item.is-now .timeline__dot { background: var(--mango); }
.timeline__item.is-now { font-weight: 500; }
.timeline__label { flex: 1; color: var(--ink-75); }
.timeline__item.is-todo .timeline__label { color: var(--ink-42); }
.timeline__time { font: 500 calc(14px * var(--ui))/1 var(--sans); color: var(--ink-50); }

/* ---------- tables (admin) ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  font: 600 11.5px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-42);
}
.table td { padding: calc(13px * var(--ui)) 0; border-bottom: 1px solid var(--hairline-soft); font-size: calc(14.5px * var(--ui)); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fruitdot { width: 11px; height: 11px; border-radius: 999px; display: inline-block; margin-right: 10px; vertical-align: baseline; }

/* ---------- footer ---------- */
.footer { padding-bottom: clamp(28px, 4vw, 56px); }
.footer__band {
  background: var(--leaf); color: #fff;
  border-radius: var(--r-band);
  padding: clamp(28px, 3.4vw, 44px) clamp(24px, 3.6vw, 52px);
  display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
}
.footer__links { display: flex; gap: clamp(18px, 2.4vw, 32px); flex-wrap: wrap; }
.footer__links a { font: 500 calc(14px * var(--ui))/1 var(--sans); color: rgba(255, 255, 255, 0.7); }
.footer__links a:hover { color: var(--mango); }
.footer__note { font-size: calc(13px * var(--ui)); color: rgba(255, 255, 255, 0.4); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 620px); gap: clamp(28px, 4vw, 56px); align-items: center; }
.hero__copy { display: flex; flex-direction: column; gap: 24px; align-items: flex-start; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero__proof { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 28px); flex-wrap: wrap; }
.hero__proof span { display: inline-flex; align-items: center; gap: 9px; font: 500 calc(14px * var(--ui))/1 var(--sans); color: var(--ink-60); }
.hero__art {
  position: relative;
  border-radius: var(--r-band);
  overflow: hidden;
  aspect-ratio: 5 / 4;
  max-height: calc(520px * var(--ui));
  background: linear-gradient(150deg, #F4F1EA 0%, #EAE2CF 58%, #E4D9C0 100%);
}
.hero__stamp {
  position: absolute; right: 24px; top: 24px;
  width: 74px; height: 74px; border-radius: 999px;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
}
.hero__ticket {
  position: absolute; left: 20px; right: 20px; bottom: 20px;
  max-width: 480px;
  background: #fff; border-radius: 24px;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow-lift);
}
.meter { display: flex; gap: 8px; }
.meter span { flex: 1; height: 6px; border-radius: 999px; background: var(--sand); }
.meter span.is-done { background: var(--green); }
.meter span.is-now { background: var(--mango); }

/* ---------- bands ---------- */
.band {
  background: var(--green); color: #fff;
  border-radius: var(--r-band);
  padding: clamp(32px, 4.4vw, 56px) clamp(24px, 4.2vw, 60px);
  display: flex; align-items: center; justify-content: space-between; gap: clamp(24px, 3.4vw, 48px);
  flex-wrap: wrap;
}
.band--leaf { background: var(--leaf); }

/* ---------- admin shell ---------- */
.admin { display: flex; min-height: 100dvh; }
.admin__side {
  flex: 0 0 248px;
  background: var(--leaf); color: #fff;
  display: flex; flex-direction: column; gap: 28px;
  padding: 28px 20px;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
.admin__side > a:first-child { min-height: var(--tap); align-items: center; }
.admin__nav { display: flex; flex-direction: column; gap: 4px; }
.admin__nav a {
  display: flex; align-items: center; gap: 13px;
  height: 44px; padding: 0 14px; border-radius: 14px;
  font: 500 14.5px/1 var(--sans); color: rgba(255, 255, 255, 0.65);
}
.admin__nav a svg { color: rgba(255, 255, 255, 0.55); flex: none; }
.admin__nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.admin__nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; }
.admin__nav a[aria-current="page"] svg { color: var(--mango); }
.admin__main {
  flex: 1; min-width: 0;
  /* dashboards get unreadable when rows stretch across an ultrawide display */
  max-width: 1600px;
  padding: var(--space-xl) clamp(18px, 3.2vw, 44px) var(--space-2xl);
  display: flex; flex-direction: column; gap: var(--space-lg);
}
.stat { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 24px; }
.stat__num { font-family: var(--display); font-variation-settings: "wdth" 114; font-weight: 800; font-size: clamp(30px, 2.6vw, 38px); line-height: 1; letter-spacing: -0.03em; }
.stagebar { display: flex; gap: 2px; height: calc(40px * var(--ui)); border-radius: 12px; overflow: hidden; }
.legend { display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 9px; font: 500 13.5px/1 var(--sans); color: var(--ink-75); }
.legend i { width: 12px; height: 12px; border-radius: 4px; font-style: normal; }

/* ---------- dialog ---------- */
dialog.sheet {
  border: 0; padding: 0;
  max-height: 88dvh; overflow-y: auto;
  border-radius: var(--r-card);
  max-width: 440px; width: calc(100vw - 40px);
  box-shadow: var(--shadow-lift);
  background: #fff; color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(19, 42, 29, 0.4); }
.sheet__body { padding: 34px 34px 36px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(8px);
  background: var(--leaf); color: #fff;
  border-radius: 999px; padding: 13px 22px;
  font: 500 calc(14px * var(--ui))/1 var(--sans);
  opacity: 0; pointer-events: none;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
  z-index: 60;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(8px); transition: opacity 240ms var(--ease), transform 240ms var(--ease); }
  .reveal.is-in { opacity: 1; transform: none; }
}
/* Respect the OS setting everywhere, not just for the reveal. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- component-level adaptation ----------
   Cards respond to the space they are given, not the size of the window —
   so a product card in a sidebar behaves like a product card on a phone. */
.product { container-type: inline-size; }
@container (max-width: 230px) {
  .product__art { height: 120px; }
  .product__foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .product__foot .btn { width: 100%; }
}

.stat { container-type: inline-size; }
@container (max-width: 200px) {
  .stat__num { font-size: 30px; }
}

/* Pipeline segments stay visible even when a stage holds a single box. */
.stagebar > span { min-width: 4px; }

/* ---------- viewport layout ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; }
  .hero__art { aspect-ratio: 16 / 10; }
  .admin__side { flex-basis: 220px; }
}

@media (max-width: 860px) {
  .navbar__links {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 10px var(--gutter) 18px;
    box-shadow: var(--shadow-rest);
    max-height: calc(100dvh - 100%); overflow-y: auto;
  }
  .navbar__links a { padding: 14px 2px; font-size: 16px; }
  .navbar.is-open .navbar__links { display: flex; }
  .nav-toggle { display: inline-flex; }
  .navbar__cta { display: none; }

  .admin { flex-direction: column; }
  .admin__side {
    position: sticky; top: 0; z-index: 30;
    height: auto; flex-basis: auto;
    flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: var(--space-sm); padding: 12px var(--gutter);
  }
  .admin__nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .admin__nav a { height: max(38px, var(--tap)); padding: 0 12px; font-size: 14px; }
  .admin__side > a:first-child { min-height: var(--tap); }
  /* the ops identity card is desktop chrome; the header already names the user */
  .admin__side > div:last-child { margin-top: 0; margin-left: auto; }
}

@media (max-width: 620px) {
  .btn { height: max(48px, var(--tap)); padding: 0 22px; }
  .btn--sm { height: max(44px, var(--tap)); padding: 0 18px; }
  .hero__ticket { left: 12px; right: 12px; bottom: 12px; }
  .band { padding: var(--space-xl) var(--space-lg); }
  .row { flex-wrap: wrap; row-gap: 10px; }
  .row__main { flex: 1 1 calc(100% - 62px); }
  /* inline padding written into the markup is too generous on a phone */
  .card--pad,
  .card[style*="padding:30px 34px"],
  .card[style*="padding:36px 40px"],
  .card[style*="padding:32px 34px"],
  .card[style*="padding:28px 32px"],
  .card[style*="padding:26px 30px"],
  .card[style*="padding:8px 34px"],
  .card[style*="padding:8px 40px"] {
    padding-left: var(--space-lg) !important;
    padding-right: var(--space-lg) !important;
  }
  .footer__band { padding: var(--space-xl) var(--space-lg); gap: var(--space-lg); }
  /* a sticky summary eats a phone screen — let it scroll with the page */
  aside[style*="position:sticky"] { position: static !important; max-width: none !important; }
}

/* On phones the week reads better as two generous rows (M T W T / F S S)
   than as seven circles too small to hit. */
@media (max-width: 460px) {
  .days {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .day { max-width: none; width: 100%; }
}

@media (max-width: 380px) {
  :root { --card-pad: 18px; }
  .card--pad,
  .card[style*="padding:30px 34px"],
  .card[style*="padding:32px 34px"],
  .card[style*="padding:28px 32px"],
  .card[style*="padding:36px 40px"] {
    padding-left: 16px !important; padding-right: 16px !important;
  }
}

@media (max-width: 400px) {
  .navbar__inner { min-height: 66px; gap: 8px; }
  .wordmark { font-size: 21px; }
  .avatar { width: max(38px, var(--tap)); height: max(38px, var(--tap)); }
  .navbar__actions { gap: 6px; }
  .nav-toggle { width: var(--tap); }
}

/* ---------- short viewports (phone in landscape, split screen) ----------
   Vertical space is the scarce resource here: shrink the chrome, not the content. */
@media (max-height: 560px) and (orientation: landscape) {
  .navbar { position: static; }
  .navbar__inner { min-height: 60px; }
  .section { padding-block: var(--space-xl); }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 46%); align-items: center; gap: var(--space-xl); }
  .hero__art { aspect-ratio: auto; height: 100%; min-height: 220px; max-height: none; }
  /* the ticket stays anchored to the art; the stamp would collide with it here */
  .hero__ticket { inset: auto 12px 12px; padding: 14px 18px; gap: 10px; }
  .hero__stamp { display: none; }
  .display { font-size: clamp(26px, 4.2vw, 38px); }
  .lede { font-size: 15px; }
  .hero__proof { display: none; }
  aside[style*="position:sticky"] { position: static !important; }
  .admin__side { position: static; }
  dialog.sheet { max-height: 88dvh; overflow-y: auto; }
}

/* ---------- large displays ----------
   A 50" panel is read from across a room, so the interface scales up rather
   than sitting as a small page in a field of paper. --ui drives every size;
   each tier is keyed on width AND height, because 5120x1440 is a desk monitor
   while 3840x2160 may be a television. */

/* Large desktop / 1600–2000px */
@media (min-width: 1600px) and (min-height: 900px) {
  :root { --ui: 1.06; --page-max: 1440px; }
}
/* 1440p-class panels (27"–32") */
@media (min-width: 2200px) and (min-height: 1300px) {
  :root { --ui: 1.2; --page-max: 1900px; }
}
/* 4K 16:9 — a 40"–55" panel at native resolution, viewed from a distance */
@media (min-width: 3000px) and (min-height: 1700px) {
  :root { --ui: 1.5; --page-max: 2600px; }
}
/* 5K / 6K / 8K */
@media (min-width: 4600px) and (min-height: 2300px) {
  :root { --ui: 1.95; --page-max: 4200px; }
}

/* Ultrawide: generous width, ordinary height — viewed at desk distance, so
   widen the frame but scale type gently. These follow the tiers above so they
   win for short-and-wide screens. */
@media (min-width: 2300px) and (max-height: 1199px) {
  :root { --ui: 1.06; --page-max: 1900px; }
}
@media (min-width: 3200px) and (min-height: 1200px) and (max-height: 1699px) {
  :root { --ui: 1.16; --page-max: 2300px; }
}
@media (min-width: 4600px) and (max-height: 1699px) {
  :root { --ui: 1.28; --page-max: 3000px; }
}
/* 5K2K-class ultrawide (5120x2160): tall enough to scale properly */
@media (min-width: 4600px) and (min-height: 1700px) and (max-height: 2299px) {
  :root { --ui: 1.6; --page-max: 3200px; }
}

/* On very wide frames the hero reads better with the art given real presence
   and the copy held to a comfortable measure. */
@media (min-width: 2200px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 48%); gap: var(--space-3xl); }
  .display { max-width: 15ch; }
  .lede { max-width: 40ch; }
}

/* The ops dashboard earns real estate on a big screen: the cut list and the
   order queue sit side by side rather than stacking into one long column. */
@media (min-width: 2200px) {
  /* A dashboard with four tiles stretched across 4K reads as sparse, not
     spacious — hold it to a working width and centre it beside the rail. */
  .admin__main { max-width: calc(1800px * var(--ui)); margin-inline: auto; }
  .admin__side { flex-basis: calc(248px * var(--ui)); }
}

/* ---------- bottom safe area on notched phones ---------- */
@supports (padding: env(safe-area-inset-bottom)) {
  .footer { padding-bottom: max(clamp(28px, 4vw, 56px), env(safe-area-inset-bottom)); }
  .admin__main { padding-bottom: max(var(--space-2xl), env(safe-area-inset-bottom)); }
}
