:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #62717a;
  --line: #dce4e8;
  --paper: #f6f9fd;
  --surface: #ffffff;
  --accent: #174a8b;
  --accent-strong: #0b2f5f;
  --accent-soft: #e8f2ff;
  --accent-line: #bcd4f2;
  --gold: #d9a441;
  --red: #b94a48;
  --shadow: 0 18px 40px rgba(23, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 6px clamp(10px, 2vw, 22px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 3;
}

.app-header > div:first-child {
  display: contents;
}

.brand-actions,
.invoice-header {
  display: grid;
  perspective: 900px;
}

.brand-actions {
  grid-column: 3;
  align-self: center;
  justify-items: end;
  gap: 8px;
}

.brand-logo {
  display: block;
  width: min(225px, 48vw);
  max-height: 78px;
  object-fit: contain;
  animation: yatco-spin 4s linear infinite;
  backface-visibility: visible;
  filter: drop-shadow(0 7px 10px rgba(11, 47, 95, 0.2));
  transform-style: preserve-3d;
  transform-origin: center;
  will-change: transform;
}

@keyframes yatco-spin {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(360deg);
  }
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3.2vw, 2.8rem);
  line-height: 1;
}

.title-lockup {
  display: contents;
  align-items: center;
  gap: 14px;
}

.app-header .eyebrow {
  grid-column: 1;
  justify-self: start;
  align-self: start;
}

.app-header h1 {
  grid-column: 2;
  justify-self: center;
  text-align: center;
}

.app-header .program-logo {
  grid-column: 1;
  justify-self: center;
}

.program-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 50px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.program-logo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}

.program-chesters {
  min-width: 300px;
  width: 360px;
  height: 122px;
  border: 0;
}

.program-krispy {
  min-width: 180px;
  width: 210px;
  height: 70px;
  border-color: #f1d0d0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.3rem;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(12px, 4vw, 36px) 44px;
}

.header-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sales-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.range-tabs {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.range-tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.range-tab.active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 1px 4px rgba(11, 47, 95, 0.14);
}

.custom-range {
  display: flex;
  gap: 10px;
}

.custom-range label {
  min-width: 150px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr);
  gap: 16px;
  align-items: start;
}

.ledger-side {
  min-width: 0;
}

.analytics-panel {
  min-height: 560px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.analytics-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.analytics-tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.analytics-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.analytics-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.analytics-header {
  display: grid;
  gap: 3px;
  margin-bottom: 14px;
}

.analytics-header strong {
  font-size: clamp(1.6rem, 3vw, 2.35rem);
}

.analytics-header span {
  color: var(--muted);
  font-weight: 700;
}

.sales-volume-chart {
  display: grid;
  gap: 9px;
}

.sales-volume-row {
  display: grid;
  grid-template-columns: minmax(74px, 96px) 1fr minmax(82px, auto);
  gap: 9px;
  align-items: center;
  font-size: 0.86rem;
}

.sales-volume-label {
  color: var(--muted);
  font-weight: 700;
}

.sales-volume-track {
  height: 12px;
  overflow: hidden;
  background: var(--accent-soft);
  border-radius: 8px;
}

.sales-volume-bar {
  display: block;
  height: 100%;
  min-width: 2px;
  background: var(--accent);
}

.sales-volume-value {
  text-align: right;
  font-weight: 700;
}

.purchase-calendar {
  display: grid;
  gap: 14px;
}

.purchase-calendar-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.purchase-calendar-nav button {
  min-height: 34px;
  min-width: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-strong);
  font-weight: 900;
}

.purchase-months {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.purchase-month {
  display: grid;
  gap: 8px;
}

.purchase-month h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-transform: uppercase;
}

.purchase-weekdays,
.purchase-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.purchase-weekdays span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.purchase-day {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 54px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.purchase-day.empty {
  border-color: transparent;
  background: transparent;
}

.purchase-day:disabled {
  cursor: default;
  color: var(--muted);
}

.purchase-day.has-purchase {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.purchase-day.sample-low,
.legend-chip.sample-low {
  border-color: #e5a3a3;
  background: #ffe8e8;
  color: #8f1d1d;
}

.purchase-day.sample-mid,
.legend-chip.sample-mid {
  border-color: #e5d28a;
  background: #fff6c9;
  color: #6f5700;
}

.purchase-day.sample-good,
.legend-chip.sample-good {
  border-color: #99d1aa;
  background: #e4f7e9;
  color: #1f6b38;
}

.purchase-day span {
  font-size: 0.72rem;
  font-weight: 800;
}

.purchase-day strong {
  font-size: 0.74rem;
  line-height: 1.1;
  word-break: break-word;
}

.sample-calendar-legend {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.sample-calendar-legend p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 0;
}

.legend-chip {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid;
  border-radius: 4px;
}

.vertical-sales-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(23px, 0.5fr));
  justify-content: center;
  gap: 10px;
  align-items: end;
  min-height: 230px;
  padding-top: 8px;
}

.vertical-sales-bar {
  display: grid;
  grid-template-rows: auto 160px auto;
  gap: 7px;
  align-items: end;
  min-width: 0;
  max-width: 56px;
}

.vertical-sales-bar[data-sales-day] {
  cursor: zoom-in;
}

.vertical-sales-track[data-sales-day],
.vertical-sales-fill[data-sales-day] {
  cursor: zoom-in;
}

.vertical-sales-bar[data-sales-day]:hover .vertical-sales-track,
.vertical-sales-bar[data-sales-day]:focus-within .vertical-sales-track {
  outline: 3px solid rgba(217, 164, 65, 0.42);
  outline-offset: 3px;
}

.vertical-sales-value,
.vertical-sales-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.vertical-sales-track {
  position: relative;
  display: grid;
  align-items: end;
  height: 160px;
  border-radius: 8px;
  background: var(--accent-soft);
  overflow: hidden;
}

.vertical-sales-fill {
  display: block;
  min-height: 2px;
  background: var(--accent);
}

.executive-functions-button {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 20;
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  filter: drop-shadow(0 7px 8px rgba(11, 47, 95, 0.22));
}

.executive-functions-button img {
  display: block;
  max-width: 100%;
  max-height: 24px;
  object-fit: contain;
}

.executive-functions-button:hover,
.executive-functions-button:focus-visible {
  transform: translateY(-1px);
}

.invoice-exec-logo-button {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 24;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 7px 8px rgba(11, 47, 95, 0.24));
}

.invoice-exec-logo-button img {
  display: block;
  height: 22px;
  width: auto;
}

.invoice-exec-logo-button.active {
  outline: 2px solid #f2b84b;
  outline-offset: 3px;
}

.invoice-item-edit-input {
  width: 100%;
  min-width: 90px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: #fff9d8;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 0.35rem 0.45rem;
}

.invoice-exec-edit-row td:first-child,
.invoice-exec-edit-row td:nth-child(2) {
  background: #fff7ca;
}

.production-timeline-shell {
  position: relative;
  display: grid;
  gap: 18px;
  padding-bottom: 48px;
}

.analytics-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.production-timeline-date {
  width: min(260px, 100%);
}

.production-timeline-body {
  display: grid;
  gap: 12px;
  max-height: min(72vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.production-timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.production-timeline-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.timeline-swatch {
  display: inline-block;
  width: 28px;
  height: 12px;
  border-radius: 999px;
}

.timeline-produced {
  background: #2f7de1;
}

.timeline-writeoff {
  background: #f48ab8;
}

.timeline-sampled {
  background: #24b35f;
}

.production-timeline-axis {
  display: grid;
  gap: 0;
  padding-left: 226px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.production-timeline-axis span {
  border-left: 1px solid var(--line);
  padding-left: 5px;
}

.production-timeline-row {
  display: grid;
  grid-template-columns: 210px minmax(360px, 1fr);
  gap: 16px;
  align-items: center;
}

.production-timeline-label {
  display: grid;
  gap: 3px;
}

.production-timeline-label strong {
  font-size: 0.98rem;
}

.production-timeline-label span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.production-timeline-track {
  position: relative;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      to right,
      rgba(98, 113, 122, 0.12) 0,
      rgba(98, 113, 122, 0.12) 1px,
      transparent 1px,
      transparent calc(100% / 10)
    ),
    #f9fbfd;
  overflow: hidden;
}

.production-timeline-bar {
  position: absolute;
  top: 9px;
  display: grid;
  place-items: center;
  height: 18px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.production-timeline-produced {
  background: linear-gradient(180deg, #4f9cff, #1e66c5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.production-timeline-writeoff {
  top: 13px;
  height: 14px;
  background: linear-gradient(180deg, #ffb4d1, #ee6aa4);
  box-shadow: 0 0 0 1px rgba(160, 31, 92, 0.18);
}

.production-timeline-sample-bubble {
  position: absolute;
  top: 4px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #24b35f;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(21, 107, 56, 0.28);
}

.timeline-override-active .production-timeline-bar,
.timeline-override-active .production-timeline-sample-bubble {
  cursor: text;
  outline: 2px solid rgba(217, 164, 65, 0.72);
  outline-offset: 2px;
}

.timeline-executive-button {
  position: absolute;
  right: 16px;
  bottom: 12px;
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  filter: drop-shadow(0 7px 8px rgba(11, 47, 95, 0.22));
}

.timeline-executive-button img {
  display: block;
  max-width: 100%;
  max-height: 24px;
  object-fit: contain;
}

.timeline-override-active .timeline-executive-button {
  border: 2px solid var(--gold);
  background: rgba(217, 164, 65, 0.12);
}

.production-timeline-empty {
  border: 1px dashed var(--accent-line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.action-button,
.compact-button,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
}

.action-button svg,
.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.action-button.primary,
.compact-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.action-button.primary:hover,
.compact-button:hover {
  background: var(--accent-strong);
}

.action-button.ghost {
  color: var(--accent-strong);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.summary-strip article {
  min-height: 66px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-strip span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.summary-strip strong {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.ledger-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.ledger-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.ledger-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.ledger-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 8px;
}

.compact-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 10px;
  font-size: 0.88rem;
}

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbfcfc;
}

th:first-child,
td:first-child {
  text-align: left;
  font-weight: 700;
}

td input {
  width: 82px;
  max-width: 100%;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: right;
}

.ledger-shell .table-wrap {
  overflow-x: hidden;
}

.ledger-table {
  min-width: 0;
  table-layout: fixed;
  font-size: 0.66rem;
}

.ledger-table th,
.ledger-table td {
  padding: 2px 3px;
  line-height: 1.15;
}

.ledger-table th {
  font-size: 0.58rem;
  white-space: normal;
}

.ledger-table td:first-child,
.ledger-table th:first-child {
  width: 12%;
}

.ledger-table input {
  width: 100%;
  min-width: 0;
  padding: 2px 3px;
  font-size: 0.66rem;
}

.ledger-table input:disabled {
  color: var(--ink);
  font-weight: 700;
  opacity: 1;
}

.ledger-table input:not(:disabled) {
  font-weight: 400;
}

td input:focus {
  outline: 2px solid rgba(23, 74, 139, 0.24);
  border-color: var(--accent);
  background: #fff;
}

.readonly-money {
  font-weight: 700;
}

.modal {
  width: min(440px, calc(100% - 24px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.audit-modal {
  width: min(1080px, calc(100% - 24px));
}

.production-audit-dialog {
  width: min(1120px, 96vw);
  height: min(840px, 94vh);
  max-width: 96vw;
  max-height: 94vh;
  overflow: hidden;
}

.production-audit-dialog iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #eef5ff;
}

.menu-count-modal {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
}

.modal.menu-count-modal form {
  position: relative;
  min-height: 100vh;
  height: 100vh;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  padding: 12px 16px;
  overflow: hidden;
}

#menuCountTitle {
  font-size: clamp(2.4rem, 4vw, 4.4rem);
  line-height: 0.95;
}

.menu-count-modal .modal-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
}

.menu-count-modal .modal-header > div:first-child {
  grid-column: 2;
  text-align: center;
}

.menu-count-modal .menu-count-header-actions {
  grid-column: 3;
  justify-self: end;
}

.invoice-detail-modal {
  width: min(820px, calc(100% - 24px));
}

.production-timeline-modal {
  width: min(1180px, calc(100vw - 34px));
}

.price-history-modal {
  width: min(620px, calc(100% - 24px));
}

.invoice-detail-shell {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.production-timeline-shell {
  padding: 20px;
}

.price-history-shell {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.price-history-body {
  display: grid;
  gap: 6px;
}

.price-history-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(100px, 1fr) minmax(68px, auto) minmax(82px, auto) minmax(92px, auto);
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.price-history-row span {
  color: var(--muted);
}

.price-history-row strong {
  text-align: right;
}

.invoice-detail-body {
  display: grid;
  gap: 12px;
  max-height: min(68vh, 680px);
  overflow: auto;
}

.invoice-detail-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.invoice-detail-card header,
.invoice-detail-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.invoice-detail-line {
  grid-template-columns: 82px 1fr minmax(120px, auto) minmax(88px, auto);
  color: var(--muted);
  font-size: 0.82rem;
}

.invoice-detail-line strong,
.invoice-detail-card header span {
  color: var(--ink);
  text-align: right;
}

.invoice-detail-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.password-modal {
  width: min(360px, calc(100% - 24px));
}

.password-modal form {
  justify-items: center;
  padding: 22px;
  text-align: center;
}

.password-logo {
  width: 170px;
  max-width: 80%;
}

.password-message {
  min-height: 1.1em;
  margin-bottom: 0;
  color: var(--red);
  font-weight: 700;
}

.modal::backdrop {
  background: rgba(23, 32, 38, 0.42);
}

.modal form,
.invoice-form {
  display: grid;
  gap: 16px;
}

.modal form {
  padding: 20px;
}

.modal-header,
.invoice-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  padding: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.no-spinner {
  appearance: textfield;
}

.placeholder-copy {
  margin-bottom: 0;
  color: var(--muted);
}

.invoice-page {
  background: #eef5ff;
}

.production-page {
  background: #eef5ff;
}

.production-header {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 6px clamp(10px, 2vw, 22px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.production-brand {
  display: contents;
  align-items: center;
  gap: 18px;
}

.production-brand .program-logo {
  grid-column: 1;
  justify-self: center;
}

.production-brand > div {
  grid-column: 2;
  justify-self: center;
  text-align: center;
}

.production-main {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 190px);
}

.production-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(210px, 1fr));
  gap: 18px;
  width: min(680px, 100%);
}

.production-page .program-chesters {
  width: 360px;
  height: 122px;
}

.production-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  min-height: 210px;
  padding: 24px 16px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 10px 26px rgba(11, 47, 95, 0.08);
}

.production-card:hover,
.production-card:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.production-card strong {
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.15;
  text-align: center;
}

.tracker-access-modal {
  width: min(390px, calc(100% - 24px));
}

.tracker-access-modal form {
  padding: 22px;
}

.tracker-access-display {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0;
}

.tracker-access-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(23, 74, 139, 0.16);
}

.tracker-access-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(68px, 1fr));
  gap: 8px;
}

.tracker-access-keypad button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 1.2rem;
  font-weight: 900;
}

.tracker-access-keypad button:hover,
.tracker-access-keypad button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.production-icon {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}

.production-icon svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.numeric-keypad {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 10000;
  pointer-events: none;
}

.numeric-keypad-panel {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.numeric-keypad button {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 900;
}

.numeric-keypad button:hover,
.numeric-keypad button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.numeric-keypad-wide {
  grid-column: span 2;
  background: var(--accent) !important;
  color: #fff !important;
}

.numeric-keypad-close {
  grid-column: 1 / -1;
}

.invoice-window {
  width: min(1180px, 100%);
}

.invoice-header {
  margin-bottom: 18px;
}

.invoice-top-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(320px, 520px);
  gap: 12px;
  align-items: end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.invoice-fields {
  grid-template-columns: minmax(150px, 1fr) minmax(160px, 1fr) minmax(220px, 1.35fr) minmax(190px, 1fr);
}

.contact-panel {
  min-height: 66px;
  padding: 10px 12px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-panel span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.contact-panel strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.mode-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mode-toolbar > span {
  color: var(--muted);
  font-weight: 700;
}

.compact-tabs .range-tab {
  min-width: 86px;
}

.manual-row {
  display: grid;
  grid-template-columns: minmax(180px, 280px) auto;
  gap: 10px;
  align-items: end;
}

.invoice-lines-toolbar {
  display: flex;
  justify-content: flex-end;
}

.invoice-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invoice-table {
  min-width: 1080px;
}

.invoice-table td,
.invoice-table th {
  text-align: left;
}

.invoice-table td:nth-child(n+3),
.invoice-table th:nth-child(n+3) {
  text-align: right;
}

.invoice-table td:last-child,
.invoice-table th:last-child {
  text-align: center;
}

.invoice-table input {
  padding: 5px 6px;
}

.invoice-table .invoice-check-cell,
.invoice-table th:nth-child(8),
.invoice-table th:nth-child(9) {
  text-align: center;
}

.invoice-check-cell input[type="checkbox"] {
  width: 22px;
  height: 22px;
  padding: 0;
  accent-color: var(--accent);
}

.invoice-move-cell {
  min-width: 78px;
  white-space: nowrap;
}

.invoice-move-button {
  width: 30px;
  height: 30px;
  margin: 0 2px;
  border: 1px solid #c9d6df;
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.invoice-move-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.cost-up {
  color: var(--red);
  font-weight: 700;
}

.cost-down {
  color: var(--accent-strong);
  font-weight: 700;
}

.validation-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 160px)) minmax(220px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.top-validation {
  min-height: 66px;
  padding: 10px 12px;
}

.validation-panel span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.validation-panel strong {
  font-size: 1.05rem;
}

.validation-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.validation-panel.valid {
  border-color: rgba(23, 74, 139, 0.45);
  background: var(--accent-soft);
}

.validation-panel.invalid {
  border-color: rgba(185, 74, 72, 0.45);
  background: #fff5f4;
}

.saved-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.defaults-window {
  width: min(980px, 100%);
}

.item-editor-window {
  width: min(1220px, 100%);
}

.summary-top-button {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 45;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
}

.program-setup {
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) minmax(200px, 1fr) minmax(280px, 1.2fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.program-setup h2 {
  margin-bottom: 0;
}

.sample-target-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 320px) 1fr;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sample-target-panel h2 {
  margin-bottom: 0;
}

.shelf-life-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.shelf-life-panel .section-title-row {
  align-items: end;
}

.shelf-life-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.shelf-life-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.shelf-life-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.shelf-life-group h3 {
  margin: 0;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--ink);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.shelf-life-items {
  display: grid;
  gap: 6px;
}

.shelf-life-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px auto;
  gap: 8px;
  align-items: center;
}

.shelf-life-row span {
  color: var(--ink);
  font-weight: 800;
}

.shelf-life-row input {
  min-height: 34px;
  padding: 4px 6px;
  text-align: right;
}

.shelf-life-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.vendor-info-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.add-vendor-button {
  color: var(--accent-strong);
  font-size: 1.5rem;
  line-height: 1;
}

.vendor-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.program-preview {
  width: 360px;
  height: 150px;
  min-height: 54px;
}

.program-preview.program-chesters {
  width: 100%;
  max-width: 720px;
  height: 92px;
}

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

.defaults-item-panel .defaults-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) repeat(6, minmax(0, 1fr));
}

.checkbox-field {
  align-content: end;
  grid-template-columns: auto 1fr;
  gap: 9px;
}

.checkbox-field input {
  width: auto;
  margin: 0;
}

.defaults-item-panel {
  padding-top: 4px;
}

.defaults-item-panel h2 {
  margin-bottom: 10px;
}

.vendor-items-panel {
  margin-top: 18px;
}

.vendor-items-table tbody tr {
  cursor: pointer;
}

.vendor-items-table tbody tr:hover {
  background: var(--accent-soft);
}

.pricing-section {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.pricing-section h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--ink);
  font-size: clamp(1.4rem, 3vw, 2.05rem);
  font-weight: 500;
}

.pricing-section h2 span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.margin-summary-section {
  margin-bottom: 34px;
  max-width: 1088px;
}

.margin-summary-layout {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 12px;
  align-items: start;
  justify-content: start;
  max-width: 100%;
  overflow: hidden;
}

.margin-summary-table-wrap {
  overflow-x: visible;
}

.margin-summary-table,
.margin-category-table {
  border-collapse: collapse;
  background: #fff;
  color: #000;
  font-size: 0.68rem;
}

.margin-summary-table {
  width: 600px;
  min-width: 0;
  table-layout: fixed;
}

.margin-category-table {
  width: 260px;
  min-width: 0;
  table-layout: fixed;
}

.margin-summary-table th,
.margin-summary-table td,
.margin-category-table th,
.margin-category-table td {
  border: 1px solid #000;
  padding: 2px 4px;
  text-align: right;
  vertical-align: middle;
}

.margin-summary-table th,
.margin-category-table th {
  font-size: 0.56rem;
  font-weight: 800;
  text-align: center;
}

.margin-summary-table th:nth-child(1),
.margin-summary-table td:nth-child(1) {
  width: 34px;
  text-align: center;
}

.margin-summary-table th:nth-child(2),
.margin-summary-table td:nth-child(2) {
  width: 34px;
  text-align: center;
}

.margin-summary-table th:nth-child(3),
.margin-summary-table td:nth-child(3) {
  width: 152px;
  min-width: 0;
}

.margin-summary-table th:nth-child(4),
.margin-summary-table td:nth-child(4),
.margin-summary-table th:nth-child(5),
.margin-summary-table td:nth-child(5) {
  width: 86px;
}

.margin-summary-table th:nth-child(6),
.margin-summary-table td:nth-child(6) {
  width: 82px;
}

.margin-summary-table th:nth-child(3),
.margin-summary-table td:nth-child(3),
.margin-category-table th:first-child,
.margin-category-table td:first-child {
  text-align: left !important;
}

.margin-summary-description {
  text-align: left !important;
}

.margin-summary-number,
.margin-summary-price,
.margin-summary-profit {
  text-align: center !important;
}

.margin-group-label {
  padding: 0 !important;
  color: #000;
  font-size: 0.56rem;
  font-weight: 800;
  text-align: center !important;
  vertical-align: middle !important;
}

.margin-group-label span {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-transform: uppercase;
  white-space: nowrap;
}

.margin-group-label[data-summary-category="Combos"] {
  background: #ffd22e;
}

.margin-group-label[data-summary-category="Chicken Only"] {
  background: #ff6b6b;
}

.margin-group-label[data-summary-category="Sides"] {
  background: #7bed67;
}

.margin-group-label[data-summary-category="Add Ons"] {
  background: #ff9bd2;
}

.margin-group-label[data-summary-category="Sandwich"] {
  background: #ffef5a;
}

.margin-group-label[data-summary-category="Big Meals"] {
  background: #55d0f2;
}

.margin-group-label[data-summary-category="Fuel Up Menu"] {
  background: #bf86f2;
}

.summary-link {
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-height: 18px;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: #fff;
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 800;
}

.margin-summary-input {
  width: 100%;
  min-height: 18px;
  padding: 0 2px;
  border: 1px solid transparent;
  border-radius: 0;
  background: #fff;
  color: #000;
  text-align: center;
}

.margin-summary-input:disabled {
  color: #000;
  opacity: 1;
}

.pricing-table td:first-child,
.pricing-table:not(.raw-pricing-table):not(.cooked-pricing-table):not(.food-cost-table) td:nth-child(2),
.builder-table td:first-child,
.food-cost-table td:first-child {
  text-align: left;
}

.pricing-input[type="number"],
.builder-input[data-builder-kind="numeric"],
.number-only-cell,
.builder-table td:nth-child(2),
.builder-table td:nth-child(3) {
  text-align: center !important;
}

.pricing-checkbox {
  width: 18px;
  height: 18px;
  margin: 0 auto;
  accent-color: var(--blue);
}

.margin-category-panel {
  display: grid;
  gap: 12px;
  width: 260px;
  min-width: 0;
}

.margin-summary-table td.margin-summary-description {
  text-align: left !important;
}

.margin-category-table tr[data-summary-category="Combos"] td:first-child {
  background: #ffd22e;
}

.margin-category-table tr[data-summary-category="Chicken Only"] td:first-child {
  background: #ff6b6b;
}

.margin-category-table tr[data-summary-category="Sides"] td:first-child {
  background: #7bed67;
}

.margin-category-table tr[data-summary-category="Add Ons"] td:first-child {
  background: #ff9bd2;
}

.margin-category-table tr[data-summary-category="Sandwich"] td:first-child {
  background: #ffef5a;
}

.margin-category-table tr[data-summary-category="Big Meals"] td:first-child {
  background: #55d0f2;
}

.margin-category-table tr[data-summary-category="Fuel Up Menu"] td:first-child {
  background: #bf86f2;
}

.margin-category-table th:first-child,
.margin-category-table td:first-child {
  width: 145px;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.margin-category-table th:nth-child(2),
.margin-category-table td:nth-child(2) {
  width: 115px;
  text-align: center;
}

.theoretical-margin {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  width: 260px;
  padding: 6px 8px;
  background: #d7f4dd;
  color: #147226;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.builder-jump-highlight {
  animation: builder-jump-flash 1.4s ease-out;
}

@keyframes builder-jump-flash {
  0% {
    box-shadow: 0 0 0 5px rgba(255, 188, 66, 0.85);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 188, 66, 0);
  }
}

.pricing-table-wrap {
  overflow-x: auto;
  border: 2px solid var(--ink);
  background: #fff;
}

.pricing-section-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.pricing-table {
  min-width: 760px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.cooked-pricing-table {
  min-width: 0;
  font-size: 0.76rem;
}

.pricing-table th {
  padding: 7px 8px;
  border-right: 2px solid var(--ink);
  background: #4776c1;
  color: #fff;
  font-size: 0.8rem;
  text-align: center;
  text-transform: none;
}

.cooked-pricing-table th {
  padding: 6px 4px;
  font-size: 0.72rem;
}

.pricing-table th:last-child,
.pricing-table td:last-child {
  border-right: 0;
}

.pricing-table td {
  padding: 1px 6px;
  border-right: 2px solid var(--ink);
  border-bottom: 1px solid #8fb0e8;
  line-height: 1.1;
  text-align: center;
}

.cooked-pricing-table td {
  padding: 1px 4px;
}

.cooked-pricing-table th:nth-child(1),
.cooked-pricing-table td:nth-child(1) {
  width: 11%;
}

.cooked-pricing-table th:nth-child(2),
.cooked-pricing-table td:nth-child(2) {
  width: 5%;
}

.cooked-pricing-table th:nth-child(3),
.cooked-pricing-table td:nth-child(3),
.cooked-pricing-table th:nth-child(5),
.cooked-pricing-table td:nth-child(5),
.cooked-pricing-table th:nth-child(6),
.cooked-pricing-table td:nth-child(6) {
  width: 8%;
}

.cooked-pricing-table th:nth-child(4),
.cooked-pricing-table td:nth-child(4) {
  width: 10%;
}

.cooked-pricing-table th:nth-child(n+7),
.cooked-pricing-table td:nth-child(n+7) {
  width: 7%;
}

.pricing-table tbody tr:nth-child(odd) {
  background: #dce6f7;
}

.pricing-table tbody tr:nth-child(even) {
  background: #f7fbff;
}

.pricing-table tbody tr.highlight-row {
  background: #fff500;
}

.pricing-table td:nth-child(3),
.raw-pricing-table td:nth-child(2) {
  text-align: left;
}

.cooked-pricing-table td:nth-child(1) {
  text-align: left;
}

.cooked-pricing-table th:nth-child(6),
.cooked-pricing-table td.final-cost-cell {
  border-left: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
}

.pricing-table td:nth-child(5),
.pricing-table td:nth-child(6),
.raw-pricing-table td:nth-child(4),
.raw-pricing-table td:nth-child(5),
.raw-pricing-table td:nth-child(6) {
  text-align: right;
}

.number-only-cell {
  text-align: center !important;
}

.pricing-input {
  width: 100%;
  min-height: 0;
  padding: 0 3px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  line-height: 1.1;
}

.cooked-pricing-table .pricing-input {
  padding: 0 2px;
}

.food-cost-section {
  width: min(560px, 100%);
}

.food-cost-table-wrap {
  border: 2px solid var(--ink);
  background: #fff;
}

.food-cost-table {
  min-width: 0;
  font-size: 0.92rem;
}

.food-cost-table th {
  background: #f47b20;
}

.food-cost-table th:nth-child(1),
.food-cost-table td:nth-child(1) {
  width: 56%;
  text-align: center;
}

.food-cost-table th:nth-child(2),
.food-cost-table td:nth-child(2) {
  width: 22%;
}

.food-cost-table th:nth-child(3),
.food-cost-table td:nth-child(3) {
  width: 22%;
}

.food-cost-table td {
  border-bottom-color: #d2d2d2;
}

.food-cost-table tbody tr:nth-child(odd) {
  background: #d9d9d9;
}

.food-cost-table tbody tr:nth-child(even) {
  background: #fff;
}

.item-builder-section {
  width: 100%;
}

.item-builder-section .section-title-row {
  align-items: end;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 10px;
}

.item-builder-section .section-title-row h2 {
  border-bottom: 0;
  padding-bottom: 0;
}

.item-builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 44px;
  align-items: start;
}

.item-builder-group {
  display: grid;
  gap: 16px;
}

.item-builder-group[data-builder-category="Combos"],
.item-builder-group[data-builder-category="Sides"],
.item-builder-group[data-builder-category="Add Ons"],
.item-builder-group[data-builder-category="Big Meals"],
.item-builder-group[data-builder-category="Fuel Up Menu"] {
  grid-column: 1;
}

.item-builder-group[data-builder-category="Chicken Only"],
.item-builder-group[data-builder-category="Sandwich"] {
  grid-column: 2;
}

.item-builder-group-title {
  margin: 0;
  padding-bottom: 5px;
  border-bottom: 3px solid var(--ink);
  color: var(--ink);
  font-size: clamp(1.3rem, 2.5vw, 2rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
}

.item-builder-group-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.item-builder-card {
  display: grid;
  gap: 4px;
  background: transparent;
}

.item-builder-card.builder-has-issue {
  outline: 3px solid #ffb56b;
  outline-offset: 3px;
}

.builder-name-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
}

.builder-summary-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  min-height: 22px;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: #fff;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
}

.builder-name-row .builder-input {
  border: 1px solid #000;
  border-radius: 0;
  padding: 1px 3px;
  background: #fff;
  font-size: 0.74rem;
}

.builder-delete {
  width: 28px;
  min-height: 24px;
  margin-left: 6px;
  border-radius: 0;
  font-size: 0.78rem;
}

.builder-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 4px;
  align-items: start;
}

.builder-table {
  min-width: 0;
  table-layout: fixed;
  border: 1px solid #000;
  background: #fff;
  font-size: 0.66rem;
}

.builder-table th,
.builder-table td {
  padding: 1px 2px;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  color: var(--ink);
  text-align: right;
  text-transform: none;
}

.builder-table th {
  background: #fff;
  font-size: 0.62rem;
  font-weight: 400;
}

.builder-table th:first-child,
.builder-table td:first-child {
  width: 58%;
  text-align: left;
  font-weight: 400;
}

.builder-table th:nth-child(2),
.builder-table td:nth-child(2) {
  width: 8%;
}

.builder-table th:nth-child(3),
.builder-table td:nth-child(3) {
  width: 9%;
}

.builder-table th:nth-child(4),
.builder-table td:nth-child(4),
.builder-table th:nth-child(5),
.builder-table td:nth-child(5) {
  width: 12.5%;
}

.builder-table th:nth-child(6),
.builder-table td:nth-child(6) {
  width: 6%;
  text-align: center;
}

.builder-line-issue td {
  background: #ffe0b8 !important;
}

.builder-input {
  width: 100%;
  min-height: 0;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0 2px;
  background: transparent;
  color: var(--ink);
  font-size: inherit;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.builder-table .builder-input {
  text-align: right;
}

.builder-table select.builder-input {
  text-align: left;
}

.builder-summary {
  display: grid;
  grid-template-columns: max-content 58px;
  gap: 1px 3px;
  align-items: center;
  justify-content: end;
  justify-self: end;
  width: max-content;
  font-size: 0.66rem;
}

.builder-summary span {
  text-align: right;
}

.builder-summary div {
  min-height: 1em;
  text-align: right;
}

.builder-summary .builder-input {
  width: 58px;
  padding-right: 0;
  text-align: right !important;
}

.builder-add-line {
  justify-self: start;
  min-height: 26px;
  padding: 0 7px;
  font-size: 0.72rem;
}

.builder-line-delete {
  display: inline-grid;
  place-items: center;
  width: 16px;
  min-height: 16px;
  padding: 0;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
}

.builder-line-delete-cell {
  text-align: center !important;
}

.dev-logo-button {
  display: inline-grid;
  place-items: center;
  height: 18.75px;
  width: 37.5px;
  margin: 18px 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.dev-logo-button img {
  display: block;
  height: 18.75px;
  width: auto;
}

.formula-dev-window {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 30;
  width: min(360px, calc(100vw - 24px));
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fffef0;
  box-shadow: var(--shadow);
  color: var(--ink);
}

.formula-dev-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ink);
  background: #fff2a8;
}

.formula-dev-header button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  min-height: 26px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
}

.formula-dev-body {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  font-size: 0.84rem;
  line-height: 1.35;
}

.formula-dev-body p {
  margin-bottom: 0;
}

.pricing-dev-active [data-dev-calc="true"] {
  background: #fff8a8 !important;
}

.pricing-dev-active .dev-trace-selected,
.pricing-dev-active .dev-trace-connected {
  background: #ffd9a6 !important;
}

.pricing-dev-active .dev-trace-selected {
  outline: 3px solid #f28c28;
  outline-offset: -3px;
}

.pricing-dev-active .pricing-input {
  border: 3px solid #000;
  background: #fff;
}

.pricing-dev-active .builder-input {
  border: 3px solid #000;
  background: #fff;
}

.pricing-dev-active .margin-summary-input {
  border: 3px solid #000;
  background: #fff;
}

.pricing-dev-active td:has(.pricing-input),
.pricing-dev-active td:has(.builder-input),
.pricing-dev-active td:has(.margin-summary-input) {
  box-shadow: inset 0 0 0 3px #000;
}

.pricing-input:focus {
  border-color: var(--accent);
  background: #fff;
  outline: 2px solid rgba(23, 74, 139, 0.2);
}

.pricing-dev-active .pricing-input:focus {
  border-color: #000;
}

.builder-input:focus {
  border-color: var(--accent);
  background: #fff;
  outline: 2px solid rgba(23, 74, 139, 0.2);
}

.pricing-dev-active .builder-input:focus {
  border-color: #000;
}

.margin-summary-input:focus {
  border-color: var(--accent);
  background: #fff;
  outline: 2px solid rgba(23, 74, 139, 0.2);
}

.pricing-dev-active .margin-summary-input:focus {
  border-color: #000;
}

@media (prefers-reduced-motion: reduce) {
  .brand-logo {
    animation: none;
  }
}

.audit-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(150px, 1fr);
  gap: 12px;
  align-items: end;
}

.audit-total {
  min-height: 66px;
  padding: 10px 12px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audit-total span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.audit-total strong {
  font-size: 1.1rem;
}

.menu-count-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 10px;
}

.menu-count-toolbar .audit-total {
  justify-self: center;
  min-width: 210px;
  padding: 14px 22px;
  text-align: center;
}

.menu-count-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-count-datetime span,
.audit-total span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.menu-count-datetime strong,
.audit-total strong {
  font-size: 1.12rem;
}

.menu-count-toolbar .audit-total strong {
  font-size: 1.65rem;
}

.menu-count-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  gap: 10px;
  min-height: 0;
}

.menu-count-groups {
  display: grid;
  grid-template-columns: minmax(390px, 1.2fr) minmax(430px, 1.25fr) minmax(190px, 0.62fr);
  grid-template-areas:
    "chicken sides sandwich"
    "chicken sides addons";
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  min-height: 0;
}

.menu-count-group {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.menu-count-group h3,
.menu-count-selected h3 {
  margin: 0;
  padding: 5px 7px;
  border-bottom: 2px solid var(--ink);
  border-radius: 5px 5px 0 0;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.menu-count-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
}

.menu-count-group-chicken-only .menu-count-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.menu-count-group-add-ons .menu-count-buttons,
.menu-count-group-sandwich .menu-count-buttons {
  display: flex;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 6px;
}

.menu-count-button {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  align-content: center;
  align-items: center;
  min-height: 58px;
  padding: 7px 8px;
  border: 1px solid #c9d4dc;
  border-bottom-width: 4px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 62%, #eaf1f6 100%);
  box-shadow: 0 5px 0 rgba(23, 32, 38, 0.12), 0 8px 16px rgba(23, 32, 38, 0.08);
  color: var(--ink);
  text-align: left;
}

.menu-count-button:hover,
.menu-count-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 4px 0 rgba(23, 74, 139, 0.2), 0 0 0 3px rgba(23, 74, 139, 0.12);
  transform: translateY(1px);
}

.menu-count-dev-active .menu-count-button {
  cursor: grab;
}

.menu-count-button span {
  min-width: 0;
  overflow: visible;
  white-space: normal;
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.1;
}

.menu-count-button strong {
  color: var(--accent-strong);
  font-size: 0.66rem;
  line-height: 1;
}

.menu-count-button em {
  position: absolute;
  top: -6px;
  right: -5px;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-style: normal;
  font-weight: 900;
}

.menu-count-hidden-item {
  opacity: 0.42;
  filter: grayscale(0.8);
}

.menu-count-dragging {
  opacity: 0.58;
  outline: 3px dashed var(--accent);
}

.menu-count-visibility-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 1;
  padding: 2px 5px;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 0.56rem !important;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.menu-dev-logo-button {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  display: inline-grid;
  place-items: center;
  width: 37.5px;
  height: 18.75px;
  padding: 0;
  border: 0;
  background: transparent;
}

.menu-dev-logo-button img {
  display: block;
  height: 18.75px;
  width: auto;
}

.menu-count-dev-active .menu-dev-logo-button {
  filter: drop-shadow(0 0 5px rgba(23, 74, 139, 0.7));
}

.menu-count-group-chicken-only {
  grid-area: chicken;
  background: #fff1f1;
  border-color: #ff6868;
}

.menu-count-group-chicken-only h3 {
  background: #ff6868;
  color: #000;
}

.menu-count-subgroup {
  display: grid;
  gap: 5px;
}

.menu-count-subgroup h4 {
  margin: 0;
  padding: 3px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.menu-count-group-sides {
  grid-area: sides;
  background: #efffea;
  border-color: #7be565;
}

.menu-count-group-sides .menu-count-buttons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.menu-count-group-sides h3 {
  background: #7be565;
  color: #000;
}

.menu-count-group-add-ons {
  grid-area: addons;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fff0fa;
  border-color: #f08fd0;
}

.menu-count-group-add-ons h3 {
  background: #f08fd0;
  color: #000;
}

.menu-count-group-sandwich {
  grid-area: sandwich;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fff9d9;
  border-color: #f4de4f;
}

.menu-count-group-sandwich h3 {
  background: #f4de4f;
  color: #000;
}

.menu-count-selected {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: start;
  gap: 5px;
  min-height: 0;
  padding-top: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.menu-count-selected-list {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 3px;
  max-height: none;
  overflow: auto;
}

.menu-count-selected-list p {
  margin: 0;
  color: var(--muted);
}

.menu-count-selected-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  align-items: start;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
}

.menu-count-selected-row > span {
  font-weight: 800;
  line-height: 1.1;
}

.menu-count-selected-row small {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
}

.menu-count-selected-row > strong {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  white-space: nowrap;
}

.menu-count-selected-row .count-control {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
}

.menu-count-selected-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
}

.menu-count-selected-actions .action-button.ghost {
  justify-self: end;
}

.menu-count-selected-row .count-control {
  grid-template-columns: 26px 26px 56px;
  gap: 3px;
}

.menu-count-selected-row .count-control button {
  min-height: 26px;
  border-radius: 5px;
  font-size: 0.82rem;
}

.menu-count-selected-row .count-input {
  width: 56px;
  min-height: 26px;
  padding: 2px 4px;
}

.audit-table {
  min-width: 760px;
  table-layout: fixed;
}

.audit-table td,
.audit-table th {
  text-align: left;
}

.audit-table td:nth-child(1),
.audit-table th:nth-child(1) {
  width: 24%;
  text-align: left;
}

.audit-table td:nth-child(2),
.audit-table th:nth-child(2) {
  width: 15%;
  text-align: left;
}

.audit-table td:nth-child(3),
.audit-table th:nth-child(3) {
  width: 25%;
  text-align: left;
}

.audit-table td:nth-child(4),
.audit-table th:nth-child(4),
.audit-table td:nth-child(5),
.audit-table th:nth-child(5) {
  width: 14%;
  text-align: right;
}

.audit-table td:nth-child(6),
.audit-table th:nth-child(6) {
  width: 8%;
  text-align: center;
}

.audit-table input {
  width: 92px;
}

.count-control {
  display: inline-grid;
  grid-template-columns: 34px 34px minmax(82px, 104px);
  gap: 5px;
  align-items: center;
  justify-content: start;
}

.count-input {
  border-color: var(--line);
  background: #fff;
  text-align: right;
}

.count-control button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 900;
}

.drag-handle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  cursor: grab;
}

.drag-handle span {
  display: block;
}

.invoice-list {
  display: grid;
  gap: 10px;
}

.invoice-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invoice-item p {
  margin-bottom: 0;
  color: var(--muted);
}

.invoice-item strong {
  font-size: 1.05rem;
}

@media (max-width: 760px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    position: static;
  }

  .margin-summary-layout {
    grid-template-columns: 1fr;
  }

  .production-header,
  .production-brand {
    align-items: stretch;
    flex-direction: column;
  }

  .production-main {
    min-height: auto;
  }

  .production-actions {
    grid-template-columns: 1fr;
  }

  .production-card {
    min-height: 132px;
  }

  .numeric-keypad {
    right: 8px;
    bottom: 8px;
  }

  .numeric-keypad-panel {
    grid-template-columns: repeat(4, minmax(48px, 1fr));
    width: min(340px, calc(100vw - 16px));
  }

  .brand-actions {
    justify-items: stretch;
  }

  .brand-logo {
    justify-self: end;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .action-button {
    min-width: 0;
    padding: 0 10px;
  }

  .sales-filter,
  .mode-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .range-tabs {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .workspace-grid,
  .form-grid,
  .invoice-top-grid,
  .program-setup,
  .sample-target-panel,
  .shelf-life-grid,
  .vendor-form-grid,
  .purchase-months,
  .analytics-tabs,
  .audit-toolbar,
  .validation-panel,
  .item-builder-grid {
    grid-template-columns: 1fr;
  }

  .item-builder-group-grid {
    grid-template-columns: 1fr;
  }

  .builder-card-body {
    grid-template-columns: 1fr;
  }

  .title-lockup {
    align-items: flex-start;
    flex-direction: column;
  }

  .defaults-item-panel .defaults-grid {
    grid-template-columns: 1fr;
  }

  .audit-table-wrap {
    overflow-x: visible;
  }

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

  .audit-table thead {
    display: none;
  }

  .audit-table,
  .audit-table tbody,
  .audit-table tr,
  .audit-table td {
    display: block;
    width: 100%;
  }

  .audit-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .audit-table td {
    padding: 0;
    border-bottom: 0;
    text-align: left !important;
  }

  .audit-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .audit-table td[data-label="Count"] {
    grid-column: 1 / 2;
    grid-row: 1;
  }

  .audit-table td[data-label="Move"] {
    grid-column: 2 / 3;
    grid-row: 1;
    align-self: end;
  }

  .audit-table td[data-label="Description"],
  .audit-table td[data-label="Extended Cost"] {
    grid-column: 1 / -1;
  }

  .count-control {
    grid-template-columns: 38px 38px minmax(96px, 1fr);
    width: 100%;
  }

  .ledger-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-button {
    width: 100%;
  }

  .analytics-panel {
    min-height: 180px;
  }

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

  .invoice-detail-line span:nth-child(2),
  .invoice-detail-line strong {
    grid-column: 1 / -1;
  }
}

.embedded-production-modal .app-header,
.embedded-production-modal main,
.embedded-production-modal .dev-logo-button,
.embedded-production-modal .summary-top-button {
  display: none !important;
}

.embedded-production-modal {
  background: transparent;
}

.embedded-production-modal .modal.audit-modal {
  margin: auto;
}

@media (max-width: 520px) {
  main {
    padding-left: 10px;
    padding-right: 10px;
  }

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

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-strip article {
    min-height: 72px;
  }
}
