:root {
  color-scheme: light;
  --cream: #f6f4ee;
  --paper: #fdfcf8;
  --line: #d6d1c6;
  --line-strong: #8d897f;
  --ink: #292b27;
  --muted: #60635a;
  --forest: #7d3026;
  --forest-deep: #57231d;
  --moss: #425b45;
  --sage: #edf0e8;
  --amber: #7a4b00;
  --amber-bg: #fbeccb;
  --rust: #8f2f1c;
  --rust-bg: #f9e2d9;
  --slate: #4b5148;
  --slate-bg: #e9e6da;
  --focus: #b4560a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 2px;
  --tap: 48px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
}

h1, h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.5rem; color: var(--forest); }
h2:focus { outline: none; }
p { margin: 0.5rem 0 0; }
small { font-size: 0.85em; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
a { color: var(--forest); text-underline-offset: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 0.75rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--paper);
  color: var(--forest);
  border-radius: 0 0 var(--radius) var(--radius);
}
.skip-link:focus { top: 0; }

.wrap {
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
}
.wrap-wide { max-width: 72rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
main.stack { padding-block: 1rem 1.5rem; }
.grow { flex: 1; min-width: 0; }

/* Masthead */
.masthead {
  background: var(--forest);
  color: var(--cream);
  border-bottom: 4px solid var(--forest-deep);
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-block: 0.85rem;
}
.mark { flex: none; border-radius: 10px; }
.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.masthead .eyebrow { color: #d6e2cf; }
.card .eyebrow { color: var(--moss); }

/* Cards */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: none;
}
.card-narrow { width: 100%; max-width: 26rem; margin-inline: auto; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.875rem; }
.help { margin-top: 0.3rem; color: var(--muted); font-size: 0.9rem; }

/* Availability */
.availability { border-top: 5px solid var(--slate); }
.availability[data-status="in_stock"] { border-top-color: var(--moss); }
.availability[data-status="low_stock"],
.availability[data-status="stale"] { border-top-color: #b57a12; }
.availability[data-status="sold_out"],
.availability[data-status="offline"] { border-top-color: var(--rust); }

.availability-head h2 { margin-top: 0.6rem; font-size: 1.85rem; }

.pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 0;
  background: var(--slate-bg);
  color: var(--slate);
  font-size: 0.82rem;
  font-weight: 650;
}
[data-status="in_stock"] .pill { background: var(--sage); color: var(--forest); }
[data-status="low_stock"] .pill,
[data-status="stale"] .pill { background: var(--amber-bg); color: var(--amber); }
[data-status="sold_out"] .pill,
[data-status="offline"] .pill { background: var(--rust-bg); color: var(--rust); }

.facts { margin: 1rem 0 0; border-top: 1px solid var(--line); }
.facts > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.1rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 650; text-align: right; }
.facts dd small { color: var(--muted); font-weight: 400; }

.freshness {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}
#freshness-text { flex: 1 1 0; min-width: 0; }
.freshness #refresh { flex: none; margin-left: auto; }
.dot {
  flex: none;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--line-strong);
}
[data-connection="live"] .dot { background: var(--moss); }
[data-connection="offline"] .dot {
  background: transparent;
  border: 2px solid var(--rust);
}
[data-connection="offline"] { color: var(--rust); }

/* Notices */
.notice {
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 2px;
  border-left: 4px solid var(--slate);
  background: var(--slate-bg);
  font-size: 0.95rem;
}
.notice:focus { outline: none; }
.notice p:first-child { margin-top: 0; }
.notice-info { border-left-color: var(--moss); background: var(--sage); }
.notice-warn { border-left-color: #b57a12; background: var(--amber-bg); color: #4f3200; }
.notice-error { border-left-color: var(--rust); background: var(--rust-bg); color: #65200f; }
.notice-success { border-left-color: var(--moss); background: var(--sage); color: var(--forest-deep); }
.notice a { color: inherit; font-weight: 650; }

/* Forms */
form { margin-top: 0.85rem; }
fieldset:disabled { opacity: 0.6; }
.field { margin-top: 1rem; }
.field-row { display: grid; gap: 0 1rem; }

label, legend { display: block; font-weight: 650; }
.optional { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

input[type="text"],
input[type="email"],
input[type="password"],
select {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-top: 0.3rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
}
select:disabled { background: var(--slate-bg); color: var(--muted); }
[aria-invalid="true"] { border-color: var(--rust) !important; }
.field-error { margin-top: 0.3rem; color: var(--rust); font-size: 0.92rem; font-weight: 600; }

.stepper {
  display: grid;
  grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
  gap: 0.5rem;
  margin-top: 0.3rem;
}
.stepper input {
  margin-top: 0;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 650;
}
.step {
  min-height: var(--tap);
  border: 1.5px solid var(--forest);
  border-radius: 2px;
  background: var(--paper);
  color: var(--forest);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.step:hover:not(:disabled) { background: var(--sage); }
.step:disabled { border-color: var(--line); color: var(--line-strong); cursor: not-allowed; }

.total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 1rem;
  padding: 0.6rem 0;
  border-block: 1px solid var(--line);
  font-weight: 650;
}
.total output {
  color: var(--forest);
  font-family: var(--serif);
  font-size: 1.7rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: var(--tap);
  padding: 0.4rem 0.75rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
}
.check input, .choice-item input {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  accent-color: var(--forest);
}

.choice { display: grid; gap: 0.5rem; }
.choice legend { margin-bottom: 0.4rem; }
.choice-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: var(--tap);
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 2px;
  background: #fff;
  font-weight: 400;
  cursor: pointer;
}
.choice-item:has(input:checked) { border-color: var(--forest); background: var(--sage); }
.choice-item span { display: flex; flex-direction: column; }
.choice-item small { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.55rem 1.1rem;
  border: 1.5px solid transparent;
  border-radius: 2px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 1rem; }
.btn-primary { background: var(--forest); color: #fffdf6; }
.btn-primary:hover:not(:disabled) { background: var(--forest-deep); }
.btn-secondary { border-color: var(--forest); background: var(--paper); color: var(--forest); }
.btn-secondary:hover:not(:disabled) { background: var(--sage); }
.btn-quiet { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.btn-quiet:hover:not(:disabled) { background: var(--slate-bg); }
.btn-danger { background: var(--rust); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #74240f; }
.btn-on-dark { border-color: #cfdcc9; background: transparent; color: var(--cream); }
.btn-on-dark:hover:not(:disabled) { background: var(--forest-deep); }
.btn-on-dark:focus-visible { outline-color: #ffd58f; }

.btn-link {
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: var(--forest);
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.85rem; }
.actions .btn { flex: 1 1 9rem; }

/* Pending and receipt */
.summary {
  margin-top: 0.6rem;
  color: var(--forest);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
}
.feedback { min-height: 1.5em; font-size: 0.95rem; }
.feedback:empty { min-height: 0; margin: 0; }
.feedback[data-tone="error"] { color: var(--rust); font-weight: 600; }
.feedback[data-tone="success"] { color: var(--forest); font-weight: 600; }

#receipt-view h2 { margin-top: 0.15rem; font-size: 1.85rem; }
.receipt { margin: 0.85rem 0 0; border-top: 2px solid var(--forest); }
.receipt > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--line-strong);
}
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-weight: 650; text-align: right; overflow-wrap: anywhere; }

.info { margin: 0.5rem 0 0; }
.info > div { padding: 0.45rem 0; }
.info dt { color: var(--muted); font-size: 0.875rem; }
.info dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.info .contact-item { display: block; }
.info .contact-item a { display: inline-flex; align-items: center; min-height: 44px; }
.notice .contact-item + .contact-item::before { content: " · "; }

.footer {
  padding-block: 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* Owner */
.admin-grid { display: grid; gap: 1rem; align-items: start; }
.admin-grid > * { min-width: 0; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.85rem 0 0;
}
.tiles > div {
  padding: 0.6rem;
  border-radius: 2px;
  background: var(--sage);
}
.tiles dt { color: var(--muted); font-size: 0.8rem; }
.tiles dd {
  margin: 0;
  color: var(--forest);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.table-wrap { margin-top: 0.75rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data-table thead { display: none; }
.data-table tr {
  display: block;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}
.data-table td {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.12rem 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.data-table td::before {
  content: attr(data-label);
  flex: none;
  color: var(--muted);
}
.data-table td.nowrap { white-space: nowrap; overflow-wrap: normal; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }

.events { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.events li {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.events time { color: var(--muted); font-size: 0.85rem; }

@media (min-width: 40rem) {
  h1 { font-size: 1.85rem; }
  main.stack { padding-block: 1.75rem 2rem; }
  .card { padding: 1.5rem; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .data-table thead { display: table-header-group; }
  .data-table tr { display: table-row; padding: 0; }
  .data-table th {
    padding: 0.4rem 0.5rem 0.4rem 0;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: left;
  }
  .data-table td {
    display: table-cell;
    padding: 0.5rem 0.5rem 0.5rem 0;
    text-align: left;
  }
  .data-table td::before { content: none; }
}

@media (min-width: 62rem) {
  .admin-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .step, .choice-item { transition: background-color 120ms ease; }
}

@media print {
  .masthead, .availability, .footer, #restock, #farm-info, #receipt-done { display: none !important; }
  body, .card { background: #fff; border: 0; box-shadow: none; }
}

/* Farm stand: one sign, a stock notice, and a paper purchase log. */
.customer { background: var(--cream); }
.customer .wrap { max-width: 72rem; padding-inline: clamp(1.25rem, 5vw, 4rem); }
.customer .masthead { background: none; color: var(--ink); border: 0; }
.customer .masthead-inner { display: block; padding-top: 2rem; padding-bottom: 0; }
.farm-location { margin: 0 0 .8rem; font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; }
.customer h1 { font-size: clamp(2.5rem, 6.5vw, 5.4rem); font-weight: 400; letter-spacing: -.055em; line-height: 1.05; }
.farm-description { margin-top: 1rem; color: var(--muted); font-size: 1rem; }
.farm-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.6rem; padding-block: .55rem; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
.farm-nav a { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.farm-nav a:hover { text-decoration: underline; }
.customer main.stack { display: grid; gap: 2.5rem; padding-top: 2rem; padding-bottom: 3rem; }
.customer .card { min-width: 0; border: 0; border-radius: 0; background: none; padding: 0; }
.customer .availability { border: 0; padding-top: .25rem; }
.customer .pill { padding: 0; background: none; color: var(--muted); font: 600 .78rem var(--sans); text-transform: uppercase; letter-spacing: .1em; }
.customer .availability[data-status="in_stock"] .pill { color: var(--moss); }
.customer .availability[data-status="sold_out"] .pill,
.customer .availability[data-status="offline"] .pill { color: var(--rust); }
.customer .availability-head h2 { color: var(--ink); font-size: clamp(2.1rem, 4.5vw, 3.5rem); font-weight: 400; letter-spacing: -.035em; margin-top: .7rem; max-width: 12ch; }
.customer #availability-detail { max-width: 36ch; margin-top: 1rem; }
.customer .facts { margin-top: 1.75rem; }
.customer .facts > div { padding-block: .9rem; gap: .5rem; }
.customer .facts dt { font-size: .88rem; }
.customer .facts dd { font-weight: 500; }
.customer .facts > div:first-child { display: block; }
.customer .facts > div:first-child dt { display: none; }
.customer .facts > div:first-child dd { text-align: left; }
.customer #price { font-family: var(--serif); font-size: 2.25rem; letter-spacing: -.04em; }
.customer .facts dd small { margin-left: .4rem; font-size: .88rem; }
.customer .freshness { font-size: .8rem; }
.customer .dot { width: .4rem; height: .4rem; }
.customer #checkout { padding: 1.5rem; background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--ink); }
.section-label { margin: 0 0 .4rem; font-size: .8rem; color: var(--muted); }
.customer #checkout h2, .customer #farm-info h2, .customer #restock h2 { color: var(--ink); font-size: 1.8rem; font-weight: 400; letter-spacing: -.025em; }
.customer #checkout .muted { font-size: .95rem; }
.customer .notice { padding: .7rem 0 .7rem .85rem; background: none; border-radius: 0; border-left-width: 2px; }
.customer .notice-error { color: var(--rust); }
.customer .notice-info { border-left-color: var(--line-strong); color: var(--muted); }
.customer .total { border-top: 0; padding-block: .8rem; }
.customer .total output { color: var(--ink); }
.customer .check { border: 0; background: none; padding-inline: 0; font-size: .95rem; }
.customer #farm-info { border-top: 1px solid var(--ink); padding-top: 1.5rem; }
.customer .info { display: grid; gap: .5rem 2rem; margin-top: 1rem; }
.customer .info dd { font-size: .95rem; }
.customer .footer { text-align: left; border-top: 0; font-size: .78rem; }
.admin .card { border-top: 2px solid var(--line-strong); }
.admin .masthead { background: var(--ink); border: 0; }
.admin .masthead .eyebrow { color: #ddd9ce; }
.admin .mark { display: none; }
.admin h2 { color: var(--ink); }
.admin .tiles > div { border-radius: 0; background: none; border-bottom: 1px solid var(--line); padding-inline: 0; }
@media (min-width: 48rem) {
  .customer .masthead-inner { padding-top: 3.5rem; }
  .customer main.stack { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(2.5rem, 6vw, 5rem); align-items: start; padding-top: 3rem; }
  .customer #checkout { grid-column: 2; grid-row: 1 / span 2; padding: 2rem; }
  .customer #farm-info { grid-column: 1 / -1; }
  .customer .info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer #restock { grid-column: 1; }
}
@media (max-width: 24rem) {
  .customer #checkout { padding: 1rem; }
  .customer .facts > div { display: block; }
  .customer .facts dd { text-align: left; margin-top: .3rem; }
}
