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

html {
  min-width: 20rem;
  background: var(--c-film);
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--c-film);
  color: var(--c-carbon);
  font-family: var(--font-interface);
  font-size: var(--text-base);
  line-height: var(--leading-copy);
  -webkit-font-smoothing: antialiased;
}

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

button,
select,
summary,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
}

button,
input,
select {
  border-radius: var(--radius-hairline);
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

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

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

ol,
ul {
  padding: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-stretch: condensed;
  line-height: var(--leading-tight);
}

h1 {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
}

h2 {
  font-size: var(--text-lg);
  font-weight: 800;
}

h3 {
  font-size: var(--text-md);
}

[hidden] {
  display: none !important;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--c-registration-cyan);
  outline-offset: 3px;
  box-shadow: var(--focus-ring);
}

::selection {
  background: var(--c-registration-cyan);
  color: var(--c-paper);
}

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

.skip-link {
  position: fixed;
  z-index: calc(var(--z-toast) + 1);
  inset: var(--space-3) auto auto var(--space-3);
  padding: var(--space-3) var(--space-4);
  transform: translateY(-160%);
  background: var(--c-carbon);
  color: var(--c-paper);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.data-label,
.eyebrow,
.field > label,
.field__label,
fieldset > legend,
.period-control > label {
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  line-height: 1.2;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--c-carbon-soft);
}

.eyebrow__mark {
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--c-registration-cyan);
  border-radius: 50%;
  background: linear-gradient(90deg, transparent 44%, var(--c-registration-cyan) 44% 56%, transparent 56%);
}

.eyebrow__mark--magenta {
  border-color: var(--c-registration-magenta);
  background: linear-gradient(90deg, transparent 44%, var(--c-registration-magenta) 44% 56%, transparent 56%);
}

.eyebrow__mark--yellow {
  border-color: var(--c-yellow-ink);
  background: var(--c-plotter-yellow);
}

.button,
.icon-button,
.operator-button,
.text-action,
.source-notice__action,
.status-mark {
  min-height: var(--touch-target);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: 7rem;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  background: var(--c-paper);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}

.button--wide {
  width: 100%;
}

.button--key {
  background: var(--c-carbon);
  color: var(--c-paper);
}

.button--key:hover {
  background: var(--c-carbon-soft);
}

.button--magenta {
  background: var(--c-registration-magenta-ink);
  color: var(--c-paper);
}

.button--magenta:hover {
  background: #82003d;
}

.button--line {
  border-color: var(--c-rule-strong);
  background: var(--c-paper);
}

.button--line:hover {
  border-color: var(--c-carbon);
  background: var(--c-film);
}

.button--line-on-key {
  border-color: rgb(255 255 255 / 55%);
  background: transparent;
  color: var(--c-paper);
}

.button--line-on-key:hover {
  border-color: var(--c-paper);
  background: rgb(255 255 255 / 10%);
}

.button__count {
  display: grid;
  min-width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 50%;
  background: var(--c-registration-cyan);
  color: var(--c-paper);
  font-family: var(--font-data);
  font-size: var(--text-2xs);
}

.icon-button,
.operator-button {
  display: inline-grid;
  width: var(--touch-target);
  min-width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  place-items: center;
  border: 1px solid var(--c-rule-strong);
  background: var(--c-paper);
  font-family: var(--font-data);
  font-weight: 800;
  text-decoration: none;
}

.icon-button:hover,
.operator-button:hover {
  border-color: var(--c-carbon);
  background: var(--c-film);
}

.icon-button--on-key {
  border-color: rgb(255 255 255 / 45%);
  background: transparent;
  color: var(--c-paper);
}

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

.text-action,
.source-notice__action {
  padding: 0 var(--space-2);
  background: transparent;
  color: var(--c-registration-cyan-ink);
  font-size: var(--text-sm);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.text-action:hover,
.source-notice__action:hover {
  color: var(--c-carbon);
}

.field {
  display: grid;
  min-width: 0;
  gap: var(--space-2);
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.period-control select {
  width: 100%;
  min-height: var(--control-height);
  padding: 0.58rem 2.15rem 0.58rem 0.75rem;
  border: 1px solid var(--c-rule-strong);
  background-color: var(--c-paper);
  color: var(--c-carbon);
  font-size: var(--text-sm);
}

.field input:hover,
.field select:hover,
.period-control select:hover {
  border-color: var(--c-carbon);
}

.field input::placeholder {
  color: #707a75;
  opacity: 1;
}

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

.field--inline label {
  white-space: nowrap;
}

.field--inline select {
  width: auto;
  min-width: 11rem;
}

.check-control {
  display: inline-flex;
  min-width: 1.5rem;
  min-height: var(--touch-target);
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 650;
}

.check-control input {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--c-registration-cyan);
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  z-index: var(--z-sticky);
  top: 0;
  border-bottom: 1px solid var(--c-rule);
  background: rgb(247 249 248 / 97%);
  backdrop-filter: blur(12px);
}

.registration-edge {
  display: grid;
  height: var(--registration-height);
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.registration-edge__cyan {
  background: var(--c-registration-cyan);
}

.registration-edge__magenta {
  background: var(--c-registration-magenta);
}

.registration-edge__yellow {
  background: var(--c-plotter-yellow);
}

.registration-edge__key {
  background: var(--c-carbon);
}

.registration-edge.is-exported {
  animation: registration-pass 650ms var(--ease-standard) 1;
}

@keyframes registration-pass {
  0%, 100% { filter: saturate(1); }
  45% { filter: saturate(1.5) brightness(1.12); }
}

.topbar {
  display: grid;
  min-height: var(--topbar-height);
  max-width: var(--content-max);
  align-items: stretch;
  margin-inline: auto;
  padding-inline: var(--page-gutter);
  grid-template-columns: minmax(11rem, 1fr) auto minmax(11rem, 1fr);
  gap: var(--space-5);
}

.brand-lockup {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: var(--space-2);
  color: var(--c-carbon);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-lockup__separator {
  color: var(--c-registration-magenta);
  font-family: var(--font-data);
  font-weight: 400;
}

.brand-lockup__secondary {
  color: var(--c-registration-cyan-ink);
}

.brand-lockup--large {
  font-size: var(--text-2xl);
}

.primary-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.primary-nav__link {
  position: relative;
  display: inline-flex;
  min-height: var(--touch-target);
  align-items: center;
  gap: var(--space-2);
  padding-inline: var(--space-5);
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
  font-weight: 750;
  text-decoration: none;
}

.primary-nav__link::after {
  position: absolute;
  right: var(--space-5);
  bottom: 0;
  left: var(--space-5);
  height: 3px;
  background: transparent;
  content: "";
}

.primary-nav__link:hover {
  color: var(--c-carbon);
}

.primary-nav__link.is-active,
.primary-nav__link[aria-current="page"] {
  color: var(--c-carbon);
}

.primary-nav__link.is-active::after,
.primary-nav__link[aria-current="page"]::after {
  background: var(--c-registration-cyan);
}

.primary-nav__index {
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--font-data);
  font-size: 0.6rem;
}

.operator-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.operator-button {
  border-color: var(--c-carbon);
  background: var(--c-carbon);
  color: var(--c-paper);
  font-size: var(--text-xs);
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.source-chip__dot,
.status-dot {
  width: 0.6rem;
  height: 0.6rem;
  border: 2px solid var(--c-carbon);
  border-radius: 50%;
  background: var(--c-plotter-yellow);
}

.source-notice {
  display: flex;
  min-height: 2.4rem;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 0.35rem var(--page-gutter);
  border-top: 1px solid #ccb04a;
  background: var(--c-warning-surface);
  color: #4d3a00;
  font-family: var(--font-data);
  font-size: var(--text-xs);
}

.source-notice p {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.source-notice__mark {
  width: 0.7rem;
  height: 0.7rem;
  flex: 0 0 auto;
  border: 2px solid var(--c-carbon);
  background: var(--c-plotter-yellow);
  transform: rotate(45deg);
}

.source-notice__action {
  min-height: 2rem;
  color: #4d3a00;
}

.source-notice--compact {
  justify-content: flex-start;
  padding: var(--space-3);
  border: 1px solid #ccb04a;
}

.app-main {
  position: relative;
  width: min(100%, var(--content-max));
  min-height: 70vh;
  margin-inline: auto;
  padding: var(--space-8) var(--page-gutter) 9rem;
}

@media (min-width: 76rem) {
  .app-main {
    padding-left: calc(var(--page-gutter) + 1.5rem);
  }

  .app-main::before {
    position: absolute;
    top: var(--space-8);
    bottom: var(--space-10);
    left: var(--page-gutter);
    width: 0.75rem;
    border-left: 1px solid var(--c-rule-strong);
    background: repeating-linear-gradient(to bottom, transparent 0 0.7rem, var(--c-rule-strong) 0.7rem 0.76rem);
    content: "";
    opacity: 0.8;
  }
}

.app-view:not(.is-active) {
  display: none;
}

.view-header {
  display: grid;
  align-items: end;
  padding-bottom: var(--space-7);
  border-bottom: 2px solid var(--c-carbon);
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-8);
}

.view-header__copy {
  display: grid;
  max-width: 52rem;
  gap: var(--space-3);
}

.view-header__copy > p:last-child {
  max-width: var(--measure-copy);
  color: var(--c-ink-muted);
}

.tally-ruler {
  display: grid;
  min-width: min(100%, 28rem);
  border-top: 1px solid var(--c-carbon);
  border-bottom: 1px solid var(--c-carbon);
  grid-template-columns: repeat(3, minmax(6rem, 1fr));
}

.tally-ruler__item {
  display: grid;
  padding: var(--space-3) var(--space-4);
  border-left: 1px solid var(--c-rule-strong);
  gap: var(--space-1);
}

.tally-ruler__item:last-child {
  border-right: 1px solid var(--c-rule-strong);
}

.tally-ruler dt {
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.tally-ruler dd {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

.filter-bench {
  display: grid;
  align-items: end;
  margin-top: var(--space-7);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--c-rule-strong);
  grid-template-columns: minmax(18rem, 2fr) minmax(10rem, 0.8fr) minmax(10rem, 0.8fr) auto;
  gap: var(--space-4);
}

.filter-bench--history {
  grid-template-columns: minmax(18rem, 2fr) minmax(11rem, 0.8fr) minmax(11rem, 0.8fr);
}

.filter-bench__more {
  display: grid;
  align-items: end;
  padding-top: var(--space-4);
  border-top: 1px dashed var(--c-rule-strong);
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(9rem, 1fr)) auto;
  gap: var(--space-4);
}

.field--more .button {
  width: 100%;
}

.search-control {
  position: relative;
}

.search-control__mark {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 0.85rem;
  width: 0.75rem;
  height: 0.75rem;
  border: 1.5px solid var(--c-carbon);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.search-control__mark::after {
  position: absolute;
  right: -0.35rem;
  bottom: -0.25rem;
  width: 0.42rem;
  height: 1.5px;
  background: var(--c-carbon);
  content: "";
  transform: rotate(45deg);
}

.search-control input[type="search"] {
  padding-left: 2.4rem;
}

.queue-command {
  display: grid;
  min-height: 4.5rem;
  align-items: center;
  padding-block: var(--space-3);
  grid-template-columns: minmax(16rem, 1fr) auto auto;
  gap: var(--space-5);
}

.queue-command__result {
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
}

.production-stack {
  display: grid;
  gap: var(--space-4);
}

.production-sheet {
  position: relative;
  min-width: 0;
  background: var(--c-paper);
}

.production-sheet__header {
  display: grid;
  min-height: 6.2rem;
  align-items: center;
  padding: var(--space-4);
  border: 2px solid var(--c-carbon);
  background:
    linear-gradient(90deg, var(--c-registration-cyan) 0 0.28rem, transparent 0.28rem),
    var(--c-paper);
  grid-template-columns: var(--touch-target) minmax(17rem, 1fr) minmax(12rem, 18rem) var(--touch-target);
  gap: var(--space-4);
}

.production-sheet--collapsed .production-sheet__header {
  border-color: var(--c-rule-strong);
  background:
    linear-gradient(90deg, var(--c-cutting-mat) 0 0.28rem, transparent 0.28rem),
    var(--c-paper);
}

.production-sheet__select {
  justify-content: center;
}

.production-sheet__identity {
  min-width: 0;
}

.production-sheet__identity h2 {
  margin-block: 0.2rem 0.3rem;
  overflow-wrap: anywhere;
}

.production-sheet__identity > p:last-child {
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
}

.sheet-progress {
  display: grid;
  gap: var(--space-2);
}

.sheet-progress__labels {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-xs);
}

.sheet-progress__labels strong {
  font-family: var(--font-data);
}

.sheet-progress__track {
  height: 0.5rem;
  border: 1px solid var(--c-rule-strong);
  background: var(--c-film);
}

.sheet-progress__track > span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  background: var(--c-registration-magenta);
}

.chevron {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-0.08rem, -0.08rem);
  transition: transform var(--duration-medium) var(--ease-standard);
}

[aria-expanded="false"] .chevron,
.production-sheet--collapsed .chevron {
  transform: rotate(-45deg) translate(-0.05rem, -0.05rem);
}

.production-sheet__body {
  border: solid var(--c-carbon);
  border-width: 0 2px 2px;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.table-scroll:focus-visible {
  outline-offset: -3px;
}

.work-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.work-table th,
.work-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--c-rule);
  text-align: left;
  vertical-align: middle;
}

.work-table th {
  height: 2.4rem;
  background: #eef1ef;
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.work-table th:first-child,
.work-table td:first-child {
  width: 3.6rem;
  padding-inline: var(--space-3);
}

.work-table th:nth-child(2) { width: 10rem; }
.work-table th:nth-child(3) { width: 15rem; }
.work-table th:nth-child(4) { width: 12rem; }
.work-table th:nth-child(5) { width: 7rem; }
.work-table th:nth-child(6) { width: 8.5rem; }
.work-table th:nth-child(7) { width: 13rem; }
.work-table th:last-child,
.work-table td:last-child { width: 4rem; }

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

.work-table tbody tr:hover td {
  background: #fafcfa;
}

.work-table td > small {
  display: block;
  margin-top: var(--space-1);
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  line-height: 1.35;
}

.work-table tbody tr:has(input[type="checkbox"]:checked) td {
  background: var(--c-info-surface);
}

.work-table tbody tr:has(input[type="checkbox"]:checked) td:first-child {
  border-left: 4px solid var(--c-registration-cyan);
}

.order-reference,
.dorsal,
.size-mark,
.quantity-mark {
  font-family: var(--font-data);
}

.order-reference {
  display: block;
  font-size: var(--text-sm);
}

.cell-note {
  display: block;
  margin-top: var(--space-1);
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  line-height: 1.3;
}

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

.personalization-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dorsal,
.size-mark {
  display: inline-grid;
  min-width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--c-carbon);
  background: var(--c-paper);
  font-size: var(--text-sm);
  font-weight: 800;
}

.quantity-mark {
  margin-left: var(--space-2);
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
}

.status-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--c-rule-strong);
  background: var(--c-paper);
  font-size: var(--text-xs);
  font-weight: 800;
  text-align: left;
}

.status-mark__symbol {
  width: 0.65rem;
  height: 0.65rem;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.status-mark--pending {
  color: var(--c-carbon);
}

.status-mark--processed {
  border-color: var(--c-carbon);
  background: var(--c-carbon);
  color: var(--c-paper);
}

.status-mark--processed .status-mark__symbol {
  background: var(--c-paper);
  box-shadow: inset 0 0 0 2px var(--c-carbon);
}

.csv-state {
  display: inline-flex;
  min-height: var(--touch-target);
  align-items: center;
  gap: var(--space-2);
  color: var(--c-carbon);
  font-size: var(--text-xs);
  line-height: 1.2;
  text-decoration: none;
}

.csv-state__symbol {
  display: inline-grid;
  width: 2.3rem;
  height: 1.7rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid currentColor;
  color: var(--c-registration-magenta-ink);
  font-family: var(--font-data);
  font-size: 0.55rem;
  font-weight: 900;
}

.csv-state strong,
.csv-state small {
  display: block;
}

.csv-state small {
  margin-top: 0.2rem;
  color: var(--c-ink-muted);
}

.csv-state--generated {
  color: var(--c-registration-magenta-ink);
}

.csv-state--generated strong {
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.csv-state--stale .csv-state__symbol {
  border-color: var(--c-warning);
  background: var(--c-warning-surface);
  color: var(--c-warning);
}

.csv-state--stale strong {
  color: var(--c-warning);
}

.empty-sheet {
  display: grid;
  min-height: 18rem;
  place-items: center;
  align-content: center;
  margin-top: var(--space-5);
  padding: var(--space-8);
  border: 2px dashed var(--c-rule-strong);
  background: var(--c-paper);
  text-align: center;
  gap: var(--space-3);
}

.empty-sheet__registration {
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid var(--c-carbon);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 47%, var(--c-registration-cyan) 47% 53%, transparent 53%),
    linear-gradient(transparent 47%, var(--c-registration-magenta) 47% 53%, transparent 53%);
}

.empty-sheet p {
  color: var(--c-ink-muted);
}

.selection-deck {
  position: fixed;
  z-index: var(--z-selection);
  right: max(var(--space-4), env(safe-area-inset-right));
  bottom: max(var(--space-4), env(safe-area-inset-bottom));
  left: max(var(--space-4), env(safe-area-inset-left));
  display: flex;
  width: min(55rem, calc(100% - 2rem));
  min-height: 4.8rem;
  align-items: center;
  justify-content: space-between;
  margin-inline: auto;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--c-carbon);
  background: var(--c-carbon);
  color: var(--c-paper);
  gap: var(--space-5);
}

.selection-deck::before {
  position: absolute;
  top: -2px;
  right: -2px;
  left: -2px;
  height: 4px;
  background: linear-gradient(90deg, var(--c-registration-cyan) 0 33.333%, var(--c-registration-magenta) 33.333% 66.666%, var(--c-plotter-yellow) 66.666%);
  content: "";
}

.selection-deck__summary p:first-child {
  font-size: var(--text-md);
}

.selection-deck__summary p:last-child {
  margin-top: var(--space-1);
  color: #d6ddda;
  font-family: var(--font-data);
  font-size: var(--text-xs);
}

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

dialog {
  color: var(--c-carbon);
  font: inherit;
}

dialog::backdrop {
  background: var(--c-backdrop);
}

.export-dialog {
  width: min(100%, var(--dialog-width));
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 5px solid var(--c-registration-magenta);
  border-radius: 0;
  background: var(--c-film);
  box-shadow: none;
}

.export-dialog__form {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.export-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 2px solid var(--c-carbon);
  background: var(--c-paper);
  gap: var(--space-5);
}

.export-dialog__header h2 {
  margin-block: var(--space-2);
  font-size: var(--text-xl);
}

.export-dialog__header p:last-child {
  max-width: 34rem;
  color: var(--c-ink-muted);
}

.export-dialog__scroll {
  overflow-y: auto;
  padding: var(--space-6);
}

.preflight-tally {
  display: grid;
  border-block: 1px solid var(--c-carbon);
  grid-template-columns: repeat(4, 1fr);
}

.preflight-tally > div {
  display: grid;
  padding: var(--space-3);
  border-left: 1px solid var(--c-rule-strong);
  gap: var(--space-1);
}

.preflight-tally > div:last-child {
  border-right: 1px solid var(--c-rule-strong);
}

.preflight-tally strong {
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
}

.preflight-tally span {
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-2xs);
  text-transform: uppercase;
}

.preflight-tally__new {
  background: var(--c-info-surface);
}

.preflight-tally__repeat {
  background: var(--c-magenta-surface);
}

.export-options {
  padding: 0;
  border: 0;
  margin-top: var(--space-7);
}

.export-options > legend,
.format-options > legend {
  width: 100%;
  margin-bottom: var(--space-3);
  color: var(--c-carbon);
}

.export-choice {
  position: relative;
  display: grid;
  min-height: 4.8rem;
  align-items: center;
  padding: var(--space-3) var(--space-2);
  border-top: 1px solid var(--c-rule-strong);
  background: var(--c-paper);
  grid-template-columns: 1.5rem 2.75rem minmax(0, 1fr) auto;
  gap: var(--space-3);
}

.export-choice:last-child {
  border-bottom: 1px solid var(--c-rule-strong);
}

.export-choice:hover {
  background: #fafafa;
}

.export-choice:has(input:checked) {
  border-left: 4px solid var(--c-registration-magenta);
  background: var(--c-magenta-surface);
}

.export-choice input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--c-registration-magenta-ink);
}

.export-choice__code {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 1px solid var(--c-carbon);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-weight: 900;
}

.export-choice__copy {
  min-width: 0;
}

.export-choice__copy strong,
.export-choice__copy small {
  display: block;
}

.export-choice__copy small {
  margin-top: var(--space-1);
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
}

.export-choice__format {
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-weight: 700;
  text-align: right;
}

.format-options {
  display: flex;
  margin-top: var(--space-5);
  padding: 0;
  border: 0;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.format-options label {
  display: inline-flex;
  min-height: var(--touch-target);
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--c-rule-strong);
  background: var(--c-paper);
  gap: var(--space-2);
}

.preflight {
  margin-top: var(--space-7);
  border: 1px solid var(--c-warning);
  background: var(--c-paper);
}

.preflight__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid #d6be63;
  background: var(--c-warning-surface);
  gap: var(--space-3);
}

.preflight__status {
  display: inline-flex;
  align-items: center;
  color: var(--c-warning);
  font-size: var(--text-xs);
  font-weight: 800;
  gap: var(--space-2);
}

.preflight__status span {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.preflight__list {
  list-style: none;
}

.preflight__list li {
  position: relative;
  padding: var(--space-3) var(--space-4) var(--space-3) 2.7rem;
  border-bottom: 1px solid var(--c-rule);
  font-size: var(--text-sm);
}

.preflight__list li:last-child {
  border-bottom: 0;
}

.preflight__list li::before {
  position: absolute;
  top: 1rem;
  left: var(--space-4);
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
}

.preflight__warning {
  color: var(--c-warning);
}

.preflight__ok {
  color: var(--c-success);
}

.export-dialog__footer {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-4) var(--space-6) max(var(--space-4), env(safe-area-inset-bottom));
  border-top: 2px solid var(--c-carbon);
  background: var(--c-paper);
  gap: var(--space-3);
}

.confirm-dialog {
  width: min(90vw, 31rem);
  padding: var(--space-7);
  border: 2px solid var(--c-carbon);
  border-radius: 0;
  background: var(--c-paper);
  box-shadow: none;
}

.confirm-dialog h2 {
  margin-block: var(--space-3);
}

.confirm-dialog p:not(.eyebrow) {
  color: var(--c-ink-muted);
}

.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-6);
  gap: var(--space-3);
}

.ledger {
  margin-top: var(--space-6);
  border-top: 2px solid var(--c-carbon);
}

.work-table__personalization .personalization-person {
  display: block;
  margin-bottom: 0.22rem;
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  font-weight: 430;
  line-height: 1.25;
}

.personalization-primary {
  display: grid;
  gap: 0.14rem;
}

.personalization-primary__line {
  display: block;
  color: var(--c-carbon);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.2;
}

.ledger-entry {
  border-bottom: 1px solid var(--c-carbon);
  background: var(--c-paper);
}

.ledger-entry__summary {
  display: grid;
  min-height: 5.75rem;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  list-style: none;
  grid-template-columns: 3.5rem minmax(12rem, 1.4fr) minmax(5rem, 0.45fr) minmax(5rem, 0.45fr) minmax(8rem, 0.7fr) auto var(--touch-target);
  gap: var(--space-4);
}

.ledger-entry__summary::-webkit-details-marker {
  display: none;
}

.ledger-entry__summary:hover {
  background: var(--c-film);
}

.ledger-entry__type {
  display: grid;
  width: 3.2rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid currentColor;
  color: var(--c-registration-magenta-ink);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-weight: 900;
}

.ledger-entry__type--document {
  color: var(--c-registration-cyan-ink);
}

.ledger-entry__identity strong,
.ledger-entry__identity small,
.ledger-entry__operator strong,
.ledger-entry__operator small,
.ledger-entry__measure strong,
.ledger-entry__measure small {
  display: block;
}

.ledger-entry__identity small,
.ledger-entry__operator small,
.ledger-entry__measure small {
  margin-top: var(--space-1);
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
}

.ledger-entry__measure strong {
  font-family: var(--font-data);
  font-size: var(--text-md);
}

.ledger-entry__tag {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--c-registration-magenta-ink);
  color: var(--c-registration-magenta-ink);
  font-size: var(--text-xs);
  font-weight: 800;
  white-space: nowrap;
}

.ledger-entry__tag--quiet {
  border-color: var(--c-rule-strong);
  color: var(--c-ink-muted);
}

.ledger-entry[open] > summary {
  background: var(--c-magenta-surface);
}

.ledger-entry[open] > summary .chevron {
  transform: rotate(225deg) translate(-0.08rem, -0.08rem);
}

.ledger-entry__body {
  display: grid;
  padding: var(--space-5) var(--space-6) var(--space-6) 5.75rem;
  border-top: 1px solid var(--c-rule);
  gap: var(--space-5);
}

.ledger-entry__body p:not(.data-label) {
  max-width: var(--measure-copy);
  margin-top: var(--space-2);
  color: var(--c-ink-muted);
}

.audit-line {
  display: grid;
  border-top: 1px solid var(--c-rule);
  border-bottom: 1px solid var(--c-rule);
  grid-template-columns: repeat(3, 1fr);
}

.audit-line > div {
  padding: var(--space-3);
  border-left: 1px solid var(--c-rule);
}

.audit-line > div:last-child {
  border-right: 1px solid var(--c-rule);
}

.audit-line dt {
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-2xs);
  text-transform: uppercase;
}

.audit-line dd {
  margin-top: var(--space-1);
  overflow-wrap: anywhere;
  font-size: var(--text-sm);
}

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

.period-control {
  display: grid;
  min-width: 14rem;
  gap: var(--space-2);
}

.stats-tally {
  display: grid;
  margin-top: var(--space-7);
  border-block: 2px solid var(--c-carbon);
  grid-template-columns: repeat(4, 1fr);
}

.stats-tally > div {
  padding: var(--space-5);
  border-left: 1px solid var(--c-rule-strong);
}

.stats-tally > div:last-child {
  border-right: 1px solid var(--c-rule-strong);
}

.stats-tally dt {
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
}

.stats-tally dd {
  margin-block: var(--space-2) var(--space-1);
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.4rem + 1.6vw, 3.4rem);
  font-weight: 900;
  line-height: 1;
}

.stats-tally small {
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-2xs);
  text-transform: uppercase;
}

.analysis-grid {
  display: grid;
  margin-top: var(--space-6);
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-6);
}

.analysis-sheet {
  min-width: 0;
  border-top: 2px solid var(--c-carbon);
  border-bottom: 1px solid var(--c-carbon);
  background: var(--c-paper);
}

.analysis-sheet--wide {
  grid-column: 1 / -1;
}

.analysis-sheet__header {
  display: flex;
  min-height: 5rem;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--c-rule-strong);
  gap: var(--space-4);
}

.analysis-sheet__header h2 {
  margin-top: var(--space-1);
}

.analysis-sheet__unit {
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-xs);
}

.rank-list {
  list-style: none;
}

.rank-list li {
  display: grid;
  min-height: 4.5rem;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--c-rule);
  grid-template-columns: 2rem minmax(12rem, 1fr) minmax(5rem, 0.7fr) 3rem;
  gap: var(--space-3);
}

.rank-list li:last-child {
  border-bottom: 0;
}

.rank-list__index {
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-xs);
}

.rank-list__name strong,
.rank-list__name small {
  display: block;
}

.rank-list__name small {
  margin-top: var(--space-1);
  color: var(--c-ink-muted);
  font-family: var(--font-data);
  font-size: var(--text-2xs);
}

.rank-list__bar {
  height: 0.45rem;
  border: 1px solid var(--c-rule-strong);
  background: var(--c-film);
}

.rank-list__bar > span {
  display: block;
  width: var(--bar, 0%);
  height: 100%;
  background: var(--c-registration-cyan);
}

.rank-list__value {
  font-family: var(--font-data);
  text-align: right;
}

.export-mix {
  padding: var(--space-5);
}

.export-mix__registration {
  display: flex;
  height: 0.9rem;
  margin-bottom: var(--space-5);
  border: 1px solid var(--c-carbon);
}

.export-mix__registration span {
  width: var(--segment);
}

.export-mix__registration span:nth-child(1) { background: var(--c-registration-magenta); }
.export-mix__registration span:nth-child(2) { background: var(--c-registration-cyan); }
.export-mix__registration span:nth-child(3) { background: var(--c-plotter-yellow); }
.export-mix__registration span:nth-child(4) { background: var(--c-carbon); }
.export-mix__registration span:nth-child(5) { background: var(--c-cutting-mat); }

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

.data-table th,
.data-table td {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--c-rule);
  text-align: right;
}

.data-table th {
  text-align: left;
}

.data-table td {
  width: 3.5rem;
  font-family: var(--font-data);
  font-size: var(--text-sm);
}

.legend-mark {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  margin-right: var(--space-2);
  border: 1px solid var(--c-carbon);
}

.legend-mark--magenta { background: var(--c-registration-magenta); }
.legend-mark--cyan { background: var(--c-registration-cyan); }
.legend-mark--yellow { background: var(--c-plotter-yellow); }
.legend-mark--key { background: var(--c-carbon); }
.legend-mark--mat { background: var(--c-cutting-mat); }

.field-quality {
  display: grid;
  min-height: 8rem;
  align-items: center;
  padding: var(--space-5);
  grid-template-columns: minmax(16rem, 1fr) minmax(24rem, 1.5fr);
  gap: var(--space-7);
}

.field-quality__copy strong {
  font-size: var(--text-lg);
}

.field-quality__copy p {
  max-width: 42rem;
  margin-top: var(--space-2);
  color: var(--c-ink-muted);
}

.field-quality dl {
  display: grid;
  border-block: 1px solid var(--c-rule-strong);
  grid-template-columns: repeat(4, 1fr);
}

.field-quality dl > div {
  padding: var(--space-3);
  border-left: 1px solid var(--c-rule);
}

.field-quality dl > div:last-child {
  border-right: 1px solid var(--c-rule);
}

.field-quality dt {
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
}

.field-quality dd {
  margin-top: var(--space-2);
  font-family: var(--font-data);
  font-size: var(--text-lg);
  font-weight: 800;
}

.app-footer {
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--page-gutter);
  border-top: 1px solid var(--c-rule-strong);
  background: #eef1ef;
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  gap: var(--space-4);
}

.app-footer p:first-child {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.status-dot--local {
  display: inline-block;
}

.login-view {
  min-height: 100dvh;
  padding: var(--space-7) var(--page-gutter);
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgb(137 147 142 / 25%) calc(50% - 1px) 50%, transparent 50%),
    var(--c-film);
}

.login-sheet {
  position: relative;
  display: grid;
  width: min(100%, 36rem);
  min-height: calc(100dvh - 4rem);
  align-content: center;
  margin-inline: auto;
  padding: clamp(1.5rem, 5vw, 4rem);
  border-inline: 1px solid var(--c-rule-strong);
  background: var(--c-paper);
  gap: var(--space-4);
}

.login-sheet h1 {
  margin-top: var(--space-5);
}

.login-sheet__copy {
  color: var(--c-ink-muted);
}

.login-form {
  display: grid;
  margin-top: var(--space-5);
  gap: var(--space-4);
}

.registration-cross {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--c-carbon);
  border-radius: 50%;
}

.registration-cross::before,
.registration-cross::after {
  position: absolute;
  background: var(--c-carbon);
  content: "";
}

.registration-cross::before {
  top: 50%;
  right: -0.45rem;
  left: -0.45rem;
  height: 1px;
}

.registration-cross::after {
  top: -0.45rem;
  bottom: -0.45rem;
  left: 50%;
  width: 1px;
}

.form-error {
  padding: var(--space-3);
  border-left: 4px solid var(--c-danger);
  background: var(--c-danger-surface);
  color: var(--c-danger);
  font-size: var(--text-sm);
}

.toast-region {
  position: fixed;
  z-index: var(--z-toast);
  top: calc(var(--topbar-height) + 4.5rem);
  right: var(--space-4);
  display: grid;
  width: min(26rem, calc(100% - 2rem));
  gap: var(--space-2);
}

.toast {
  display: grid;
  min-height: 4rem;
  align-items: center;
  padding: var(--space-3);
  border: 2px solid var(--c-carbon);
  background: var(--c-paper);
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: var(--space-3);
}

.toast__mark {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--c-success);
  border-radius: 50%;
  background: var(--c-success-surface);
}

.toast__action {
  min-height: var(--touch-target);
  background: transparent;
  color: var(--c-registration-cyan-ink);
  font-weight: 800;
  text-decoration: underline;
}

.noscript-notice {
  position: fixed;
  z-index: calc(var(--z-toast) + 2);
  right: 0;
  bottom: 0;
  left: 0;
  padding: var(--space-4);
  border-top: 3px solid var(--c-danger);
  background: var(--c-danger-surface);
  color: var(--c-danger);
  font-weight: 800;
  text-align: center;
}

@media (max-width: 72rem) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 0 var(--space-4);
  }

  .primary-nav {
    order: 3;
    grid-column: 1 / -1;
    border-top: 1px solid var(--c-rule);
  }

  .primary-nav__link {
    min-height: 3.1rem;
  }

  .operator-tools {
    grid-column: 2;
    grid-row: 1;
  }

  .view-header {
    grid-template-columns: 1fr;
  }

  .tally-ruler {
    width: 100%;
  }

  .filter-bench {
    grid-template-columns: minmax(16rem, 2fr) repeat(2, minmax(10rem, 1fr));
  }

  .field--more {
    grid-column: 3;
  }

  .filter-bench__more {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-bench__more .text-action {
    justify-self: start;
  }

  .production-sheet__header {
    grid-template-columns: var(--touch-target) minmax(14rem, 1fr) minmax(11rem, 15rem) var(--touch-target);
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .analysis-sheet--wide {
    grid-column: auto;
  }

  .ledger-entry__summary {
    grid-template-columns: 3.5rem minmax(10rem, 1fr) repeat(2, 4rem) 7rem var(--touch-target);
  }

  .ledger-entry__operator {
    display: none;
  }

  .ledger-entry__tag {
    grid-column: 5;
  }
}

@media (max-width: 52rem) {
  .app-main {
    padding-top: var(--space-6);
  }

  .source-notice {
    align-items: flex-start;
    justify-content: flex-start;
    padding-block: var(--space-2);
  }

  .source-notice p {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .source-notice__action {
    margin-left: auto;
  }

  .filter-bench,
  .filter-bench--history {
    grid-template-columns: 1fr 1fr;
  }

  .field--search {
    grid-column: 1 / -1;
  }

  .queue-command {
    grid-template-columns: 1fr auto;
  }

  .queue-command__result {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .production-sheet__header {
    grid-template-columns: var(--touch-target) minmax(0, 1fr) var(--touch-target);
  }

  .sheet-progress {
    grid-column: 2;
  }

  .production-sheet__toggle {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .table-scroll {
    overflow: visible;
  }

  .work-table,
  .work-table tbody {
    display: block;
    width: 100%;
  }

  .work-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .work-table tbody tr {
    display: grid;
    padding: var(--space-3);
    border-bottom: 1px solid var(--c-carbon);
    grid-template-columns: 1fr 1fr;
  }

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

  .work-table th,
  .work-table td,
  .work-table th:first-child,
  .work-table td:first-child,
  .work-table th:last-child,
  .work-table td:last-child {
    width: auto;
  }

  .work-table td,
  .work-table td:first-child,
  .work-table td:last-child {
    display: grid;
    min-width: 0;
    min-height: var(--touch-target);
    align-content: center;
    padding: var(--space-3);
    border: 0;
    border-bottom: 1px solid var(--c-rule);
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: var(--space-3);
  }

  .work-table td::before {
    align-self: start;
    color: var(--c-ink-muted);
    content: attr(data-label);
    font-family: var(--font-data);
    font-size: var(--text-2xs);
    font-weight: 700;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
  }

  .work-table td:first-child {
    grid-column: 1 / -1;
  }

  .work-table td.work-table__order,
  .work-table td.work-table__personalization,
  .work-table td.work-table__team,
  .work-table td.work-table__csv {
    grid-column: 1 / -1;
  }

  .work-table td:last-child {
    justify-items: end;
  }

  .work-table tbody tr:has(input[type="checkbox"]:checked) td:first-child {
    border-left: 4px solid var(--c-registration-cyan);
  }

  .selection-deck {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
    border-width: 2px 0 0;
  }

  .selection-deck::before {
    right: 0;
    left: 0;
  }

  .selection-deck__actions .button--line-on-key {
    display: none;
  }

  .ledger-entry__summary {
    grid-template-columns: 3.5rem minmax(0, 1fr) auto var(--touch-target);
    gap: var(--space-3);
  }

  .ledger-entry__measure,
  .ledger-entry__operator {
    display: none;
  }

  .ledger-entry__tag {
    grid-column: 3;
  }

  .ledger-entry__body {
    padding-left: var(--space-5);
  }

  .audit-line {
    grid-template-columns: 1fr;
  }

  .audit-line > div,
  .audit-line > div:last-child {
    border-right: 1px solid var(--c-rule);
  }

  .stats-tally {
    grid-template-columns: 1fr 1fr;
  }

  .stats-tally > div {
    border-bottom: 1px solid var(--c-rule-strong);
  }

  .stats-tally > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .field-quality {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 39rem) {
  .topbar {
    padding-inline: var(--page-gutter);
  }

  .brand-lockup {
    min-height: var(--touch-target);
    font-size: 1.05rem;
  }

  .source-chip {
    display: none;
  }

  .primary-nav {
    justify-content: stretch;
    margin-inline: calc(var(--page-gutter) * -1);
  }

  .primary-nav__link {
    flex: 1;
    justify-content: center;
    padding-inline: var(--space-2);
    font-size: var(--text-xs);
  }

  .primary-nav__link::after {
    right: var(--space-2);
    left: var(--space-2);
  }

  .primary-nav__index {
    display: none;
  }

  .source-notice {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .source-notice p {
    display: block;
  }

  .source-notice p span {
    display: block;
  }

  .source-notice p > span[aria-hidden="true"] {
    display: none;
  }

  .source-notice__action {
    grid-column: 2;
    justify-self: start;
    margin-left: 0;
    padding-left: 0;
  }

  .view-header {
    gap: var(--space-6);
  }

  .tally-ruler {
    min-width: 0;
  }

  .tally-ruler__item {
    padding-inline: var(--space-3);
  }

  .tally-ruler dd {
    font-size: 1.45rem;
  }

  .filter-bench,
  .filter-bench--history,
  .filter-bench__more {
    grid-template-columns: 1fr;
  }

  .field--search,
  .field--more,
  .filter-bench__more {
    grid-column: 1;
  }

  .queue-command {
    grid-template-columns: 1fr;
  }

  .queue-command__result,
  .field--inline {
    grid-column: 1;
  }

  .field--inline {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .field--inline select {
    width: 100%;
    min-width: 0;
  }

  .production-sheet__header {
    min-height: 0;
    padding: var(--space-3);
    grid-template-columns: var(--touch-target) minmax(0, 1fr) var(--touch-target);
    gap: var(--space-2);
  }

  .production-sheet__identity h2 {
    font-size: 1.2rem;
  }

  .production-sheet__identity > p:last-child {
    font-size: var(--text-xs);
  }

  .work-table tbody tr {
    grid-template-columns: 1fr;
  }

  .work-table td,
  .work-table td:first-child,
  .work-table td:last-child,
  .work-table td.work-table__order,
  .work-table td.work-table__personalization,
  .work-table td.work-table__team,
  .work-table td.work-table__csv {
    grid-column: 1;
  }

  .work-table td {
    grid-template-columns: 6rem minmax(0, 1fr);
  }

  .selection-deck {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-3);
  }

  .selection-deck__summary p:first-child {
    font-size: var(--text-base);
  }

  .selection-deck__actions .button--magenta {
    min-width: 8.5rem;
  }

  .export-dialog {
    width: 100%;
    border-left: 0;
    border-top: 5px solid var(--c-registration-magenta);
  }

  .export-dialog__header,
  .export-dialog__scroll,
  .export-dialog__footer {
    padding-inline: var(--space-4);
  }

  .preflight-tally {
    grid-template-columns: 1fr 1fr;
  }

  .preflight-tally > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--c-rule-strong);
  }

  .export-choice {
    grid-template-columns: 1.35rem 2.5rem minmax(0, 1fr);
  }

  .export-choice__code {
    width: 2.5rem;
    height: 2.5rem;
  }

  .export-choice__format {
    grid-column: 3;
    text-align: left;
  }

  .export-dialog__footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ledger-entry__summary {
    grid-template-columns: 3rem minmax(0, 1fr) var(--touch-target);
  }

  .ledger-entry__type {
    width: 2.8rem;
  }

  .ledger-entry__tag {
    grid-column: 2;
    width: max-content;
    margin-top: -0.65rem;
  }

  .ledger-entry__summary > .chevron {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

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

  .ledger-entry__actions,
  .confirm-dialog__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-tally {
    grid-template-columns: 1fr;
  }

  .stats-tally > div,
  .stats-tally > div:nth-last-child(-n + 2) {
    border-right: 1px solid var(--c-rule-strong);
    border-bottom: 1px solid var(--c-rule-strong);
  }

  .stats-tally > div:last-child {
    border-bottom: 0;
  }

  .rank-list li {
    grid-template-columns: 1.75rem minmax(0, 1fr) 2.75rem;
  }

  .rank-list__bar {
    grid-column: 2 / -1;
  }

  .field-quality dl {
    grid-template-columns: 1fr 1fr;
  }

  .field-quality dl > div {
    border-bottom: 1px solid var(--c-rule);
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .toast-region {
    top: auto;
    right: var(--space-3);
    bottom: 7rem;
    width: calc(100% - 1.5rem);
  }
}

/* Official Sayroh identity. The artwork is served as inert, local SVG images. */

.brand-lockup {
  min-width: 0;
  gap: 0.62rem !important;
  font-family: var(--font-interface);
}

.brand-lockup::before {
  display: none !important;
  content: none !important;
}

.brand-lockup__symbol,
.brand-lockup__wordmark,
.app-footer__symbol,
.app-footer__wordmark {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-lockup__symbol {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.38rem;
  box-shadow: 0 1px 2px rgb(24 25 29 / 12%);
}

.brand-lockup__identity {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.58rem;
}

.brand-lockup__wordmark {
  width: 4.8rem;
  height: auto;
}

.brand-lockup__product {
  padding-left: 0.58rem;
  border-left: 1px solid var(--c-rule-strong);
  color: var(--c-ink-muted);
  font-size: var(--text-2xs);
  font-weight: 590;
  letter-spacing: 0.02em;
  line-height: 1;
}

a.brand-lockup .brand-lockup__symbol,
a.brand-lockup .brand-lockup__wordmark {
  transition: opacity var(--duration-fast) var(--ease-standard);
}

a.brand-lockup:hover .brand-lockup__symbol,
a.brand-lockup:hover .brand-lockup__wordmark {
  opacity: 0.76;
}

.brand-lockup--large {
  gap: 0.9rem !important;
}

.brand-lockup--large .brand-lockup__symbol {
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 0.68rem;
  box-shadow: 0 5px 16px rgb(24 25 29 / 12%);
}

.brand-lockup--large .brand-lockup__identity {
  align-items: flex-start;
  flex-direction: column;
  gap: 0.34rem;
}

.brand-lockup--large .brand-lockup__wordmark {
  width: min(10rem, 42vw);
}

.brand-lockup--large .brand-lockup__product {
  padding-left: 0;
  border-left: 0;
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  font-weight: 610;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.app-footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.app-footer__symbol {
  width: 1.42rem;
  height: 1.42rem;
  border-radius: 0.28rem;
}

.app-footer__wordmark {
  width: 4.4rem;
  height: auto;
  opacity: 0.78;
}

.app-footer__brand > span {
  padding-left: 0.5rem;
  border-left: 1px solid var(--c-rule-strong);
  color: var(--c-ink-muted);
  font-size: var(--text-2xs);
  font-weight: 560;
}

@media (max-width: 39rem) {
  .brand-lockup {
    min-height: var(--touch-target);
    gap: 0.52rem !important;
  }

  .brand-lockup__symbol {
    width: 1.8rem;
    height: 1.8rem;
  }

  .brand-lockup__wordmark {
    width: 4.25rem;
  }

  .brand-lockup__product {
    padding-left: 0.48rem;
    font-size: 0.65rem;
  }

  .brand-lockup--large .brand-lockup__symbol {
    width: 2.8rem;
    height: 2.8rem;
  }

  .brand-lockup--large .brand-lockup__wordmark {
    width: min(9rem, 42vw);
  }

  .app-footer__brand {
    align-self: flex-end;
  }
}

@media (max-width: 23rem) {
  .site-header .brand-lockup__product {
    display: none;
  }

  .app-footer__brand {
    align-self: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Keep the search glyph clear of the placeholder after responsive input rules. */
.field .search-control input[type="search"] {
  padding-inline-start: 2.6rem;
}

@media (max-width: 39rem) {
  .selection-deck {
    grid-template-columns: 1fr;
  }

  .selection-deck__actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--touch-target);
    width: 100%;
  }

  .selection-deck__actions .button--line-on-key {
    display: inline-flex;
  }

  .selection-deck__actions .button {
    min-width: 0;
    padding-inline: var(--space-2);
    font-size: var(--text-xs);
  }
}

@media (prefers-contrast: more) {
  :root {
    --c-rule: #79827e;
    --c-rule-strong: #4f5753;
    --c-ink-muted: #3f4743;
  }

  .status-mark,
  .csv-state__symbol,
  .source-notice,
  .production-sheet__header,
  .production-sheet__body {
    border-width: 2px;
  }

  :where(a, button, input, select, textarea, summary):focus-visible {
    outline-width: 3px;
    outline-offset: 4px;
  }
}

/* Multi-file export: each destination stays readable while exposing its own formats. */
.export-choice {
  display: block;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.export-choice__selector {
  display: grid;
  min-height: 4.6rem;
  align-items: center;
  padding: var(--space-3);
  cursor: pointer;
  grid-template-columns: 1.25rem 2.75rem minmax(0, 1fr) auto;
  gap: var(--space-3);
}

.export-choice:hover {
  background: var(--c-paper);
}

.export-choice__selector:hover {
  background: #fafafa;
}

.export-choice:has(> .export-choice__selector > input:checked) {
  border: 1px solid var(--c-registration-cyan);
  background: var(--c-info-surface);
  box-shadow: 0 0 0 1px var(--c-registration-cyan);
}

.export-choice:not(:has(> .export-choice__selector > input:checked)) {
  border: 1px solid var(--c-rule);
  background: var(--c-paper);
  box-shadow: none;
}

.export-choice:has(> .export-choice__selector > input:checked) .export-choice__selector:hover {
  background: var(--c-info-surface);
}

.export-choice:has(> .export-choice__selector > input:checked) .export-choice__code {
  background: var(--c-registration-cyan);
  color: var(--c-paper);
}

.export-choice:not(:has(> .export-choice__selector > input:checked)) .export-choice__code {
  background: var(--c-cutting-mat);
  color: var(--c-carbon-soft);
}

.export-choice__selector > input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--c-registration-cyan-ink);
}

.export-choice__formats {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 var(--space-3) var(--space-3) 5.75rem;
  border: 0;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.export-choice__formats label {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--radius-round);
  background: var(--c-paper);
  color: var(--c-carbon-soft);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 610;
  gap: var(--space-2);
}

.export-choice__formats label:has(input:checked) {
  border-color: var(--c-registration-cyan);
  background: var(--c-paper);
  color: var(--c-registration-cyan-ink);
}

.export-choice__formats input {
  margin: 0;
  accent-color: var(--c-registration-cyan-ink);
}

@media (max-width: 39rem) {
  .export-choice__selector {
    grid-template-columns: 1.15rem 2.5rem minmax(0, 1fr);
    gap: var(--space-2);
  }

  .export-choice__code {
    width: 2.5rem;
    height: 2.5rem;
  }

  .export-choice__format {
    grid-column: 3;
    text-align: left;
  }

  .export-choice__formats {
    padding-left: 4.8rem;
  }
}

/*
 * Wide workstations receive more usable canvas and a restrained type scale.
 * Browser zoom changes the CSS viewport, so these same breakpoints also keep
 * the interface balanced when operators zoom out to inspect a large monitor.
 */
@media (min-width: 112rem) {
  html {
    font-size: 106.25%;
  }

  :root {
    --content-max: min(116rem, calc(100vw - 5rem));
    --page-gutter: clamp(2rem, 2.2vw, 3.5rem);
  }
}

@media (min-width: 150rem) {
  html {
    font-size: 112.5%;
  }

  :root {
    --content-max: min(126rem, calc(100vw - 8rem));
    --page-gutter: clamp(2.5rem, 2.4vw, 4.5rem);
  }
}

@media print {
  .site-header,
  .selection-deck,
  .app-footer,
  .filter-bench,
  .queue-command,
  .toast-region,
  dialog {
    display: none !important;
  }

  body,
  .app-main {
    background: var(--c-paper);
  }

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

  .production-sheet {
    break-inside: avoid;
  }
}

/* History context and personalization analytics */
.filter-bench--history {
  grid-template-columns: minmax(16rem, 1.55fr) repeat(4, minmax(9rem, 0.72fr));
}

.ledger-entry__summary {
  grid-template-columns: 3.2rem 5rem minmax(12rem, 1.5fr) minmax(7rem, 0.62fr) minmax(4rem, 0.32fr) minmax(4rem, 0.32fr) minmax(8rem, 0.65fr) auto var(--touch-target);
  gap: clamp(0.65rem, 1vw, var(--space-4));
}

.ledger-entry__gallery {
  display: flex;
  width: 5rem;
  min-width: 0;
  align-items: center;
}

.history-product-image {
  display: grid;
  width: 2.9rem;
  height: 3.25rem;
  flex: 0 0 auto;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--c-rule);
  border-radius: 0.65rem;
  background: #f6f7f8;
}

.history-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.history-product-image__fallback {
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  font-weight: 700;
}

.history-product-image--summary {
  width: 2.25rem;
  height: 2.55rem;
  margin-left: -0.85rem;
  border: 2px solid var(--c-paper);
  border-radius: 0.55rem;
  box-shadow: 0 0 0 1px var(--c-rule);
}

.history-product-image--summary:first-child {
  margin-left: 0;
}

.ledger-entry__gallery-more {
  display: grid;
  width: 2rem;
  height: 2rem;
  margin-left: -0.65rem;
  place-items: center;
  border: 2px solid var(--c-paper);
  border-radius: 50%;
  background: var(--c-carbon);
  color: var(--c-paper);
  font-size: var(--text-2xs);
  font-weight: 700;
}

.ledger-entry__club {
  overflow: hidden;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-round);
  background: #f0eefb;
  color: #55458e;
  font-size: var(--text-2xs);
  font-weight: 630;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-snapshot-table {
  width: 100%;
  table-layout: fixed;
}

.history-snapshot-table th:nth-child(1) { width: 5rem; }
.history-snapshot-table th:nth-child(2) { width: 10rem; }
.history-snapshot-table th:nth-child(3) { width: 18%; }
.history-snapshot-table th:nth-child(4) { width: 16%; }
.history-snapshot-table th:nth-child(5) { width: 17%; }
.history-snapshot-table th:nth-child(6),
.history-snapshot-table th:nth-child(7),
.history-snapshot-table th:nth-child(8) { width: 6rem; }
.history-snapshot-table td { vertical-align: middle; }

.personalization-insights {
  background:
    linear-gradient(135deg, rgba(70, 84, 255, 0.055), transparent 42%),
    var(--c-paper);
}

.character-ruler {
  padding: var(--space-5);
}

.character-ruler__scale {
  display: grid;
  min-height: 13rem;
  align-items: end;
  grid-template-columns: repeat(12, minmax(2.25rem, 1fr));
  gap: clamp(0.35rem, 0.7vw, 0.8rem);
}

.character-ruler__cell {
  display: grid;
  height: 100%;
  grid-template-rows: 1.5rem minmax(4rem, 1fr) 1.5rem;
  align-items: end;
  text-align: center;
}

.character-ruler__cell strong,
.character-ruler__cell small {
  font-variant-numeric: tabular-nums;
}

.character-ruler__cell strong {
  color: var(--c-carbon-soft);
  font-size: var(--text-xs);
}

.character-ruler__cell small {
  padding-top: 0.45rem;
  border-top: 1px solid var(--c-rule);
  color: var(--c-ink-muted);
  font-size: var(--text-2xs);
  font-weight: 650;
}

.character-ruler__bar {
  width: 100%;
  height: var(--character-load);
  min-height: 0.2rem;
  border-radius: 0.5rem 0.5rem 0.16rem 0.16rem;
  background: linear-gradient(180deg, #5f6fff 0%, #9275e7 48%, #db8fb5 100%);
  opacity: 0.9;
}

.character-ruler__notes {
  display: grid;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--c-rule);
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.character-ruler__notes dt,
.character-ruler__notes dd { display: block; }
.character-ruler__notes dt { color: var(--c-ink-muted); font-size: var(--text-2xs); }
.character-ruler__notes dd { margin-top: 0.2rem; color: var(--c-carbon); font-size: var(--text-sm); font-weight: 680; }

.compact-rank-list {
  padding: var(--space-2) var(--space-5) var(--space-5);
}

.common-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  padding: var(--space-3) var(--space-5) var(--space-5);
}

.common-values__column h3 {
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--c-rule);
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
}

.common-values__list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.common-values__list li {
  display: grid;
  min-height: 2.7rem;
  align-items: center;
  border-bottom: 1px solid var(--c-rule);
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: var(--space-2);
}

.common-values__rank,
.common-values__list small {
  color: var(--c-ink-muted);
  font-size: var(--text-2xs);
}

.common-values__list strong {
  overflow: hidden;
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 80rem) {
  .ledger-entry__summary {
    grid-template-columns: 3.2rem 4.25rem minmax(11rem, 1.5fr) minmax(6rem, 0.55fr) repeat(2, minmax(3.5rem, 0.3fr)) auto var(--touch-target);
  }
  .ledger-entry__operator { display: none; }
}

@media (max-width: 64rem) {
  .filter-bench--history { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bench--history .field--search { grid-column: 1 / -1; }
  .ledger-entry__club { display: none; }
  .ledger-entry__summary { grid-template-columns: 3.2rem 4.25rem minmax(10rem, 1fr) repeat(2, minmax(3.5rem, 0.3fr)) auto var(--touch-target); }
}

@media (max-width: 39rem) {
  .filter-bench--history { grid-template-columns: 1fr; }
  .filter-bench--history .field--search { grid-column: auto; }
  .ledger-entry__summary { grid-template-columns: 3rem 3.8rem minmax(0, 1fr) auto var(--touch-target); }
  .ledger-entry__measure { display: none; }
  .ledger-entry__gallery { width: 3.8rem; }
  .history-product-image--summary:nth-child(n + 3),
  .ledger-entry__gallery-more { display: none; }
  .character-ruler { overflow-x: auto; }
  .character-ruler__scale { min-width: 38rem; }
  .character-ruler__notes { grid-template-columns: repeat(2, 1fr); }
  .common-values { grid-template-columns: 1fr; }
}

/* Production queue: six primary controls and a bounded, image-led table. */

.filter-bench:not(.filter-bench--history) {
  grid-template-columns:
    minmax(17rem, 1.8fr)
    minmax(10rem, 1fr)
    minmax(10rem, 1fr)
    minmax(9rem, 0.82fr)
    minmax(9rem, 0.82fr)
    minmax(8rem, 0.72fr);
}

.filter-bench__more {
  grid-template-columns: repeat(4, minmax(10rem, 1fr)) auto;
}

.work-table {
  min-width: 82rem;
}

.work-table th,
.work-table td,
.work-table th:first-child,
.work-table td:first-child,
.work-table th:last-child,
.work-table td:last-child {
  width: auto;
}

.work-table .work-table__check {
  width: 3.5rem;
}

.work-table .work-table__product-image {
  width: 5rem;
  padding-inline: 0.65rem;
  text-align: center;
  vertical-align: top;
}

.work-table .work-table__order-state {
  width: 11rem;
}

.work-table .work-table__action {
  width: 4rem;
}

.product-thumbnail {
  display: grid;
  width: 3.25rem;
  height: 4rem;
  overflow: hidden;
  margin-inline: auto;
  border: 1px solid var(--c-rule);
  border-radius: 0.65rem;
  background: #f4f5f6;
  place-items: center;
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumbnail__fallback {
  color: #8a8d95;
  font-size: var(--text-md);
  font-weight: 680;
}

.order-state-tag {
  display: inline-flex;
  max-width: 100%;
  min-height: 1.75rem;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 0.48rem;
  background: #f0f0f1;
  color: #5f626a;
  font-size: var(--text-xs);
  font-weight: 580;
  gap: 0.42rem;
  line-height: 1.2;
}

.order-state-tag__dot {
  width: 0.42rem;
  height: 0.42rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.68;
}

.order-state-tag--success {
  background: #e7f3eb;
  color: #287052;
}

.order-state-tag--info {
  background: #e8eefc;
  color: #3e58a8;
}

.order-state-tag--warning {
  background: #f8efd8;
  color: #8b6419;
}

.order-state-tag--danger {
  background: #f8e7e7;
  color: #a44444;
}

.table-sort-button {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  padding: 0.2rem 0.35rem;
  margin: -0.2rem -0.35rem;
  border-radius: 0.4rem;
  background: transparent;
  color: inherit;
  font: inherit;
  gap: 0.3rem;
}

.table-sort-button:hover,
.table-sort-button[aria-expanded="true"] {
  background: #e9eaec;
  color: var(--c-carbon-soft);
}

.table-sort-button .app-icon {
  width: 0.72rem;
  height: 0.72rem;
}

.order-sort-popover {
  width: min(12.5rem, calc(100vw - 1rem));
}

.order-sort-popover .status-popover__option {
  display: flex;
  padding-inline: 0.7rem;
}

.queue-pagination {
  display: grid;
  width: min(100%, 34rem);
  align-items: center;
  justify-content: center;
  margin: var(--space-5) auto 0;
  grid-template-columns: auto minmax(10rem, 1fr) auto;
  gap: var(--space-3);
}

.queue-pagination[hidden] {
  display: none;
}

.queue-pagination p {
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  text-align: center;
}

.queue-pagination strong {
  color: var(--c-carbon-soft);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 72rem) {
  .filter-bench:not(.filter-bench--history) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .field--more {
    grid-column: auto;
  }

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

@media (max-width: 52rem) {
  .filter-bench:not(.filter-bench--history) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field--search,
  .filter-bench__more {
    grid-column: 1 / -1;
  }

  .work-table {
    min-width: 0;
  }

}

@media (max-width: 39rem) {
  .filter-bench:not(.filter-bench--history),
  .filter-bench__more {
    grid-template-columns: 1fr;
  }

  .field--search,
  .field--more,
  .filter-bench__more {
    grid-column: 1;
  }

  .queue-pagination {
    grid-template-columns: 1fr 1fr;
  }

  .queue-pagination p {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .queue-pagination .button {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Modern product UI

   The application keeps its semantic structure and interaction contracts, but
   uses a calmer visual language inspired by contemporary productivity tools.
   -------------------------------------------------------------------------- */

html {
  background: var(--c-film);
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -12rem, rgb(82 103 216 / 5%), transparent 32rem),
    var(--c-film);
  color: var(--c-carbon);
}

h1,
h2,
h3 {
  font-stretch: normal;
  letter-spacing: var(--tracking-display);
}

h1 {
  font-weight: 720;
}

h2,
h3 {
  font-weight: 680;
}

button,
input,
select {
  border-radius: var(--radius-hairline);
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--c-registration-cyan);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

::selection {
  background: rgb(82 103 216 / 20%);
  color: var(--c-carbon);
}

.data-label,
.eyebrow,
.field > label,
.field__label,
fieldset > legend,
.period-control > label {
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
  font-size: var(--text-xs);
  font-weight: 620;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
}

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

.data-label {
  font-size: var(--text-2xs);
  letter-spacing: 0.015em;
}

.eyebrow {
  color: var(--c-registration-cyan-ink);
  font-size: var(--text-sm);
}

.eyebrow__mark,
.registration-edge,
.registration-cross {
  display: none;
}

.button,
.icon-button,
.operator-button,
.text-action,
.source-notice__action,
.status-mark {
  transition:
    transform var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.button {
  min-width: 0;
  padding: 0.62rem 1rem;
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--radius-hairline);
  background: var(--c-paper);
  box-shadow: 0 1px 1px rgb(24 25 29 / 3%);
  color: var(--c-carbon-soft);
  font-size: var(--text-sm);
  font-weight: 650;
}

.button:hover {
  border-color: #bec2ca;
  background: #fafafa;
  color: var(--c-carbon);
}

.button:active,
.icon-button:active,
.operator-button:active,
.status-mark:active {
  transform: translateY(1px);
}

.button--wide {
  width: 100%;
}

.button--key {
  border-color: var(--c-carbon);
  background: var(--c-carbon);
  color: var(--c-paper);
}

.button--key:hover {
  border-color: #303238;
  background: #303238;
  color: var(--c-paper);
}

.button--magenta {
  border-color: var(--c-registration-cyan);
  background: var(--c-registration-cyan);
  color: var(--c-paper);
}

.button--magenta:hover {
  border-color: var(--c-registration-cyan-ink);
  background: var(--c-registration-cyan-ink);
  color: var(--c-paper);
}

.button--line,
.button--line-on-key {
  border-color: var(--c-rule-strong);
  background: var(--c-paper);
  color: var(--c-carbon-soft);
}

.button--line:hover,
.button--line-on-key:hover {
  border-color: #bec2ca;
  background: var(--c-cutting-mat);
  color: var(--c-carbon);
}

.button__count {
  border: 0;
  background: var(--c-registration-cyan);
  color: var(--c-paper);
}

.icon-button,
.operator-button {
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--radius-hairline);
  background: var(--c-paper);
  color: var(--c-carbon-soft);
}

.icon-button:hover,
.operator-button:hover {
  border-color: #bec2ca;
  background: var(--c-cutting-mat);
  color: var(--c-carbon);
}

.icon-button--on-key {
  border-color: rgb(255 255 255 / 20%);
  background: rgb(255 255 255 / 8%);
  color: var(--c-paper);
}

.text-action,
.source-notice__action {
  color: var(--c-registration-cyan-ink);
  font-size: var(--text-sm);
  font-weight: 620;
  text-decoration: none;
}

.text-action:hover,
.source-notice__action:hover {
  color: var(--c-registration-cyan);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.field {
  gap: 0.42rem;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.period-control select {
  min-height: var(--control-height);
  padding: 0.66rem 0.78rem;
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--radius-hairline);
  background-color: var(--c-paper);
  box-shadow: inset 0 1px 1px rgb(24 25 29 / 2%);
  color: var(--c-carbon-soft);
}

.field input:hover,
.field select:hover,
.period-control select:hover {
  border-color: #b9bdc5;
}

.field input::placeholder {
  color: #92959c;
}

.check-control input,
.export-choice input,
.format-options input {
  accent-color: var(--c-registration-cyan);
}

.site-header {
  border-bottom: 1px solid rgb(228 230 234 / 88%);
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 1px 0 rgb(24 25 29 / 2%);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
}

.topbar {
  min-height: var(--topbar-height);
  align-items: center;
  grid-template-columns: minmax(11rem, 1fr) auto minmax(11rem, 1fr);
}

.brand-lockup {
  gap: 0.42rem;
  color: var(--c-carbon);
  font-family: var(--font-interface);
  font-size: 1rem;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.brand-lockup::before {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  place-items: center;
  border-radius: 0.55rem;
  background: var(--c-carbon);
  color: var(--c-paper);
  content: "P";
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-lockup__separator {
  display: none;
}

.brand-lockup__secondary {
  color: var(--c-ink-muted);
  font-weight: 560;
}

.brand-lockup--large {
  font-size: 1.12rem;
}

.brand-lockup--large::before {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.72rem;
  font-size: 1rem;
}

.primary-nav {
  align-items: center;
  align-self: center;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: var(--c-cutting-mat);
  gap: 0.18rem;
}

.primary-nav__link {
  min-height: 2.25rem;
  padding-inline: 0.85rem;
  border-radius: 0.55rem;
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
  font-weight: 610;
}

.primary-nav__link::after,
.primary-nav__index {
  display: none;
}

.primary-nav__link:hover {
  background: rgb(255 255 255 / 60%);
  color: var(--c-carbon);
}

.primary-nav__link.is-active,
.primary-nav__link[aria-current="page"] {
  background: var(--c-paper);
  box-shadow: 0 1px 3px rgb(24 25 29 / 8%);
  color: var(--c-carbon);
}

.operator-tools {
  gap: var(--space-2);
}

.operator-button {
  width: 2.35rem;
  height: 2.35rem;
  min-height: 2.35rem;
  border: 0;
  border-radius: 50%;
  background: var(--c-carbon);
  color: var(--c-paper);
  font-size: 0.68rem;
  font-weight: 700;
}

.source-chip {
  padding: 0.34rem 0.58rem;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-round);
  background: #fafafa;
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
  font-size: var(--text-2xs);
  font-weight: 580;
}

.source-chip__dot,
.status-dot {
  width: 0.48rem;
  height: 0.48rem;
  border: 0;
  background: var(--c-warning);
  box-shadow: 0 0 0 3px var(--c-warning-surface);
}

.source-notice {
  min-height: 2.25rem;
  padding: 0.42rem var(--page-gutter);
  border-top: 1px solid var(--c-rule);
  background: #fafbfc;
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
  font-size: var(--text-xs);
}

.source-notice strong {
  color: var(--c-carbon-soft);
  font-weight: 660;
}

.source-notice__mark {
  width: 0.48rem;
  height: 0.48rem;
  border: 0;
  border-radius: 50%;
  background: var(--c-warning);
  box-shadow: 0 0 0 3px var(--c-warning-surface);
  transform: none;
}

.source-notice__action {
  min-height: 1.8rem;
  color: var(--c-ink-muted);
}

.source-notice--compact {
  padding: var(--space-3);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-hairline);
  background: #fafbfc;
}

.app-main {
  padding-top: clamp(2rem, 4vw, 3.5rem);
}

.app-main::before {
  display: none;
}

.view-header {
  align-items: start;
  padding-bottom: 0;
  border-bottom: 0;
  gap: clamp(1.5rem, 4vw, 4rem);
}

.view-header__copy {
  gap: var(--space-2);
}

.view-header__copy > p:last-child {
  color: var(--c-ink-muted);
  font-size: var(--text-md);
}

.tally-ruler {
  min-width: min(100%, 25rem);
  border: 0;
  grid-template-columns: repeat(3, minmax(6rem, 1fr));
  gap: var(--space-3);
}

.tally-ruler__item,
.tally-ruler__item:last-child {
  padding: 0.85rem 1rem;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  box-shadow: var(--shadow-card);
}

.tally-ruler dt {
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
  font-size: var(--text-xs);
  font-weight: 560;
  letter-spacing: 0;
  text-transform: none;
}

.tally-ruler dd {
  color: var(--c-carbon);
  font-family: var(--font-interface);
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.filter-bench {
  margin-top: var(--space-7);
  padding: var(--space-4);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  box-shadow: var(--shadow-card);
}

.filter-bench__more {
  margin-top: 0.15rem;
  padding-top: var(--space-4);
  border-top: 1px solid var(--c-rule);
}

.search-control__mark {
  border-color: #777b84;
}

.search-control__mark::after {
  background: #777b84;
}

.field .search-control input[type="search"] {
  padding-inline-start: 2.6rem;
}

.queue-command {
  min-height: 4rem;
  padding-inline: var(--space-1);
}

.queue-command__result {
  color: var(--c-ink-muted);
}

.production-stack {
  gap: var(--space-4);
}

.production-sheet {
  overflow: hidden;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  box-shadow: var(--shadow-card);
}

.production-sheet__header,
.production-sheet--collapsed .production-sheet__header {
  min-height: 5.6rem;
  padding: var(--space-4) var(--space-5);
  border: 0;
  border-bottom: 1px solid var(--c-rule);
  background: var(--c-paper);
}

.production-sheet--collapsed .production-sheet__header {
  border-bottom: 0;
}

.production-sheet__identity h2 {
  margin-block: 0.12rem 0.28rem;
  color: var(--c-carbon);
}

.production-sheet__identity > p:last-child {
  color: var(--c-ink-muted);
}

.sheet-progress__labels {
  color: var(--c-ink-muted);
}

.sheet-progress__labels strong {
  color: var(--c-carbon-soft);
  font-family: var(--font-interface);
  font-variant-numeric: tabular-nums;
}

.sheet-progress__track {
  height: 0.38rem;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-round);
  background: var(--c-cutting-mat);
}

.sheet-progress__track > span {
  border-radius: inherit;
  background: var(--c-registration-cyan);
}

.chevron {
  width: 0.5rem;
  height: 0.5rem;
  border-width: 1.5px;
}

.production-sheet__body {
  border: 0;
}

.work-table th,
.work-table td {
  padding: 0.9rem var(--space-4);
  border-bottom-color: var(--c-rule);
}

.work-table th {
  height: 2.6rem;
  background: #f8f9fa;
  color: #747780;
  font-family: var(--font-interface);
  font-size: var(--text-2xs);
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
}

.work-table tbody tr {
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.work-table tbody tr:hover td {
  background: #fafbfc;
}

.work-table tbody tr:has(input[type="checkbox"]:checked) td {
  background: var(--c-info-surface);
}

.work-table tbody tr:has(input[type="checkbox"]:checked) td:first-child {
  border-left: 3px solid var(--c-registration-cyan);
}

.order-reference {
  color: var(--c-carbon-soft);
  font-weight: 620;
}

.cell-note,
.work-table td > small {
  color: var(--c-ink-muted);
}

.dorsal,
.size-mark {
  min-width: 2.05rem;
  height: 2.05rem;
  border: 1px solid var(--c-rule-strong);
  border-radius: 0.5rem;
  background: #f8f9fa;
  color: var(--c-carbon-soft);
}

.status-mark {
  min-height: 2.15rem;
  padding: 0.34rem 0.62rem;
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--radius-round);
  background: #f8f9fa;
  color: var(--c-carbon-soft);
  font-size: var(--text-xs);
  font-weight: 630;
}

.status-mark__symbol,
.status-mark__icon {
  display: inline-grid;
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: currentColor;
  font-size: 0.72rem;
  line-height: 1;
}

.status-mark--pending {
  background: #f7f7f8;
  color: #62656d;
}

.status-mark--processed {
  border-color: #cde8d9;
  background: var(--c-success-surface);
  color: var(--c-success);
}

.status-mark--processed .status-mark__symbol {
  background: transparent;
  box-shadow: none;
}

.csv-state {
  min-height: 2.25rem;
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
}

.csv-state__symbol {
  width: 2.25rem;
  height: 1.7rem;
  border: 0;
  border-radius: 0.45rem;
  background: var(--c-cutting-mat);
  color: var(--c-ink-muted);
}

.csv-state--generated,
.csv-state--generated strong {
  color: var(--c-registration-cyan-ink);
}

.csv-state--generated .csv-state__symbol {
  background: var(--c-info-surface);
  color: var(--c-registration-cyan-ink);
}

.csv-state--stale .csv-state__symbol {
  border: 0;
  background: var(--c-warning-surface);
}

.csv-state--never {
  color: var(--c-ink-muted);
}

.empty-sheet,
.empty-inline,
.rank-list__empty,
.history-snapshot-missing {
  border: 1px dashed var(--c-rule-strong);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  color: var(--c-ink-muted);
}

.empty-sheet__registration {
  border: 0;
  background: var(--c-cutting-mat);
}

.selection-deck {
  width: min(56rem, calc(100% - 2rem));
  min-height: 4.5rem;
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 1rem;
  background: rgb(29 30 34 / 96%);
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.selection-deck::before {
  display: none;
}

.selection-deck__summary p:first-child {
  font-weight: 650;
}

.selection-deck__summary p:last-child {
  color: #b9bcc3;
  font-family: var(--font-interface);
}

.selection-deck .button--line-on-key {
  border-color: rgb(255 255 255 / 16%);
  background: rgb(255 255 255 / 7%);
  color: #f5f6f8;
}

.selection-deck .button--line-on-key:hover {
  background: rgb(255 255 255 / 12%);
  color: #ffffff;
}

dialog::backdrop {
  background: var(--c-backdrop);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.export-dialog {
  width: min(100%, var(--dialog-width));
  border: 0;
  border-radius: var(--radius-dialog) 0 0 var(--radius-dialog);
  background: var(--c-film);
  box-shadow: var(--shadow-dialog);
}

.export-dialog__header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--c-rule);
  background: rgb(255 255 255 / 96%);
}

.export-dialog__header h2 {
  font-size: var(--text-xl);
}

.export-dialog__scroll {
  padding: var(--space-6);
}

.preflight-tally {
  border: 0;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.preflight-tally > div,
.preflight-tally > div:last-child {
  padding: var(--space-3);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-hairline);
  background: var(--c-paper);
}

.preflight-tally strong {
  color: var(--c-carbon);
  font-family: var(--font-interface);
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.preflight-tally span {
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
  font-size: var(--text-2xs);
  font-weight: 560;
  text-transform: none;
}

.preflight-tally__new {
  background: var(--c-info-surface) !important;
}

.preflight-tally__repeat {
  background: var(--c-warning-surface) !important;
}

.export-options {
  display: grid;
  gap: var(--space-2);
}

.export-options > legend,
.format-options > legend {
  margin-bottom: var(--space-2);
}

.export-choice,
.export-choice:last-child {
  min-height: 4.6rem;
  padding: var(--space-3);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-hairline);
  background: var(--c-paper);
}

.export-choice:hover {
  border-color: #c7cad1;
  background: var(--c-paper);
}

.export-choice:has(input:checked) {
  border: 1px solid var(--c-registration-cyan);
  background: var(--c-info-surface);
  box-shadow: 0 0 0 1px var(--c-registration-cyan);
}

.export-choice__code {
  border: 0;
  border-radius: 0.58rem;
  background: var(--c-cutting-mat);
  color: var(--c-carbon-soft);
  font-family: var(--font-interface);
  font-weight: 680;
}

.export-choice:has(input:checked) .export-choice__code {
  background: var(--c-registration-cyan);
  color: var(--c-paper);
}

.export-choice__format {
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
  font-weight: 600;
}

.format-options {
  gap: var(--space-2);
}

.format-options label {
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--radius-round);
  background: var(--c-paper);
  color: var(--c-carbon-soft);
  font-size: var(--text-sm);
  font-weight: 610;
}

.format-options label:has(input:checked) {
  border-color: var(--c-registration-cyan);
  background: var(--c-info-surface);
  color: var(--c-registration-cyan-ink);
}

.preflight {
  overflow: hidden;
  border: 1px solid #ead9b6;
  border-radius: var(--radius-card);
  background: var(--c-paper);
}

.preflight__header {
  border-bottom: 1px solid #ead9b6;
  background: var(--c-warning-surface);
}

.preflight__status span {
  border: 0;
  background: rgb(138 98 20 / 10%);
}

.preflight__list li::before {
  border-width: 1.5px;
}

.export-dialog__footer {
  padding: var(--space-4) var(--space-6) max(var(--space-4), env(safe-area-inset-bottom));
  border-top: 1px solid var(--c-rule);
  background: rgb(255 255 255 / 96%);
}

.confirm-dialog {
  padding: var(--space-7);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-dialog);
  background: var(--c-paper);
  box-shadow: var(--shadow-float);
}

.ledger {
  display: grid;
  margin-top: var(--space-6);
  border-top: 0;
  gap: var(--space-3);
}

.ledger-entry {
  overflow: hidden;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  box-shadow: var(--shadow-card);
}

.ledger-entry__summary {
  min-height: 5.5rem;
  padding: var(--space-3) var(--space-4);
}

.ledger-entry__summary:hover {
  background: #fafbfc;
}

.ledger-entry__type {
  border: 0;
  border-radius: 0.55rem;
  background: var(--c-info-surface);
  color: var(--c-registration-cyan-ink);
  font-family: var(--font-interface);
}

.ledger-entry__type--document {
  background: var(--c-cutting-mat);
  color: var(--c-carbon-soft);
}

.ledger-entry__type--workflow {
  background: #fff4ce;
  color: #765700;
}

.ledger-entry__measure strong {
  font-family: var(--font-interface);
  font-variant-numeric: tabular-nums;
}

.ledger-entry__tag {
  padding: 0.28rem 0.55rem;
  border: 1px solid #d5daf8;
  border-radius: var(--radius-round);
  background: var(--c-info-surface);
  color: var(--c-registration-cyan-ink);
  font-size: var(--text-2xs);
  font-weight: 620;
}

.ledger-entry__tag--quiet {
  border-color: var(--c-rule);
  background: #f7f7f8;
  color: var(--c-ink-muted);
}

.ledger-entry__tag--error {
  border-color: #f0caca;
  background: var(--c-danger-surface);
  color: var(--c-danger);
}

.ledger-entry[open] > summary {
  background: #fafbff;
}

.ledger-entry__body {
  padding: var(--space-5) var(--space-6) var(--space-6) 5.75rem;
  border-top: 1px solid var(--c-rule);
  background: #fcfcfd;
}

.audit-line {
  overflow: hidden;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-hairline);
  background: var(--c-paper);
}

.audit-line > div,
.audit-line > div:last-child {
  border-left-color: var(--c-rule);
  border-right: 0;
}

.audit-line dt {
  font-family: var(--font-interface);
  font-weight: 600;
  text-transform: none;
}

.history-day {
  overflow: hidden;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  box-shadow: var(--shadow-card);
}

.history-day__summary {
  display: grid;
  min-height: 5rem;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  list-style: none;
  cursor: pointer;
  grid-template-columns: minmax(10rem, 0.8fr) minmax(28rem, 2fr) var(--touch-target);
  gap: var(--space-5);
}

.history-day__summary::-webkit-details-marker {
  display: none;
}

.history-day__summary:hover {
  background: #fafbfc;
}

.history-day__date,
.history-day__date strong,
.history-day__measure strong,
.history-day__measure small {
  display: block;
}

.history-day__date strong {
  margin-top: 0.18rem;
  color: var(--c-carbon);
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.history-day__measures {
  display: grid;
  grid-template-columns: repeat(4, minmax(5.5rem, 1fr));
  gap: var(--space-3);
}

.history-day__measure {
  min-width: 0;
  padding-left: var(--space-4);
  border-left: 1px solid var(--c-rule);
}

.history-day__measure strong {
  color: var(--c-carbon);
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.history-day__measure small {
  margin-top: 0.12rem;
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
}

.history-day[open] > .history-day__summary {
  background: #fafbfc;
  border-bottom: 1px solid var(--c-rule);
}

.history-day[open] > .history-day__summary .chevron {
  transform: rotate(225deg) translate(-0.08rem, -0.08rem);
}

.history-day__entries {
  display: grid;
  padding: var(--space-3);
  background: #f7f8fa;
  gap: var(--space-3);
}

.history-day__entries .ledger-entry {
  box-shadow: none;
}

.filter-bench--history {
  grid-template-columns: minmax(17rem, 1.7fr) repeat(3, minmax(10rem, 0.72fr));
}

.stats-tally {
  margin-top: var(--space-7);
  border: 0;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.stats-tally > div,
.stats-tally > div:last-child {
  padding: var(--space-5);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  box-shadow: var(--shadow-card);
}

.stats-tally dt {
  color: var(--c-ink-muted);
}

.stats-tally dd {
  font-family: var(--font-interface);
  font-size: clamp(1.85rem, 1.45rem + 1.2vw, 2.8rem);
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  letter-spacing: -0.05em;
}

.stats-tally small {
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
  font-size: var(--text-2xs);
  font-weight: 560;
  text-transform: none;
}

.analysis-grid {
  gap: var(--space-4);
}

.analysis-sheet {
  overflow: hidden;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  box-shadow: var(--shadow-card);
}

.analysis-sheet__header {
  min-height: 4.8rem;
  border-bottom: 1px solid var(--c-rule);
}

.analysis-sheet__unit {
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-round);
  background: var(--c-cutting-mat);
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.rank-list li {
  border-bottom-color: var(--c-rule);
}

.rank-list__index {
  color: #92959c;
  font-family: var(--font-interface);
  font-variant-numeric: tabular-nums;
}

.rank-list__name small {
  color: var(--c-ink-muted);
  font-family: var(--font-interface);
}

.rank-list__bar {
  height: 0.36rem;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-round);
  background: var(--c-cutting-mat);
}

.rank-list__bar > span {
  border-radius: inherit;
  background: var(--c-registration-cyan);
}

.rank-list__value {
  font-family: var(--font-interface);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.export-mix__registration {
  height: 0.5rem;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-round);
  background: var(--c-cutting-mat);
  gap: 2px;
}

.export-mix__registration span:nth-child(1) { background: #5267d8; }
.export-mix__registration span:nth-child(2) { background: #6f80df; }
.export-mix__registration span:nth-child(3) { background: #8e9ae6; }
.export-mix__registration span:nth-child(4) { background: #aeb6eb; }
.export-mix__registration span:nth-child(5) { background: #d0d5f2; }

.data-table th,
.data-table td {
  border-bottom-color: var(--c-rule);
}

.data-table td {
  font-family: var(--font-interface);
  font-variant-numeric: tabular-nums;
}

.legend-mark {
  border: 0;
  border-radius: 0.2rem;
}

.legend-mark--magenta { background: #5267d8; }
.legend-mark--cyan { background: #6f80df; }
.legend-mark--yellow { background: #8e9ae6; }
.legend-mark--key { background: #aeb6eb; }
.legend-mark--mat { background: #d0d5f2; }

.field-quality {
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.field-quality dl {
  overflow: hidden;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-hairline);
  background: #fafbfc;
}

.field-quality dl > div,
.field-quality dl > div:last-child {
  border-left-color: var(--c-rule);
  border-right: 0;
}

.field-quality dd {
  font-family: var(--font-interface);
  font-variant-numeric: tabular-nums;
}

.app-footer {
  min-height: 4rem;
  border-top: 1px solid var(--c-rule);
  background: rgb(255 255 255 / 72%);
  color: var(--c-ink-muted);
}

.login-view {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: var(--space-7) var(--page-gutter);
  background:
    radial-gradient(circle at 50% 10%, rgb(82 103 216 / 8%), transparent 25rem),
    var(--c-film);
}

.login-sheet {
  width: min(100%, 29rem);
  min-height: 0;
  align-content: start;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-dialog);
  background: var(--c-paper);
  box-shadow: 0 24px 70px rgb(24 25 29 / 10%), 0 2px 8px rgb(24 25 29 / 4%);
}

.login-sheet h1 {
  margin-top: var(--space-5);
}

.login-sheet__copy {
  color: var(--c-ink-muted);
}

.loading-view {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-7) var(--page-gutter);
  background:
    radial-gradient(circle at 50% 12%, rgb(82 103 216 / 8%), transparent 24rem),
    var(--c-film);
  place-items: center;
}

.loading-view[hidden] {
  display: none;
}

.loading-sheet {
  display: grid;
  width: min(100%, 24rem);
  justify-items: center;
  padding: var(--space-7);
  color: var(--c-ink-muted);
  text-align: center;
  gap: var(--space-3);
}

.loading-sheet__mark {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
}

.loading-sheet__spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--c-rule-strong);
  border-top-color: var(--c-key);
  border-radius: 999px;
  animation: loading-spin 0.8s linear infinite;
}

.loading-sheet h1 {
  margin: var(--space-2) 0 0;
  color: var(--c-carbon);
  font-size: var(--text-lg);
}

.loading-sheet p {
  margin: 0;
  font-size: var(--text-sm);
}

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

.form-error {
  border-left: 0;
  border-radius: var(--radius-hairline);
}

.toast-region {
  top: calc(var(--topbar-height) + 3.25rem);
}

.toast {
  min-height: 4rem;
  padding: var(--space-3);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: rgb(255 255 255 / 96%);
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.toast__mark {
  border: 0;
  background: var(--c-success);
  box-shadow: 0 0 0 4px var(--c-success-surface);
}

.toast__action {
  color: var(--c-registration-cyan-ink);
  text-decoration: none;
}

.empty-inline,
.rank-list__empty,
.history-snapshot-missing {
  margin: var(--space-4);
  padding: var(--space-5);
  text-align: center;
}

@media (max-width: 72rem) {
  .topbar {
    padding-block: 0.65rem 0;
    gap: 0 var(--space-4);
  }

  .primary-nav {
    width: max-content;
    max-width: 100%;
    justify-self: center;
    margin-top: 0.55rem;
    margin-bottom: 0.65rem;
    border-top: 0;
  }

  .operator-tools {
    align-self: start;
  }

  .view-header {
    gap: var(--space-5);
  }

  .filter-bench {
    grid-template-columns: minmax(16rem, 2fr) repeat(2, minmax(10rem, 1fr));
  }

  .production-sheet__header {
    padding-inline: var(--space-4);
  }
}

@media (min-width: 52.01rem) and (max-width: 72rem) {
  .topbar {
    padding-block: 0;
    grid-template-columns: minmax(11rem, 1fr) auto minmax(11rem, 1fr);
  }

  .primary-nav {
    order: initial;
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .operator-tools {
    align-self: center;
    grid-column: 3;
    grid-row: 1;
  }

  .filter-bench {
    grid-template-columns: minmax(16rem, 2fr) minmax(9rem, 0.8fr) minmax(9rem, 0.8fr) auto;
  }

  .field--more {
    grid-column: auto;
  }
}

@media (max-width: 52rem) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .operator-tools {
    align-self: center;
    grid-column: 2;
    grid-row: 1;
  }

  .app-main {
    padding-top: var(--space-7);
  }

  .source-notice {
    align-items: center;
    padding-block: 0.55rem;
  }

  .source-notice p {
    align-items: center;
  }

  .filter-bench,
  .filter-bench--history {
    grid-template-columns: 1fr 1fr;
  }

  .history-day__summary {
    grid-template-columns: minmax(0, 1fr) var(--touch-target);
    gap: var(--space-3);
  }

  .history-day__measures {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .history-day__summary > .chevron {
    grid-column: 2;
    grid-row: 1;
  }

  .queue-command {
    grid-template-columns: 1fr auto;
  }

  .production-sheet__header {
    grid-template-columns: var(--touch-target) minmax(0, 1fr) var(--touch-target);
  }

  .work-table tbody tr {
    border-bottom: 1px solid var(--c-rule);
    background: var(--c-paper);
  }

  .work-table td,
  .work-table td:first-child,
  .work-table td:last-child {
    border-bottom: 1px solid var(--c-rule);
  }

  .work-table td::before {
    color: #777a82;
    font-family: var(--font-interface);
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }

  .ledger-entry__body {
    padding-left: var(--space-5);
  }

  .audit-line {
    grid-template-columns: 1fr;
  }

  .audit-line > div,
  .audit-line > div:last-child {
    border-right: 0;
    border-bottom: 1px solid var(--c-rule);
  }

  .audit-line > div:last-child {
    border-bottom: 0;
  }

  .stats-tally {
    grid-template-columns: 1fr 1fr;
  }

  .stats-tally > div,
  .stats-tally > div:nth-last-child(-n + 2) {
    border: 1px solid var(--c-rule);
  }
}

@media (max-width: 39rem) {
  body {
    background: var(--c-film);
  }

  .site-header {
    background: var(--c-paper);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .topbar {
    padding: 0.65rem var(--page-gutter) 0;
  }

  .brand-lockup {
    font-size: 0.98rem;
  }

  .brand-lockup::before {
    width: 1.75rem;
    height: 1.75rem;
  }

  .primary-nav {
    width: auto;
    max-width: none;
    justify-self: stretch;
    margin: 0.6rem calc(var(--page-gutter) * -1) 0;
    padding: 0.35rem var(--page-gutter);
    border-top: 1px solid var(--c-rule);
    border-radius: 0;
    background: transparent;
    gap: 0.25rem;
  }

  .primary-nav__link {
    min-height: 2.35rem;
    border-radius: 0.55rem;
    font-size: var(--text-xs);
  }

  .source-notice {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 0.6rem var(--page-gutter);
  }

  .source-notice p {
    display: block;
  }

  .source-notice__action {
    grid-column: 2;
  }

  .app-main {
    padding: var(--space-6) var(--page-gutter) 9rem;
  }

  .view-header {
    gap: var(--space-5);
  }

  .view-header__copy > p:last-child {
    font-size: var(--text-base);
  }

  .tally-ruler {
    gap: var(--space-2);
  }

  .tally-ruler__item,
  .tally-ruler__item:last-child {
    padding: 0.72rem 0.7rem;
    border-radius: 0.72rem;
  }

  .tally-ruler dd {
    font-size: 1.35rem;
  }

  .filter-bench,
  .filter-bench--history,
  .filter-bench__more {
    grid-template-columns: 1fr;
  }

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

  .history-day__measures {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3) var(--space-2);
  }

  .history-day__measure:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .history-day__entries {
    padding: var(--space-2);
  }

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

  .queue-command {
    grid-template-columns: 1fr;
    padding-block: var(--space-4);
    gap: var(--space-3);
  }

  .production-sheet__header {
    min-height: 0;
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .production-sheet__identity h2 {
    font-size: 1.08rem;
  }

  .sheet-progress {
    padding-right: var(--space-2);
  }

  .work-table tbody tr {
    padding: var(--space-2);
  }

  .work-table thead {
    width: 1px;
    max-width: 1px;
    clip-path: inset(50%);
    contain: strict;
  }

  .work-table thead tr,
  .work-table thead th {
    width: 1px !important;
    min-width: 0 !important;
    max-width: 1px !important;
    padding: 0 !important;
    overflow: hidden;
  }

  .work-table td {
    grid-template-columns: 5.8rem minmax(0, 1fr);
  }

  .selection-deck {
    right: 0.5rem;
    bottom: max(0.5rem, env(safe-area-inset-bottom));
    left: 0.5rem;
    width: calc(100% - 1rem);
    padding-bottom: var(--space-3);
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 1rem;
  }

  .selection-deck__actions {
    gap: var(--space-2);
  }

  .export-dialog {
    width: 100%;
    border: 0;
    border-radius: var(--radius-dialog) var(--radius-dialog) 0 0;
  }

  .export-dialog__header,
  .export-dialog__scroll,
  .export-dialog__footer {
    padding-inline: var(--space-4);
  }

  .preflight-tally {
    grid-template-columns: 1fr 1fr;
  }

  .preflight-tally > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--c-rule);
  }

  .export-choice {
    grid-template-columns: 1.35rem 2.5rem minmax(0, 1fr);
  }

  .ledger-entry__summary {
    grid-template-columns: 3rem minmax(0, 1fr) var(--touch-target);
  }

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

  .stats-tally {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .stats-tally > div,
  .stats-tally > div:nth-last-child(-n + 2),
  .stats-tally > div:last-child {
    border: 1px solid var(--c-rule);
  }

  .field-quality dl {
    grid-template-columns: 1fr 1fr;
  }

  .toast-region {
    bottom: 7.5rem;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header,
  .selection-deck,
  .toast {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --c-rule: #b9bdc5;
    --c-rule-strong: #858a94;
    --c-ink-muted: #4f525a;
  }
}

@media print {
  body,
  .app-main {
    background: var(--c-paper);
  }

  .production-sheet,
  .analysis-sheet,
  .ledger-entry,
  .stats-tally > div {
    box-shadow: none;
  }
}

/* --------------------------------------------------------------------------
   Local UI libraries: Geist, Lucide and Chart.js

   These rules are intentionally scoped to the new primitives. The assets are
   served locally, so the interface keeps the same polish without depending on
   a third-party CDN at runtime.
   -------------------------------------------------------------------------- */

body {
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  font-synthesis: none;
}

h1,
h2,
h3,
.brand-lockup {
  font-stretch: normal;
  text-wrap: balance;
}

h1 {
  font-weight: 740;
  letter-spacing: -0.045em;
}

h2 {
  font-weight: 680;
  letter-spacing: -0.032em;
}

h3 {
  font-weight: 650;
  letter-spacing: -0.022em;
}

.app-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  overflow: visible;
  color: currentColor;
  pointer-events: none;
}

.button > .app-icon,
.icon-button > .app-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.primary-nav__link .app-icon {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.78;
  transition: opacity var(--duration-fast) var(--ease-standard);
}

.primary-nav__link:hover .app-icon,
.primary-nav__link.is-active .app-icon,
.primary-nav__link[aria-current="page"] .app-icon {
  opacity: 1;
}

.source-chip .app-icon {
  width: 0.78rem;
  height: 0.78rem;
  color: var(--c-success);
}

.source-notice__icon {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--c-ink-muted);
}

.search-control__icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 0.82rem;
  width: 1rem;
  height: 1rem;
  color: #858891;
  transform: translateY(-50%);
}

.search-control:focus-within .search-control__icon {
  color: var(--c-registration-cyan-ink);
}

.field .search-control input[type="search"] {
  padding-inline-start: 2.45rem;
}

.csv-state__icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.csv-state--generated .csv-state__icon {
  color: var(--c-success);
}

.csv-state--stale .csv-state__icon {
  color: var(--c-warning);
}

.csv-state--never .csv-state__icon {
  color: #989ba3;
}

.production-sheet__toggle .app-icon,
.chart-data summary .app-icon {
  transition: transform var(--duration-medium) var(--ease-standard);
}

.production-sheet__toggle[aria-expanded="true"] .app-icon,
.chart-data[open] summary .app-icon {
  transform: rotate(180deg);
}

/* Notion-like status property. The full control remains a 44px touch target. */

.workflow-status {
  display: inline-flex;
  min-width: 0;
  align-items: center;
}

.workflow-status__trigger {
  display: inline-grid;
  min-width: 0;
  min-height: var(--touch-target);
  align-items: center;
  padding: 0.45rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: transparent;
  grid-template-columns: 1rem minmax(0, auto) 0.8rem;
  gap: 0.42rem;
  color: var(--c-carbon-soft);
  font-size: var(--text-xs);
  font-weight: 610;
  line-height: 1.2;
  text-align: left;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.workflow-status__trigger:hover,
.workflow-status__trigger[aria-expanded="true"] {
  border-color: var(--c-rule-strong);
  box-shadow: 0 1px 2px rgb(24 25 29 / 4%);
}

.workflow-status__trigger--pending {
  background: #f1f1f2;
  color: #5f626a;
}

.workflow-status__trigger--pending:hover,
.workflow-status__trigger--pending[aria-expanded="true"] {
  background: #e9e9eb;
}

.workflow-status__trigger--processed {
  background: #e7f3eb;
  color: #287052;
}

.workflow-status__trigger--processed:hover,
.workflow-status__trigger--processed[aria-expanded="true"] {
  border-color: #c7dfd1;
  background: #dcece2;
}

.workflow-status__trigger:disabled,
.workflow-status__trigger[aria-busy="true"] {
  opacity: 0.58;
}

.workflow-status__state-icon {
  width: 0.9rem;
  height: 0.9rem;
}

.workflow-status__chevron {
  width: 0.72rem;
  height: 0.72rem;
  color: currentColor;
  opacity: 0.62;
  transition: transform var(--duration-fast) var(--ease-standard);
}

.workflow-status__trigger[aria-expanded="true"] .workflow-status__chevron {
  transform: rotate(180deg);
}

.status-popover {
  position: fixed;
  z-index: var(--z-dialog);
  inset: auto;
  width: min(15.5rem, calc(100vw - 1rem));
  margin: 0;
  padding: 0.38rem;
  border: 1px solid var(--c-rule);
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 98%);
  box-shadow: 0 16px 42px rgb(24 25 29 / 16%), 0 3px 10px rgb(24 25 29 / 8%);
  color: var(--c-carbon);
  font: inherit;
  opacity: 0;
  transform: translateY(-0.25rem) scale(0.985);
  transform-origin: top center;
  transition:
    display var(--duration-fast) allow-discrete,
    overlay var(--duration-fast) allow-discrete,
    opacity var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.status-popover:popover-open {
  display: grid;
  opacity: 1;
  transform: translateY(0) scale(1);
  gap: 0.12rem;
}

.status-popover.is-open {
  display: grid;
  opacity: 1;
  transform: translateY(0) scale(1);
  gap: 0.12rem;
}

@starting-style {
  .status-popover:popover-open {
    opacity: 0;
    transform: translateY(-0.25rem) scale(0.985);
  }
}

.status-popover::backdrop {
  background: transparent;
}

.status-popover__label {
  padding: 0.46rem 0.62rem 0.34rem;
  color: #7a7d85;
  font-size: var(--text-2xs);
  font-weight: 620;
}

.status-popover__option {
  display: grid;
  width: 100%;
  min-height: var(--touch-target);
  align-items: center;
  padding: 0.48rem 0.58rem;
  border-radius: 0.52rem;
  background: transparent;
  grid-template-columns: 1rem minmax(0, 1fr) 0.9rem;
  gap: 0.62rem;
  color: var(--c-carbon-soft);
  text-align: left;
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.status-popover__option:hover,
.status-popover__option:focus-visible {
  background: #f3f3f4;
}

.status-popover__option > span {
  display: grid;
  min-width: 0;
  gap: 0.08rem;
}

.status-popover__option strong {
  font-size: var(--text-sm);
  font-weight: 620;
}

.status-popover__option small {
  color: var(--c-ink-muted);
  font-size: var(--text-2xs);
  font-weight: 450;
}

.status-popover__option--pending > .app-icon:first-child {
  color: #747780;
}

.status-popover__option--processed > .app-icon:first-child {
  color: var(--c-success);
}

.status-popover__check {
  opacity: 0;
}

.status-popover__option[aria-checked="true"] {
  background: #f4f5f6;
}

.status-popover__option[aria-checked="true"] .status-popover__check {
  opacity: 1;
}

/* Charts and their equivalent data tables share one quiet card language. */

.stats-visual-grid {
  display: grid;
  margin-top: var(--space-4);
  grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 0.85fr);
  gap: var(--space-4);
}

.stats-chart-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-card);
  background: var(--c-paper);
  box-shadow: var(--shadow-card);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.stats-chart-card__header {
  display: flex;
  min-height: 4.9rem;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5) 0;
  gap: var(--space-4);
}

.stats-chart-card__heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
}

.stats-chart-card__heading h2 {
  margin-top: 0.14rem;
  font-size: var(--text-md);
}

.icon-tile {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.65rem;
  background: var(--c-info-surface);
  color: var(--c-registration-cyan-ink);
}

.icon-tile--success {
  background: var(--c-success-surface);
  color: var(--c-success);
}

.stats-chart-card__description {
  max-width: 64ch;
  padding: 0.55rem var(--space-5) 0;
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.chart-shell {
  position: relative;
  min-width: 0;
  padding: var(--space-4) var(--space-5) var(--space-3);
}

.chart-shell canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

.chart-shell--timeline {
  height: 20rem;
}

.chart-shell--doughnut {
  height: 20rem;
}

.chart-shell--products {
  height: 22rem;
  padding: var(--space-5);
}

.chart-center {
  position: absolute;
  top: 43%;
  left: 50%;
  display: grid;
  width: 5.5rem;
  place-items: center;
  color: var(--c-ink-muted);
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.chart-center strong {
  color: var(--c-carbon);
  font-family: var(--font-interface);
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  letter-spacing: -0.04em;
  line-height: 1;
}

.chart-center span {
  margin-top: 0.28rem;
  font-size: var(--text-2xs);
  font-weight: 560;
}

.chart-empty {
  position: absolute;
  inset: var(--space-4);
  display: grid;
  place-items: center;
  border: 1px dashed var(--c-rule-strong);
  border-radius: var(--radius-hairline);
  background: #fafbfc;
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
  text-align: center;
}

.chart-data {
  border-top: 1px solid var(--c-rule);
  background: #fcfcfd;
}

.chart-data > summary {
  display: flex;
  min-height: var(--touch-target);
  align-items: center;
  justify-content: space-between;
  padding: 0.68rem var(--space-5);
  list-style: none;
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  font-weight: 590;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

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

.chart-data > summary:hover {
  background: #f6f7f8;
  color: var(--c-carbon-soft);
}

.chart-data > summary .app-icon {
  width: 0.8rem;
  height: 0.8rem;
}

.chart-data .table-scroll,
.chart-data > .data-table,
.chart-data > .rank-list {
  border-top: 1px solid var(--c-rule);
}

.chart-data .data-table {
  min-width: 30rem;
}

.chart-data > .data-table,
.chart-data .table-scroll {
  padding-inline: var(--space-5);
}

.chart-data .data-table th,
.chart-data .data-table td {
  padding-block: 0.72rem;
  font-size: var(--text-xs);
}

.chart-data .data-table th {
  color: var(--c-carbon-soft);
  font-weight: 570;
}

.chart-data .data-table td {
  color: var(--c-ink-muted);
}

.chart-data--products .rank-list {
  max-height: 25rem;
  overflow-y: auto;
}

.analysis-grid {
  align-items: start;
}

.analysis-sheet:has(.chart-shell--products) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

@media (max-width: 64rem) {
  .stats-visual-grid {
    grid-template-columns: 1fr;
  }

  .stats-chart-card--wide {
    grid-column: auto;
  }

  .chart-shell--doughnut {
    height: 22rem;
    max-width: 34rem;
    justify-self: center;
    width: 100%;
  }
}

@media (max-width: 52rem) {
  .workflow-status__trigger {
    justify-self: start;
  }

  .stats-chart-card__header {
    padding-inline: var(--space-4);
  }

  .stats-chart-card__description {
    padding-inline: var(--space-4);
  }

  .chart-shell {
    padding-inline: var(--space-4);
  }

  .chart-data > summary,
  .chart-data > .data-table,
  .chart-data .table-scroll {
    padding-inline: var(--space-4);
  }
}

@media (max-width: 39rem) {
  .primary-nav__link {
    gap: 0.35rem;
  }

  .primary-nav__link .app-icon {
    width: 0.82rem;
    height: 0.82rem;
  }

  .source-notice__icon {
    margin-top: 0.12rem;
  }

  .workflow-status__trigger {
    max-width: 100%;
  }

  .status-popover {
    width: min(15.5rem, calc(100vw - 1rem));
  }

  .stats-chart-card__header {
    min-height: 4.5rem;
    align-items: flex-start;
    padding-top: var(--space-4);
  }

  .stats-chart-card__heading {
    align-items: flex-start;
  }

  .icon-tile {
    width: 2rem;
    height: 2rem;
  }

  .chart-shell--timeline {
    height: 18rem;
  }

  .chart-shell--doughnut {
    height: 19rem;
  }

  .chart-shell--products {
    height: 22rem;
    padding-inline: var(--space-3);
  }

  .chart-data .data-table {
    min-width: 27rem;
  }
}

@media (prefers-contrast: more) {
  .workflow-status__trigger,
  .status-popover,
  .status-popover__option[aria-checked="true"],
  .stats-chart-card,
  .icon-tile {
    border-color: var(--c-rule-strong);
  }

  .status-popover__option[aria-checked="true"] {
    outline: 1px solid var(--c-carbon);
    outline-offset: -2px;
  }
}

@media print {
  .status-popover,
  .chart-data > summary {
    display: none !important;
  }

  .stats-chart-card {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* Final responsive precedence for the six production controls. */
@media (min-width: 52.01rem) and (max-width: 72rem) {
  .filter-bench:not(.filter-bench--history) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 52rem) {
  .filter-bench:not(.filter-bench--history) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bench:not(.filter-bench--history) .field--search,
  .filter-bench:not(.filter-bench--history) .filter-bench__more {
    grid-column: 1 / -1;
  }

}

@media (max-width: 39rem) {
  .filter-bench:not(.filter-bench--history),
  .filter-bench:not(.filter-bench--history) .filter-bench__more {
    grid-template-columns: 1fr;
  }

  .filter-bench:not(.filter-bench--history) .field--search,
  .filter-bench:not(.filter-bench--history) .field--more,
  .filter-bench:not(.filter-bench--history) .filter-bench__more {
    grid-column: 1;
  }
}

/* Custom select: a shared, keyboard-safe menu for every single-choice filter. */
.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select__native {
  display: none !important;
}

.custom-select__trigger {
  display: grid;
  width: 100%;
  min-height: var(--control-height);
  align-items: center;
  padding: 0.66rem 0.72rem 0.66rem 0.78rem;
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--radius-hairline);
  background: var(--c-paper);
  box-shadow: inset 0 1px 1px rgb(24 25 29 / 2%), 0 1px 1px rgb(24 25 29 / 2%);
  color: var(--c-carbon-soft);
  font-size: var(--text-sm);
  font-weight: 520;
  line-height: 1.25;
  text-align: left;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.custom-select__trigger:hover {
  border-color: #b9bdc5;
  background: #fcfcfd;
}

.custom-select.is-open .custom-select__trigger {
  border-color: #aeb5df;
  box-shadow: var(--focus-ring);
}

.custom-select__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select__chevron {
  width: 0.9rem;
  height: 0.9rem;
  color: #7b7e86;
  transition: transform var(--duration-fast) var(--ease-standard);
}

.custom-select.is-open .custom-select__chevron {
  transform: rotate(180deg);
}

.custom-select__menu {
  position: absolute;
  z-index: var(--z-selection);
  top: calc(100% + 0.4rem);
  right: 0;
  left: 0;
  min-width: 100%;
  max-height: min(19rem, calc(100vh - 2rem));
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--c-rule);
  border-radius: 0.78rem;
  background: rgb(255 255 255 / 98%);
  box-shadow: 0 14px 36px rgb(24 25 29 / 14%), 0 2px 8px rgb(24 25 29 / 7%);
  overscroll-behavior: contain;
}

.custom-select--opens-up .custom-select__menu {
  top: auto;
  bottom: calc(100% + 0.4rem);
}

.custom-select__option {
  display: grid;
  width: 100%;
  min-height: 2.35rem;
  align-items: center;
  padding: 0.52rem 0.6rem;
  border: 0;
  border-radius: 0.52rem;
  background: transparent;
  color: var(--c-carbon-soft);
  font-size: var(--text-sm);
  font-weight: 520;
  line-height: 1.3;
  text-align: left;
  grid-template-columns: minmax(0, 1fr) 1rem;
  gap: var(--space-3);
}

.custom-select__option:hover,
.custom-select__option:focus-visible {
  background: var(--c-cutting-mat);
  color: var(--c-carbon);
  outline: 0;
  box-shadow: none;
}

.custom-select__option[aria-selected="true"] {
  background: var(--c-info-surface);
  color: var(--c-registration-cyan-ink);
  font-weight: 620;
}

.custom-select__check {
  width: 0.95rem;
  height: 0.95rem;
  opacity: 0;
}

.custom-select__option[aria-selected="true"] .custom-select__check {
  opacity: 1;
}

.field--inline .custom-select {
  width: auto;
  min-width: 12rem;
}

.period-control .custom-select {
  min-width: 11rem;
}

@media (max-width: 39rem) {
  .field--inline .custom-select,
  .period-control .custom-select {
    width: 100%;
    min-width: 0;
  }

  .custom-select__menu {
    max-height: min(16rem, calc(100vh - 1rem));
  }
}

@media (prefers-contrast: more) {
  .custom-select__trigger,
  .custom-select__menu {
    border-color: var(--c-carbon);
  }
}

@media print {
  .custom-select__menu {
    display: none !important;
  }
}

/* Production refinements: compact Notion-like properties and product-led groups. */

.queue-command {
  grid-template-columns: minmax(16rem, 1fr) auto auto auto;
}

.queue-command__fold {
  min-width: 9.5rem;
  justify-self: end;
  white-space: nowrap;
}

.production-sheet__header,
.production-sheet--collapsed .production-sheet__header {
  grid-template-columns: var(--touch-target) 3.25rem minmax(17rem, 1fr) minmax(12rem, 18rem) var(--touch-target);
  gap: var(--space-4);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.production-sheet__header:hover {
  background-color: #fafafa;
}

.production-sheet__header:has(:focus-visible) {
  border-color: var(--c-focus);
}

.product-thumbnail--group {
  width: 3.25rem;
  height: 3.75rem;
  margin-inline: 0;
  background: #f7f7f7;
}

.work-table th:nth-child(8),
.work-table .work-table__workflow {
  width: 9rem;
}

.work-table th:nth-child(9),
.work-table .work-table__csv {
  width: 8rem;
}

.workflow-status__trigger {
  min-width: 7.65rem;
  min-height: 2.25rem;
  padding: 0.42rem 0.58rem;
  border: 0;
  border-radius: 0.5rem;
  grid-template-columns: 0.48rem minmax(0, 1fr) 0.72rem;
  gap: 0.42rem;
  white-space: nowrap;
  box-shadow: none;
}

.workflow-status__trigger:hover,
.workflow-status__trigger[aria-expanded="true"] {
  border-color: transparent;
  box-shadow: inset 0 0 0 1px rgb(24 25 29 / 8%);
}

.workflow-status__trigger--pending {
  background: #fbf3db;
  color: #7a6424;
}

.workflow-status__trigger--pending:hover,
.workflow-status__trigger--pending[aria-expanded="true"] {
  background: #f6eac7;
}

.workflow-status__trigger--processed {
  background: #dbeddb;
  color: #376b49;
}

.workflow-status__trigger--processed:hover,
.workflow-status__trigger--processed[aria-expanded="true"] {
  border-color: transparent;
  background: #cfe5d2;
}

.workflow-status__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.72;
}

.workflow-status__chevron {
  justify-self: end;
}

.status-popover__option--pending > .app-icon:first-child {
  color: #b28a2e;
}

.status-popover__option--processed > .app-icon:first-child {
  color: #4b8b60;
}

.status-popover__option--pending[aria-checked="true"] {
  background: #fbf3db;
  color: #6f5b20;
}

.status-popover__option--processed[aria-checked="true"] {
  background: #dbeddb;
  color: #315f42;
}

@media (max-width: 72rem) {
  .queue-command {
    grid-template-columns: minmax(14rem, 1fr) auto auto;
  }

  .queue-command__result {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .production-sheet__header,
  .production-sheet--collapsed .production-sheet__header {
    grid-template-columns: var(--touch-target) 3rem minmax(0, 1fr) minmax(10rem, 14rem) var(--touch-target);
  }

  .product-thumbnail--group {
    width: 3rem;
    height: 3.5rem;
  }
}

@media (max-width: 52rem) {
  .queue-command {
    grid-template-columns: 1fr auto;
  }

  .queue-command__fold {
    grid-column: 2;
    grid-row: 1;
  }

  .production-sheet__header,
  .production-sheet--collapsed .production-sheet__header {
    grid-template-columns: var(--touch-target) 3rem minmax(0, 1fr) var(--touch-target);
    gap: var(--space-3);
  }

  .production-sheet__identity {
    grid-column: 3;
  }

  .sheet-progress {
    grid-column: 2 / 4;
    grid-row: 2;
  }

  .production-sheet__toggle {
    grid-column: 4;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 39rem) {
  .queue-command {
    grid-template-columns: 1fr;
  }

  .queue-command__fold {
    width: 100%;
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
  }

  .production-sheet__header,
  .production-sheet--collapsed .production-sheet__header {
    grid-template-columns: var(--touch-target) 2.65rem minmax(0, 1fr) var(--touch-target);
    gap: var(--space-2);
  }

  .product-thumbnail--group {
    width: 2.65rem;
    height: 3.15rem;
  }
}

/*
 * On wide workstations, keep utility columns compact and give the available
 * canvas to the order data. The colgroup makes the distribution apply equally
 * to headers and body rows, avoiding the oversized empty edge columns created
 * by the fixed-layout fallback.
 */
@media (min-width: 112rem) {
  .work-table {
    min-width: 0;
  }

  .work-table__col--check { width: 3%; }
  .work-table__col--product-image { width: 5%; }
  .work-table__col--order { width: 15%; }
  .work-table__col--personalization { width: 20%; }
  .work-table__col--team { width: 13%; }
  .work-table__col--size { width: 8%; }
  .work-table__col--order-state { width: 13%; }
  .work-table__col--workflow { width: 10%; }
  .work-table__col--csv { width: 9%; }
  .work-table__col--action { width: 4%; }
}

/* Production identity, password visibility and compact data labels. */

.source-notice--production .source-notice__mark {
  background: var(--c-success);
  box-shadow: 0 0 0 3px var(--c-success-surface);
}

.source-notice--production .source-notice__icon {
  color: var(--c-success);
}

.password-control {
  position: relative;
}

.password-control > input {
  width: 100%;
  padding-right: 3.25rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.42rem;
  display: inline-grid;
  width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--c-ink-muted);
  transform: translateY(-50%);
  place-items: center;
}

.password-toggle:hover,
.password-toggle[aria-pressed="true"] {
  background: var(--c-cutting-mat);
  color: var(--c-carbon);
}

.password-toggle .app-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.personalization-primary__line,
.size-primary {
  display: flex;
  align-items: baseline;
  gap: 0.32rem;
}

.data-field-label {
  color: var(--c-registration-cyan-ink);
  font-family: var(--font-interface);
  font-weight: 720;
}

.data-field-value {
  color: var(--c-carbon);
  font-weight: 720;
}

.size-primary {
  flex-wrap: wrap;
  line-height: 1.2;
}

.size-primary--quantity {
  margin-top: 0.18rem;
}

.size-primary .quantity-mark {
  margin: 0;
}

/* Final history precedence after the legacy responsive layer. */
@media (min-width: 64.01rem) {
  .filter-bench--history {
    grid-template-columns: minmax(16rem, 1.55fr) repeat(4, minmax(8.5rem, 0.72fr));
  }

  .ledger-entry__summary {
    grid-template-columns: 3.2rem 5rem minmax(12rem, 1.5fr) minmax(7rem, 0.62fr) minmax(4rem, 0.32fr) minmax(4rem, 0.32fr) minmax(8rem, 0.65fr) auto var(--touch-target);
  }

  .field-quality dl {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 39.01rem) and (max-width: 64rem) {
  .field-quality dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 64.01rem) and (max-width: 80rem) {
  .ledger-entry__summary {
    grid-template-columns: 3.2rem 4.25rem minmax(11rem, 1.5fr) minmax(6rem, 0.55fr) repeat(2, minmax(3.5rem, 0.3fr)) auto var(--touch-target);
  }

  .ledger-entry__operator {
    display: none;
  }
}

@media (min-width: 39.01rem) and (max-width: 64rem) {
  .filter-bench--history {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bench--history .field--search {
    grid-column: 1 / -1;
  }

  .ledger-entry__summary {
    grid-template-columns: 3.2rem 4.25rem minmax(10rem, 1fr) repeat(2, minmax(3.5rem, 0.3fr)) auto var(--touch-target);
  }

  .ledger-entry__club,
  .ledger-entry__operator {
    display: none;
  }
}

@media (max-width: 39rem) {
  .filter-bench--history {
    grid-template-columns: 1fr;
  }

  .filter-bench--history .field--search {
    grid-column: auto;
  }

  .ledger-entry__summary {
    grid-template-columns: 3rem 3.8rem minmax(0, 1fr) auto var(--touch-target);
  }

  .ledger-entry__club,
  .ledger-entry__measure,
  .ledger-entry__operator {
    display: none;
  }
}
