.pos-workspace {
  --pos-receipt: #fdfcff;
  --pos-divider: #dbd8ec;
  --pos-wait-ink: #79501d;
  --pos-wait-fill: #fbf2e1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.pos-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 20px;
}

.pos-header > div,
.pos-stack { display: grid; align-content: start; gap: 14px; }
.pos-header .pos-back { justify-self: start; padding-inline: 4px 10px; }
.pos-header h1 { font-size: clamp(38px, 5vw, 58px); }
.pos-header .pos-back .chevron { margin-left: 4px; }

.pos-mode {
  width: fit-content;
  padding: 5px 10px;
  border: 1px solid var(--pos-divider);
  border-radius: 6px;
  background: var(--accent-wash);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 650;
}

.pos-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 2px 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--pos-divider);
}

.pos-nav .button {
  padding: 10px 3px 9px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.pos-nav .button[aria-pressed="true"] {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.pos-body { margin-top: 12px; }
.pos-body:focus { outline: none; }

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 365px);
  align-items: start;
  gap: clamp(16px, 3vw, 32px);
}

.pos-panel,
.pos-receipt {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(15px, 2.2vw, 25px);
  background: var(--paper);
}

.pos-receipt {
  border-top: 3px solid var(--accent);
  background: var(--pos-receipt);
}

.pos-summary { position: sticky; top: 16px; }
.pos-panel h2,
.pos-receipt h2 {
  font: 400 clamp(24px, 3vw, 32px) / 1.08 Georgia, serif;
  letter-spacing: -.045em;
}

.pos-workspace h3 { font-size: 15px; font-weight: 650; }
.pos-meta { color: var(--muted); font-size: 13px; }
.pos-empty {
  padding-block: 12px;
  color: var(--muted);
  font-size: 14px;
}

.pos-section-head,
.pos-toolbar,
.pos-actions,
.pos-line,
.pos-line-actions {
  display: flex;
  align-items: center;
  gap: 8px 12px;
}

.pos-section-head,
.pos-line { justify-content: space-between; }
.pos-section-head,
.pos-toolbar,
.pos-actions { flex-wrap: wrap; }
.pos-toolbar { align-items: end; }
.pos-toolbar .field { flex: 1 1 155px; }
.pos-retail-picker {
  min-width: 0;
  border: 1px solid var(--pos-divider);
  border-radius: 10px;
  padding: 14px;
  gap: 10px;
}
.pos-retail-picker h2 { font-size: 16px; line-height: 1.3; font-weight: 650; letter-spacing: 0; }
.pos-retail-scan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px 8px;
}
.pos-retail-picker .field { min-width: 0; }
.pos-retail-picker :is(input, .button) { min-height: 44px; }
.pos-retail-picker [aria-invalid="true"] { border-color: var(--danger); }
.pos-retail-scan p { grid-column: 1 / -1; }
.pos-retail-error { color: var(--danger); font-size: 13px; }
.pos-retail-picker p:empty { margin: 0; }
.pos-retail-picker > p:empty,
.pos-retail-error:empty { position: absolute; }
.pos-retail-picker .pos-line { padding-block: 5px; }
.pos-other-items > .pos-toolbar { margin-top: 8px; }
.pos-action-stack { display: grid; gap: 9px; }
.pos-action-stack > .button { width: 100%; }

.pos-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-block: 1px solid var(--line);
}

.pos-line { padding-block: 12px; }
.pos-line + .pos-line { border-top: 1px solid var(--line); }
.pos-line > div:first-child { min-width: 0; }
.pos-line-title { display: block; }
.pos-line-actions { justify-content: end; flex-wrap: wrap; }
.pos-line .button { flex-shrink: 0; }

.pos-quantity {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.pos-quantity .button {
  min-width: 34px;
  min-height: 34px;
  padding: 5px;
  font-size: 16px;
}

.pos-amount,
.pos-total,
.pos-facts dd,
.pos-quantity { font-variant-numeric: tabular-nums; }

.pos-amount { text-align: right; white-space: nowrap; }

.pos-facts {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.pos-facts > div {
  display: grid;
  grid-template-columns: minmax(8ch, 1fr) minmax(0, 2fr);
  gap: 10px;
}

.pos-facts dt { color: var(--muted); overflow-wrap: normal; }
.pos-facts dd { min-width: 0; text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.pos-facts .pos-total-row {
  align-items: baseline;
  border-top: 1px dashed var(--pos-divider);
  margin-top: 6px;
  padding-top: 13px;
}

.pos-total {
  color: var(--accent-dark);
  font: 400 clamp(25px, 4vw, 35px) / 1.1 Georgia, serif;
  letter-spacing: -.04em;
}

.pos-tender label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-block: 5px;
  font-size: 14px;
}

.pos-tender input { accent-color: var(--accent); }
.pos-tender legend { margin-bottom: 4px; padding: 0; font-size: 13px; font-weight: 650; }
.pos-review { padding-top: 13px; border-top: 1px solid var(--pos-divider); }

.pos-state {
  width: fit-content;
  border-radius: 5px;
  padding: 3px 7px;
  color: var(--accent-dark);
  background: var(--accent-wash);
  font-size: 12px;
  font-weight: 650;
}

.pos-state[data-state="succeeded"] { color: var(--green); background: #e8f3ec; }
.pos-state:is([data-state="pending"], [data-state="unknown"]) {
  color: var(--pos-wait-ink);
  background: var(--pos-wait-fill);
}
.pos-state[data-state="failed"] { color: var(--danger); background: #faeef0; }

.pos-transaction { text-align: left; }
.pos-workspace :is(button, input, select, textarea):focus-visible { outline-offset: 2px; }

.pos-workspace textarea {
  width: 100%;
  min-height: 76px;
  padding: 8px 9px;
  border: 1px solid var(--control-line);
  border-radius: 7px;
  background: var(--paper);
  color: inherit;
  font: inherit;
  font-size: 13px;
  resize: vertical;
}

@media (max-width: 780px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr); }
  .pos-summary { position: static; }
}

@media (max-width: 450px) {
  .pos-header { align-items: start; }
  .pos-line { flex-wrap: wrap; }
  .pos-line-actions { width: 100%; justify-content: space-between; }
  .pos-nav { column-gap: 14px; }
  .pos-retail-picker .pos-line { flex-wrap: nowrap; }
  .pos-retail-picker .pos-line-actions { width: auto; }
}

@media (max-width: 350px) {
  .pos-retail-scan { grid-template-columns: minmax(0, 1fr); }
  .pos-retail-scan .button { justify-self: start; }
}

.pos-totals-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-block: 15px;
  border-block: 1px solid var(--line);
}

.pos-tender-totals + .pos-tender-totals {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

@media (max-width: 520px) {
  .pos-totals-grid { grid-template-columns: minmax(0, 1fr); }
  .pos-tender-totals + .pos-tender-totals {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 14px 0 0;
  }
}

.pos-workspace summary {
  width: fit-content;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.pos-gift-reference { margin-top: 9px; }
