:root {
  color-scheme: light;
  background: #f3f5f0;
  color: #1c2a20;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 100%;
  line-height: 1.45;
  --green: #165539;
  --green-dark: #0c3c28;
  --green-pale: #e8f2eb;
  --muted: #526257;
  --border: #d2ddd4;
  --white: #fff;
  --danger: #8e281e;
  --danger-bg: #fbece8;
  --warning-bg: #faf0d6;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.13; }
h1 { font-size: clamp(2rem, 6.2vw, 3.1rem); font-weight: 810; letter-spacing: -.05em; }
h2 { font-size: clamp(1.3rem, 4vw, 1.7rem); letter-spacing: -.035em; }
p { overflow-wrap: anywhere; }

.shell { width: min(100% - 2rem, 70rem); margin-inline: auto; }
.site-header { background: #122e21; color: #fff; }
.masthead { min-height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.brand { font-size: clamp(1.2rem, 4vw, 1.6rem); font-weight: 900; letter-spacing: -.075em; white-space: nowrap; }
.brand-period { color: #a6d4ad; }
.account { display: flex; align-items: center; gap: .6rem; font-size: .875rem; }
.main { padding-block: 1.8rem 3rem; }
.page-heading { display: grid; gap: .55rem; margin-bottom: 1.45rem; }
.page-heading p, .muted { color: var(--muted); }

.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.login { max-width: 28rem; margin: min(10vh, 5rem) auto 0; }
.login-card { display: grid; gap: .7rem; padding: clamp(1.2rem, 5vw, 2rem); }
.login-card h1 { font-size: clamp(1.75rem, 7vw, 2.55rem); }
.login-card p { margin-bottom: .6rem; }
.login-card .button { margin-top: .5rem; }
.notification { border: 1px solid #aec9b5; border-radius: var(--radius); padding: .7rem 1rem; margin: 0 0 1rem; background: var(--green-pale); }
.notification[data-error="true"] { border-color: #e2b5aa; background: var(--danger-bg); color: var(--danger); }
.login:not([hidden]) + .notification { max-width: 28rem; margin: .8rem auto 0; }

.scope { display: grid; gap: .9rem; padding: .95rem; margin-bottom: 1rem; }
.store-field { min-width: 0; border: 0; margin: 0; padding: 0; }
.store-field legend { font-weight: 680; font-size: .9rem; padding: 0 0 .35rem; }
.store-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.store-choice { position: relative; display: flex; min-width: 0; }
.scope-detail { font-size: .875rem; }
.field, .staff-field { display: grid; gap: .3rem; min-width: 0; }
label, summary { font-weight: 680; font-size: .9rem; }
input, select, button { font: inherit; }
input:not([type="checkbox"]), select {
  background: #fff;
  color: inherit;
  border: 1px solid #aebfb2;
  border-radius: 9px;
  min-height: 2.75rem;
  min-width: 0;
  width: 100%;
  padding: .55rem .7rem;
}
input[type="date"] { -webkit-appearance: none; appearance: none; }
select {
  appearance: none;
  padding-right: 1.8rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%),
    linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: right 1rem center, right .68rem center;
  background-size: .33rem .33rem;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}
input::placeholder { color: #647166; opacity: 1; }
input[readonly] { background: #f3f6f3; }
input[aria-invalid="true"] { border-color: var(--danger); background: #fef7f5; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--green); }
:focus-visible { outline: 3px solid #459161; outline-offset: 2px; }
.store-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; }
.store-choice span {
  display: flex;
  align-items: center;
  flex: 1;
  min-height: 2.75rem;
  padding: .36rem .52rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.store-choice input:checked + span { color: var(--green-dark); background: var(--green-pale); border-color: var(--green); }
.store-choice input:focus-visible + span { outline: 3px solid #459161; outline-offset: 2px; }
.store-choice input:disabled + span { opacity: .64; cursor: default; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .55rem .8rem;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 720;
  font-size: .94rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { background: var(--green-pale); color: var(--green-dark); border-color: #b7d0bf; }
.button-secondary:hover { background: #d7e9dc; }
.button-subtle, .button-quiet { color: inherit; background: transparent; border-color: currentColor; }
.button-quiet { border-color: transparent; color: var(--muted); padding-inline: .45rem; text-decoration: underline; text-underline-offset: .16em; }
.button[aria-disabled="true"], .button:disabled { opacity: .56; cursor: default; }
.masthead .button { min-height: 2.45rem; }
.masthead .button:hover { background: #ffffff26; }

.report, .count { margin-bottom: 1rem; }
.section-header, .toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: flex-end; gap: .9rem; }
.section-header p { margin-top: .35rem; font-size: .9rem; }
.report-header, .count-header { padding: 1rem; }
.count-header { align-items: flex-start; }
.count-header > div { flex: 1 1 0; min-width: 0; }
.status-groups { display: grid; gap: .75rem; padding: 0 1rem 1rem; }
.status-group { min-width: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.status-group h3 { margin: 0; padding: .7rem .85rem; background: #f3f6f3; font-size: 1rem; }
.status-list, .item-list, .search-results { list-style: none; margin: 0; padding: 0; }
.status-list > li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .65rem .85rem; border-top: 1px solid var(--border); }
.status-description { display: grid; min-width: 0; }
.status-description span { overflow-wrap: anywhere; }
.status-description .muted, .item-meta, .item-note { font-size: .875rem; }
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #edf0ec;
  color: #3c5143;
  font-size: .875rem;
  font-weight: 730;
  line-height: 1.2;
  padding: .38rem .65rem;
  white-space: nowrap;
}
.status[data-value="submitted"] { color: var(--green-dark); background: var(--green-pale); }
.status[data-value="draft"] { color: #5e460c; background: var(--warning-bg); }
.info { padding: 1rem; }

.toolbar { padding: 0 1rem; }
.search-field { flex: 1 1 12rem; }
.count-hint, .empty { padding: .75rem 1rem; font-size: .9rem; }
.count-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: .6rem; padding: .75rem 1rem; border-top: 1px solid var(--border); }
.count-row:focus-within { background: #f8fcf8; }
.item-card { display: grid; gap: .17rem; overflow-wrap: anywhere; }
.item-name { font-weight: 720; }
.item-details { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; }
.item-code {
  padding: .1rem .4rem;
  border-radius: .35rem;
  background: var(--green-pale);
  color: var(--green-dark);
  font-size: .875rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: text;
}
.item-code-missing { background: var(--warning-bg); color: #5e460c; }
.item-meta { color: var(--muted); }
.item-meta:empty { display: none; }
.item-note { color: #655012; }
.quantity-group { display: grid; grid-template-columns: 5.25rem minmax(1.7rem, auto); align-items: center; column-gap: .27rem; min-width: 0; }
.quantity { text-align: right; font-variant-numeric: tabular-nums; }
.unit { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.remove-item { grid-column: 1 / -1; justify-self: start; min-height: 2rem; }
.count-footer { display: grid; gap: .75rem; padding: 1rem; border-top: 1px solid var(--border); }
.empty-check { display: flex; align-items: center; gap: .5rem; min-height: 2.75rem; }
.count-actions { display: grid; gap: .65rem; }
.save-indicator { font-size: .875rem; overflow-wrap: anywhere; }
.save-indicator:empty { display: none; }
.conflict { padding: .8rem 1rem; background: var(--warning-bg); color: #5e460c; }
.conflict .button { margin-top: .65rem; }

dialog { width: min(100% - 1.5rem, 41rem); max-height: min(90vh, 53rem); border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); color: inherit; padding: 1rem; }
dialog::backdrop { background: #122e216e; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
dialog input[type="search"] { margin: .3rem 0 .6rem; }
dialog p { font-size: .875rem; }
.search-results { margin: .5rem 0; max-height: 42vh; overflow-y: auto; }
.search-results li + li { border-top: 1px solid var(--border); }
.pick-item { display: grid; gap: .12rem; min-height: 2.75rem; width: 100%; text-align: left; border: 0; padding: .45rem .6rem; background: var(--white); color: inherit; cursor: pointer; }
.pick-item:hover, .pick-item:focus-visible { background: var(--green-pale); }
.pick-item:focus-visible { outline-offset: -3px; }
details { border-top: 1px solid var(--border); padding-top: .6rem; }
summary { padding: .35rem 0; cursor: pointer; color: var(--green-dark); }
.custom-form { display: grid; gap: .65rem; padding-top: .5rem; }

@media (min-width: 23rem) {
  .scope { grid-template-columns: minmax(8.2rem, .8fr) minmax(0, 1.2fr); }
  .store-field, .scope-detail { grid-column: 1 / -1; }
}

@media (min-width: 36rem) {
  .scope { grid-template-columns: 10rem minmax(0, 1fr); }
  .store-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .status-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .count-footer { grid-template-columns: minmax(12rem, 1fr) auto; align-items: end; }
  .count-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .empty-check, .save-indicator { grid-column: 1 / -1; }
  .quantity-group { grid-template-columns: 6.5rem minmax(2.7rem, auto); }
  .custom-form { grid-template-columns: 1fr 8rem; }
  .custom-form p { grid-column: 1 / -1; }
}

@media (min-width: 52rem) {
  .main { padding-top: 2.85rem; }
  .scope, .report-header, .count-header, .count-footer { padding-inline: 1.35rem; }
  .toolbar, .count-hint, .count-row, .empty, .status-groups { padding-inline: 1.35rem; }
}

.workspace-navigation, .production-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .25rem;
  max-width: 41rem;
  margin-bottom: 1.2rem;
  padding: .25rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #e7ede6;
}
.workspace-navigation .button, .production-tabs .button {
  color: var(--muted);
  padding-inline: .3rem;
  font-size: .875rem;
}
.workspace-navigation [aria-current="page"], .production-tabs [aria-pressed="true"] {
  color: var(--green-dark);
  border-color: var(--border);
  background: var(--white);
}
.production-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}
.production-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.production .notification { max-width: 41rem; }
.production-panel .notification { margin: 0; }
.production-layout { display: grid; gap: 1rem; align-items: start; }
.production-panel {
  display: grid;
  gap: .85rem;
  min-width: 0;
  padding: clamp(.75rem, 3.5vw, 1.3rem);
}
#production-receive { max-width: 42rem; }
.production-fields, .production-ingredients, .production-grid {
  display: grid;
  gap: .8rem;
  min-width: 0;
}
fieldset.production-fields { border: 0; margin: 0; padding: 0; }
.production textarea {
  width: 100%;
  min-width: 0;
  padding: .55rem .7rem;
  border: 1px solid #aebfb2;
  border-radius: 9px;
  font: inherit;
  font-size: 1rem;
  resize: vertical;
}
.production textarea[readonly] { background: #f3f6f3; }
.production-measure { position: relative; display: block; }
.production-measure input {
  padding-inline-end: 3.7rem;
  font-variant-numeric: tabular-nums;
}
.production-measure > span {
  position: absolute;
  inset-inline-end: .65rem;
  inset-block-start: .68rem;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 550;
  pointer-events: none;
}
.production-ingredient {
  display: grid;
  gap: .6rem;
  min-width: 0;
  padding: .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8faf8;
}
.production-ingredient h3, .production-journal p { margin: 0; }
.production-ingredient h3 { font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.production-marinade {
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.production-marinade > .production-ingredients { margin-top: .55rem; }
.production-facts { display: grid; gap: .35rem; margin: 0; font-size: .875rem; }
.production-facts div {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: .4rem;
}
.production-facts dt { color: var(--muted); }
.production-facts dd {
  margin: 0;
  text-align: end;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.production-result, .production-facts .production-result { border-radius: 6px; padding: .28rem .5rem; }
.production-result:empty { display: none; }
.production [data-tone="good"] { color: var(--green-dark); background: var(--green-pale); }
.production [data-tone="warning"] { color: #5e460c; background: var(--warning-bg); }
.production [data-tone="danger"] { color: var(--danger); }
.production-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.production-actions .button-primary { flex: 1; }
.production-journal { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.production-journal li {
  display: grid;
  gap: .35rem;
  min-width: 0;
  padding: .65rem 0 0;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.production-journal strong { font-size: .95rem; }
.production-journal .muted { font-size: .875rem; }
.production-journal .production-edit { justify-self: start; padding-left: 0; }
.production-journal .production-tag { width: fit-content; border-radius: 7px; padding: .2rem .4rem; font-size: .8rem; }

.production-fields .field > span[id$="-label"] { font-size: .9rem; font-weight: 680; }
.production-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr));
  gap: .4rem;
}
.production-choice, .production-picker-trigger, .production-option {
  min-width: 0;
  min-height: 2.75rem;
  padding: .54rem .68rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--white);
  color: var(--green-dark);
  line-height: 1.25;
  font-weight: 680;
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.production-choice[aria-pressed="true"], .production-option[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-pale);
}
.production-picker-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
  width: 100%;
  border-color: #aebfb2;
}
.production-picker-trigger::after { content: '›'; font-size: 1.4rem; line-height: .8; }
.production-picker-trigger:disabled { opacity: .56; cursor: default; }
.production-picker-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: .55rem;
  margin-bottom: .6rem;
}
.production-picker-bar input[type="search"] { margin: 0; }
.production-picker-bar .button[aria-pressed="true"] { border-color: var(--green); }
#production-picker-source-tabs { margin-bottom: .6rem; }
.production-option-list {
  display: grid;
  gap: .4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.production-picker .production-option-list {
  max-height: 55dvh;
  overflow: auto;
  padding: .2rem;
}
.production-option {
  display: grid;
  gap: .22rem;
  width: 100%;
  color: inherit;
}
.production-option-meta { color: var(--muted); font-size: .83rem; font-weight: 500; }
.production-option .production-tag { width: fit-content; border-radius: 6px; padding: .2rem .4rem; font-size: .76rem; }
.production-pending h3 { margin: 0 0 .45rem; font-size: .95rem; }
.production-pending .production-option-list { max-height: 20rem; overflow: auto; padding: .15rem; }
#production-received-history .production-option-list { padding-block: .3rem .15rem; }
.production-line-list { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.production-line-list h3, .production-document-title { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.production-line-header { display: flex; justify-content: space-between; align-items: baseline; gap: .4rem; }
.production-line-header .button { flex: 0 0 auto; min-height: 2rem; padding: .25rem .2rem; }
.production-line-list .production-option-meta { overflow-wrap: anywhere; }
.production-line-list .production-result { font-size: .85rem; }
.production-transfer-products { display: grid; gap: .45rem; }
.production-transfer-products h3 { margin: 0; font-size: 1rem; }
.production-transfer-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: min(54dvh, 29rem);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
}
.production-transfer-list:empty { display: none; }
.production-transfer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.1rem;
  align-items: center;
  gap: .6rem;
  padding: .45rem .55rem;
}
.production-transfer-row + .production-transfer-row { border-top: 1px solid var(--border); }
.production-transfer-row:focus-within { background: var(--green-pale); }
.production-transfer-name { display: grid; gap: .14rem; overflow-wrap: anywhere; }
.production-transfer-name > span:first-child { font-weight: 680; font-size: .93rem; }
.production-transfer-row input { text-align: right; }
.production-transfer-actions { display: grid; gap: .35rem; }
.production-reasons .production-choice:has(:checked) { border-color: var(--green); background: var(--green-pale); }
.production-reasons input { vertical-align: middle; }
.production-fields legend { font-weight: 680; font-size: .9rem; margin-bottom: .35rem; }

@media (min-width: 23rem) {
  .production-tabs { grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 26rem) {
  .production-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 56rem) {
  .production-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
}

.quantity-group.count-dual-quantities {
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: .45rem .7rem;
}
