:root {
  color-scheme: light;
  --green: #007f3d;
  --dark: #101510;
  --muted: #637160;
  --paper: #f4f8f1;
  --line: #dce8d7;
  --danger: #a52d12;
}

* {
  box-sizing: border-box;
}

html[data-environment-marker]::before {
  content: attr(data-environment-marker);
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 999999;
  border: 2px solid var(--dark);
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff8ce;
  color: var(--dark);
  font: 1000 13px/1 Arial, Helvetica, sans-serif;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 24px rgba(7, 19, 10, 0.18);
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: #e8efe4;
  color: var(--dark);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
  touch-action: manipulation;
}

input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--dark);
  font: inherit;
  font-weight: 850;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
}

button.primary,
.picked .pickButton {
  background: var(--green);
  color: white;
}

button.danger,
.missing .missingButton {
  background: #ffe7df;
  color: var(--danger);
}

.pickerShell {
  width: min(680px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(18px + env(safe-area-inset-bottom));
}

.loginPanel {
  min-height: calc(100vh - 30px);
  display: grid;
  align-content: center;
  gap: 16px;
}

.loginPanel > div,
.loginForm {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.appBrandLogo {
  display: block;
  width: min(300px, 100%);
  height: auto;
  border-radius: 8px;
}

.appBrandLogo.compact {
  width: 152px;
  margin-bottom: 6px;
}

.loginPanel span {
  color: var(--green);
  font-size: 13px;
  font-weight: 1000;
  text-transform: uppercase;
}

.loginPanel h1 {
  margin: 0;
  font-size: 36px;
  line-height: 0.95;
}

.loginPanel p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.loginForm {
  gap: 14px;
}

.loginMessage {
  min-height: 20px;
  color: var(--danger);
  font-weight: 950;
  text-align: center;
}

.pdqInstallPanel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(0, 127, 61, 0.22);
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff, #ecf8ed);
  box-shadow: 0 14px 32px rgba(7, 45, 17, 0.08);
}

.pdqInstallPanel div {
  display: grid;
  gap: 6px;
}

.pdqInstallPanel span {
  color: var(--green);
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pdqInstallPanel strong {
  font-size: 19px;
  line-height: 1.05;
}

.pdqInstallPanel p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.pdqInstallPanel button {
  background: var(--green);
  color: white;
}

.appHeader {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -12px -12px 12px;
  padding: calc(12px + env(safe-area-inset-top)) 12px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 248, 241, 0.96);
  backdrop-filter: blur(14px);
}

.headerActions {
  display: flex;
  gap: 8px;
}

.appHeader span {
  display: block;
  color: var(--green);
  font-size: 13px;
  font-weight: 1000;
  text-transform: uppercase;
}

.appHeader h1 {
  margin: 1px 0 0;
  font-size: 28px;
  line-height: 0.95;
}

@media (max-width: 480px) {
  .appBrandLogo.compact {
    width: 118px;
  }
}

.statusGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.statusGrid article {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.statusGrid span,
.orderMeta span,
.itemDetail,
.itemCode,
.emptyState {
  color: var(--muted);
  font-weight: 850;
}

.itemCode {
  display: block;
  color: #075a25;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  letter-spacing: 0;
}

.itemCode.warning {
  color: var(--danger);
}

.statusGrid strong {
  font-size: 26px;
  line-height: 1;
}

.scanPanel {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 12px;
  border: 2px solid rgba(0, 127, 61, 0.28);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(5, 72, 23, 0.08);
}

.scanForm {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.scanPanel input {
  border-color: rgba(0, 127, 61, 0.5);
  font-size: 18px;
}

.scanPanel p {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.scanPanel p.warning {
  color: var(--danger);
}

.orderList {
  display: grid;
  gap: 12px;
}

.orderCard {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  box-shadow: 0 8px 22px rgba(5, 72, 23, 0.08);
}

.orderCardCompact {
  gap: 14px;
}

.orderCardTaken {
  opacity: 0.72;
}

.orderHeader {
  display: grid;
  gap: 8px;
}

.orderTitle {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.orderTitle strong {
  font-size: 18px;
  line-height: 1.1;
}

.orderMeta {
  display: grid;
  gap: 3px;
}

.pill {
  align-self: start;
  white-space: nowrap;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f7e5;
  color: var(--green);
  font-size: 13px;
  font-weight: 950;
}

.itemList {
  display: grid;
  gap: 8px;
}

.itemCard {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf6;
}

.itemCard.picked {
  border-color: rgba(0, 127, 61, 0.34);
  background: #eff9ee;
}

.itemCard.missing {
  border-color: rgba(165, 45, 18, 0.28);
  background: #fff5f0;
}

.itemPreviewCard {
  background: #ffffff;
}

.itemCard strong {
  display: block;
  margin-bottom: 3px;
  font-size: 17px;
  line-height: 1.14;
}

.itemDetail {
  display: block;
  line-height: 1.25;
}

.itemActions,
.orderActions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

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

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

.emptyState {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: white;
  text-align: center;
}

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 20;
  padding: 12px;
  border-radius: 10px;
  background: #062c13;
  color: white;
  font-weight: 950;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 360px) {
  .itemActions {
    grid-template-columns: 1fr;
  }
}

.printReceipt {
  display: none;
}

@media print {
  body.printingPickerReceipt > *:not(.printReceipt) {
    display: none !important;
  }

  body.printingPickerReceipt,
  body.printingPickerReceipt .printReceipt {
    display: block !important;
    background: white;
    color: #111;
    font-family: Arial, Helvetica, sans-serif;
  }

  .receiptPage {
    max-width: 760px;
    margin: 0 auto;
    padding: 18px;
  }

  .receiptPage h1 {
    margin: 0 0 10px;
    font-size: 26px;
  }

  .receiptPage h2 {
    margin: 14px 0 6px;
    font-size: 16px;
  }

  .receiptPage p {
    margin: 3px 0;
  }

  .receiptPage table {
    width: 100%;
    margin-top: 14px;
    border-collapse: collapse;
  }

  .receiptPage th,
  .receiptPage td {
    border: 1px solid #222;
    padding: 7px;
    text-align: left;
    vertical-align: top;
    font-size: 12px;
  }

  .receiptPage th {
    background: #eef5ea;
    font-weight: 900;
  }

  .receiptHeader {
    border-bottom: 2px solid #0b3d20;
    padding-bottom: 10px;
  }

  .receiptCode {
    margin: 14px 0;
    padding: 12px;
    border: 2px solid #0b3d20;
    text-align: center;
  }

  .receiptCode span {
    display: block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .receiptCode strong {
    display: block;
    margin-top: 5px;
    font-size: 28px;
    letter-spacing: 3px;
  }

  .receiptTotals {
    margin-top: 14px;
    margin-left: auto;
    max-width: 320px;
  }

  .receiptTotals p {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid #d7dfd2;
    padding: 5px 0;
  }

  .receiptSaved {
    color: #087a35;
  }

  .receiptGrandTotal {
    border-bottom: 3px solid #111 !important;
    font-size: 17px;
  }

  .receiptTotals small {
    display: block;
    margin-top: 12px;
  }
}
