:root {
  --crust: #3e2a1e;
  --flour: #faf6ef;
  --gold: #c9932b;
  --card: #fffdf9;
  --rule: #e6dccd;
  --rule-strong: #d8c9b3;
  --tint: #f6f1e8;
  --muted: #6c5644;
  --field: #fffdfa;
  --gold-line: #d8ad55;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--flour);
  color: var(--crust);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: 96px;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--crust);
}

.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 96px;
}

.site-header {
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 96px;
}

.wordmark {
  font-size: 24px;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 22px;
  font-size: 14px;
  color: var(--crust);
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

.site-nav span {
  color: var(--muted);
}

.site-main {
  padding-top: 38px;
  padding-bottom: 48px;
}

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

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-head h1 {
  font-size: 40px;
  line-height: 1.05;
}

.page-head.compact h1 {
  font-size: 34px;
}

.lede {
  max-width: 660px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-width: 136px;
  padding: 0 22px;
  border-radius: 22px;
  background: var(--crust);
  color: var(--flour);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.pill.is-paused {
  background: var(--tint);
  color: var(--crust);
  border: 1px solid var(--rule-strong);
}

.pill.is-cancelled {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--rule-strong);
}

.pill.is-final {
  background: var(--gold);
  color: var(--crust);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 388px;
  grid-template-areas:
    "products next"
    "days manage"
    "actions manage"
    "gap cutoff";
  gap: 32px 96px;
  margin-top: 34px;
  align-items: start;
}

.products-card { grid-area: products; }
.next-card { grid-area: next; }
.days-card { grid-area: days; }
.manage-card { grid-area: manage; }
.main-actions { grid-area: actions; }
.cutoff-notice { grid-area: cutoff; }
.layout::after { content: ""; grid-area: gap; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 28px 32px;
}

.card h2 {
  font-size: 20px;
  line-height: 1.3;
  color: var(--crust);
}

.next-card {
  position: relative;
  padding-left: 30px;
  overflow: hidden;
}

.next-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gold);
}

.next-card h2 {
  font-size: 26px;
  margin: 4px 0 10px;
}

.next-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.next-card .closes {
  margin-top: 18px;
  color: var(--crust);
  font-weight: 700;
  font-size: 13px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.lines-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 132px;
  gap: 12px;
  margin-top: 22px;
  padding: 0 16px;
}

.lines-head span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.lines-head span:nth-child(2),
.lines-head span:nth-child(3) {
  text-align: right;
}

.lines {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 132px;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border-radius: 6px;
}

.line-row.tinted {
  background: var(--tint);
}

.line-name {
  font-size: 16px;
  color: var(--crust);
}

.line-qty {
  display: flex;
  justify-content: flex-end;
}

.qty-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 34px;
  background: var(--field);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  font-weight: 700;
  font-size: 15px;
  color: var(--crust);
}

.qty-input {
  width: 76px;
  height: 34px;
  padding: 0 8px;
  background: var(--field);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--crust);
  text-align: center;
}

.qty-input:focus,
.field-input:focus,
.field-select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.line-price {
  text-align: right;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.line-sum {
  font-size: 12px;
  color: var(--muted);
}

.line-price.snapshot {
  color: var(--crust);
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-top: 14px;
  padding: 18px 16px 0;
  border-top: 1px solid var(--rule);
}

.order-summary {
  flex: 1 1 320px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.order-summary strong {
  color: var(--crust);
}

.day-total {
  color: var(--crust);
  font-weight: 700;
  white-space: nowrap;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--crust);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.link-button:hover {
  color: var(--gold);
}

.add-product {
  margin: 16px 0 0;
  padding: 0 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.chip {
  min-width: 80px;
  height: 38px;
  padding: 0 20px;
  border-radius: 20px;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--crust);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--crust);
  border-color: var(--crust);
  color: var(--flour);
}

.chip:hover {
  border-color: var(--crust);
}

.start-date {
  margin-top: 24px;
}

.start-date .value {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--crust);
  margin-top: 2px;
}

.field-input {
  margin-top: 4px;
  height: 40px;
  padding: 0 12px;
  min-width: 220px;
  background: var(--field);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 15px;
  color: var(--crust);
}

.manage-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
}

.manage-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  cursor: pointer;
}

.manage-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.manage-item .title {
  font-size: 16px;
  color: var(--crust);
}

.manage-item .sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.manage-item:hover .title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.notice {
  position: relative;
  background: var(--tint);
  border-radius: 8px;
  padding: 18px 22px 18px 30px;
  overflow: hidden;
}

.notice::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gold);
}

.notice h3 {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--crust);
  margin: 0 0 4px;
}

.notice p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.notice p + p {
  margin-top: 6px;
}

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding: 16px 20px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--tint);
}

.banner p {
  margin: 0;
  font-size: 14px;
  color: var(--crust);
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 196px;
  height: 52px;
  padding: 0 28px;
  border-radius: 6px;
  border: 1px solid var(--crust);
  background: var(--crust);
  color: var(--flour);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  background: #50392a;
}

.button.secondary {
  background: transparent;
  color: var(--crust);
  border-color: var(--rule-strong);
}

.button.secondary:hover {
  border-color: var(--crust);
  background: var(--tint);
}

.button.small {
  min-width: 0;
  height: 44px;
  padding: 0 22px;
  font-size: 14px;
}

.errors {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  border-left: 4px solid var(--gold);
}

.errors li {
  background: var(--tint);
  padding: 12px 18px;
  font-size: 14px;
  color: var(--crust);
  font-weight: 700;
  margin-bottom: 1px;
}

.errors li:first-child {
  border-radius: 0 6px 0 0;
}

.errors li:last-child {
  border-radius: 0 0 6px 0;
}

.tagline {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--crust);
  margin: 0;
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tag.standing {
  background: var(--crust);
  color: var(--flour);
}

.tag.one-off {
  background: var(--gold);
  color: var(--crust);
}

.gate {
  max-width: 640px;
  margin: 24px 0 0;
}

.gate h1 {
  font-size: 40px;
  line-height: 1.08;
}

.gate p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 540px;
}

.gate .button {
  margin-top: 16px;
}

.gate .small-note {
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

/* Dialog */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(62, 42, 30, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 60;
}

.dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--flour);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: 30px 32px;
}

.dialog .eyebrow {
  margin-bottom: 8px;
}

.dialog h2 {
  font-size: 26px;
  line-height: 1.2;
}

.dialog .dialog-lede {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 10px 0 0;
}

.dialog-body {
  margin-top: 22px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--field);
  cursor: pointer;
  font-size: 14px;
  color: var(--crust);
}

.option input {
  accent-color: var(--crust);
  margin: 0;
}

.option.is-selected {
  border-color: var(--crust);
  border-width: 2px;
  padding: 12px 15px;
  font-weight: 700;
}

.option.is-disabled {
  color: var(--muted);
  background: transparent;
  border-style: dashed;
  cursor: not-allowed;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 4px;
}

.field-value {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--crust);
}

.dialog-message {
  margin-top: 18px;
  background: var(--tint);
  border-radius: 6px;
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--crust);
  font-weight: 500;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.dialog-actions .button {
  min-width: 0;
  height: 46px;
  font-size: 14px;
  flex: 1 1 auto;
}

.dialog-note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.edit-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.edit-line-label {
  font-size: 15px;
  color: var(--crust);
}

.edit-line .locked {
  font-size: 13px;
  color: var(--muted);
}

.remove-line {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 2px;
}

.locked-note {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--tint);
  border-radius: 6px;
  font-size: 13px;
  color: var(--crust);
  line-height: 1.55;
}

/* Orders page */
.orders-head {
  align-items: flex-end;
}

.date-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.date-switcher a {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 18px;
  border-radius: 20px;
  border: 1px solid var(--rule-strong);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  color: var(--crust);
}

.date-switcher a[aria-current="page"] {
  background: var(--crust);
  border-color: var(--crust);
  color: var(--flour);
}

.order-table-wrap {
  margin-top: 34px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
}

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

.order-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 22px 24px 14px;
}

.order-table th.col-qty,
.order-table th.col-value {
  text-align: right;
}

.order-table td {
  padding: 18px 24px;
  vertical-align: top;
  border-top: 1px solid var(--rule);
}

.order-table td.customer {
  font-size: 16px;
  font-weight: 700;
  color: var(--crust);
}

.order-table td.lines {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.order-table td.qty,
.order-table td.value {
  text-align: right;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.order-table td.qty {
  font-weight: 700;
  color: var(--crust);
}

.flag {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--crust);
  font-weight: 700;
}

.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.bake-card {
  margin-top: 32px;
  background: var(--tint);
  border-radius: 10px;
  padding: 30px 32px;
}

.bake-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.bake-head h2 {
  font-size: 22px;
}

.bake-head p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.bake-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.bake-item .number {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1;
  color: var(--crust);
}

.bake-item .label {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.summary-line {
  margin: 22px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Demo bar */
.demo-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--flour);
  border-top: 1px solid var(--gold-line);
  font-size: 12px;
  color: var(--crust);
}

.demo-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 9px;
  padding-bottom: 9px;
}

.demo-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.demo-select {
  font: inherit;
  font-size: 12px;
  color: var(--crust);
  background: var(--flour);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: 5px 8px;
  max-width: 100%;
}

.demo-reset {
  margin-left: auto;
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--crust);
  cursor: pointer;
}

.demo-reset:hover {
  border-color: var(--crust);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translate(-50%, 12px);
  background: var(--crust);
  color: var(--flour);
  padding: 11px 20px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 70;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

@media (max-width: 1100px) {
  .container {
    padding: 0 40px;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
  }
  .lines-head,
  .line-row {
    grid-template-columns: minmax(0, 1fr) 84px 100px;
  }
}

@media (max-width: 860px) {
  .container {
    padding: 0 24px;
  }
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "next"
      "products"
      "days"
      "manage"
      "cutoff"
      "actions";
    gap: 20px;
  }
  .site-nav {
    display: none;
  }
  .header-inner {
    min-height: 72px;
  }
  .wordmark {
    font-size: 21px;
  }
  .page-head h1 {
    font-size: 30px;
  }
  .next-card h2 {
    font-size: 22px;
  }
  .bake-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 16px;
  }
  .order-table thead {
    display: none;
  }
  .order-table,
  .order-table tbody,
  .order-table tr,
  .order-table td {
    display: block;
    width: 100%;
  }
  .order-table tr {
    padding: 18px 20px;
    border-top: 1px solid var(--rule);
  }
  .order-table td {
    padding: 4px 0;
    border: 0;
  }
  .order-table td.qty,
  .order-table td.value {
    text-align: left;
    display: inline-block;
    width: auto;
    margin-right: 16px;
  }
  .order-table td.value::before {
    content: "Value ";
    font-weight: 400;
    color: var(--muted);
  }
  .order-table td.qty::before {
    content: "Total qty ";
    font-weight: 400;
    color: var(--muted);
  }
  .order-table td.customer {
    padding-top: 0;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }
  .container {
    padding: 0 20px;
  }
  .site-main {
    padding-top: 26px;
  }
  .card {
    padding: 22px 20px;
  }
  .next-card {
    padding-left: 20px;
  }
  .next-card h2 {
    font-size: 20px;
  }
  .page-head h1 {
    font-size: 26px;
  }
  .page-head {
    flex-wrap: wrap;
  }
  .pill {
    height: 30px;
    min-width: 76px;
    padding: 0 16px;
    font-size: 12px;
  }
  .lines-head {
    grid-template-columns: minmax(0, 1fr) 76px;
    padding: 0 10px;
  }
  .lines-head span:nth-child(3) {
    display: none;
  }
  .line-row {
    grid-template-columns: minmax(0, 1fr) 76px;
    padding: 10px;
  }
  .line-head-price {
    display: none;
  }
  .line-name {
    font-size: 14px;
  }
  .card-foot {
    padding: 16px 10px 0;
  }
  .add-product {
    padding: 0 10px;
  }
  .chip {
    min-width: 38px;
    width: 38px;
    padding: 0;
    height: 34px;
    font-size: 11px;
  }
  .button {
    min-width: 0;
    width: 100%;
    height: 48px;
  }
  .actions {
    gap: 12px;
  }
  .bake-card {
    padding: 24px 20px;
  }
  .bake-item .number {
    font-size: 32px;
  }
  .order-table tr {
    padding: 16px 16px;
  }
  .demo-inner {
    gap: 8px;
  }
  .demo-select {
    flex: 1 1 100%;
    order: 3;
  }
  .demo-reset {
    margin-left: 0;
  }
  .dialog {
    padding: 24px 20px;
  }
  .dialog-actions .button {
    width: 100%;
    flex: 1 1 100%;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
