:root {
  --pos-bg: #eef1f4;
  --pos-surface: #ffffff;
  --pos-surface-strong: #171c24;
  --pos-text: #171a1f;
  --pos-muted: #5f6975;
  --pos-line: #cfd7df;
  --pos-primary: #c9342d;
  --pos-primary-hover: #a92924;
  --pos-primary-soft: #fceceb;
  --pos-warning: #6f4808;
  --pos-warning-bg: #fff0c7;
  --pos-focus: #2f6fb2;
  --pos-radius: 14px;
  --pos-shadow: 0 16px 38px rgba(23, 28, 36, 0.12);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--pos-bg);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background: var(--pos-bg);
  color: var(--pos-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior: none;
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid var(--pos-focus);
  outline-offset: 3px;
}

.pos-shell {
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.pos-topbar {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 10px 14px;
  border-radius: var(--pos-radius);
  background: var(--pos-surface-strong);
  color: #f8fafc;
  box-shadow: var(--pos-shadow);
}

.pos-back-link {
  width: max-content;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  color: #f8fafc;
  font-weight: 800;
  text-decoration: none;
}

.pos-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pos-brand img {
  width: 82px;
  height: 42px;
  object-fit: contain;
}

.pos-brand span,
.pos-source span,
.pos-kicker,
.pos-dialog-label {
  display: block;
  color: var(--pos-muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pos-brand span,
.pos-source span {
  color: rgba(248, 250, 252, 0.66);
}

.pos-brand h1,
.pos-panel-heading h2,
.pos-cart-heading h2,
.pos-dialog h2 {
  margin: 0;
  line-height: 1.1;
}

.pos-brand h1 {
  font-size: 22px;
}

.pos-source {
  justify-self: end;
  text-align: right;
}

.pos-source strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.pos-boundary,
.pos-data-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--pos-radius);
}

.pos-boundary {
  border: 1px solid #e3bd66;
  background: var(--pos-warning-bg);
  color: #543706;
}

.pos-boundary strong {
  flex: 0 0 auto;
}

.pos-data-alert {
  justify-content: space-between;
  border: 2px solid var(--pos-primary);
  background: var(--pos-primary-soft);
  color: #711d19;
  font-weight: 750;
}

.pos-data-alert button {
  min-height: 48px;
  flex: 0 0 auto;
  padding: 0 16px;
  border-radius: 10px;
  background: #711d19;
  color: #ffffff;
  font-weight: 850;
}

.pos-demo-tools {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr);
  gap: 14px;
  width: min(1560px, 100%);
  margin: 14px auto 0;
}

.pos-demo-help,
.pos-demo-feedback {
  min-width: 0;
  padding: 18px;
  border: 1px solid #b9c9d8;
  border-radius: var(--pos-radius);
  background: #f7fbff;
  box-shadow: 0 10px 28px rgba(23, 28, 36, 0.09);
}

.pos-demo-help h2 {
  margin: 4px 0 0;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.15;
}

.pos-demo-help > p,
.pos-demo-feedback > p {
  margin: 10px 0 0;
  color: var(--pos-muted);
}

.pos-demo-tour-card {
  margin-top: 16px;
  padding: 14px;
  border: 2px solid #7aa5d1;
  border-radius: 12px;
  background: #ffffff;
}

.pos-demo-tour-card > span {
  display: block;
  color: #315f8d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.pos-demo-tour-card h3 {
  margin: 5px 0 0;
  font-size: 20px;
}

.pos-demo-tour-card p {
  margin: 7px 0 0;
  color: var(--pos-muted);
}

.pos-demo-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.pos-demo-actions .pos-checkout-button,
.pos-demo-actions .pos-secondary-button {
  width: auto;
  flex: 1 1 0;
}

.pos-demo-feedback summary {
  cursor: pointer;
  color: var(--pos-text);
  font-size: 20px;
  font-weight: 900;
}

.pos-demo-feedback form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.pos-demo-field {
  display: grid;
  gap: 6px;
  color: var(--pos-muted);
  font-size: 13px;
  font-weight: 800;
}

.pos-demo-field-wide,
.pos-demo-feedback-privacy,
.pos-demo-feedback form > .pos-checkout-button,
.pos-demo-feedback-status {
  grid-column: 1 / -1;
}

.pos-demo-field input,
.pos-demo-field select,
.pos-demo-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--pos-line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--pos-text);
}

.pos-demo-field textarea {
  min-height: 112px;
  resize: vertical;
}

.pos-demo-feedback-privacy {
  margin: 0;
  color: var(--pos-muted);
  font-size: 12px;
}

.pos-demo-feedback-status {
  min-height: 24px;
  margin: 0;
  font-weight: 800;
}

.pos-demo-feedback-status.is-error {
  color: #8b231d;
}

.pos-demo-feedback-status.is-success {
  color: #17643a;
}

.pos-demo-tour-target {
  position: relative;
  z-index: 3;
  outline: 4px solid #f2b933 !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 8px rgba(242, 185, 51, 0.24) !important;
}

.pos-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 430px);
  gap: 14px;
  width: min(1560px, 100%);
  margin: 14px auto 0;
}

.pos-catalog-panel,
.pos-cart-panel {
  min-width: 0;
  border: 1px solid var(--pos-line);
  border-radius: var(--pos-radius);
  background: var(--pos-surface);
  box-shadow: var(--pos-shadow);
}

.pos-catalog-panel {
  padding: 18px;
}

.pos-panel-heading {
  display: grid;
  grid-template-columns: 1fr minmax(250px, 360px);
  align-items: end;
  gap: 18px;
}

.pos-panel-heading h2,
.pos-cart-heading h2 {
  margin-top: 4px;
  font-size: clamp(24px, 2.4vw, 34px);
}

.pos-search {
  display: grid;
  gap: 6px;
  color: var(--pos-muted);
  font-size: 13px;
  font-weight: 800;
}

.pos-search input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid var(--pos-line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--pos-text);
}

.pos-search input::placeholder {
  color: #6b7480;
}

.pos-categories {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.pos-category-button {
  min-width: max-content;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid var(--pos-line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--pos-text);
  font-weight: 850;
}

.pos-category-button[aria-pressed="true"] {
  border-color: var(--pos-surface-strong);
  background: var(--pos-surface-strong);
  color: #ffffff;
}

.pos-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 10px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.pos-product-button {
  min-height: 118px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--pos-line);
  border-radius: var(--pos-radius);
  background: #f8fafb;
  color: var(--pos-text);
  text-align: left;
  box-shadow: 0 5px 14px rgba(23, 28, 36, 0.07);
}

.pos-product-button:hover:not(:disabled) {
  border-color: #7f8c99;
  background: #ffffff;
}

.pos-product-button:active:not(:disabled),
.pos-category-button:active:not(:disabled),
.pos-checkout-button:active:not(:disabled),
.pos-secondary-button:active:not(:disabled),
.pos-step-button:active:not(:disabled),
.pos-remove-button:active:not(:disabled),
.pos-mobile-cart-button:active:not(:disabled),
.pos-back-link:active {
  transform: scale(0.98);
}

.pos-fallback-inert {
  pointer-events: none;
}

.pos-product-category {
  color: var(--pos-muted);
  font-size: 12px;
  font-weight: 800;
}

.pos-product-name {
  font-size: 17px;
  line-height: 1.2;
}

.pos-product-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
}

.pos-product-meta span {
  color: var(--pos-muted);
  font-size: 13px;
  font-weight: 750;
}

.pos-product-meta strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pos-empty-state {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 150px;
  padding: 24px;
  color: var(--pos-muted);
  text-align: center;
}

.pos-empty-state strong {
  color: var(--pos-text);
}

.pos-cart-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100dvh - 140px);
  max-height: calc(100dvh - 140px);
  position: sticky;
  top: 14px;
  overflow: hidden;
}

.pos-cart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--pos-line);
}

.pos-cart-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-mobile-cart-close-button {
  display: none;
}

.pos-secondary-button,
.pos-checkout-button {
  min-height: 48px;
  padding: 0 17px;
  border-radius: 10px;
  font-weight: 850;
}

.pos-secondary-button {
  border: 1px solid var(--pos-line);
  background: #ffffff;
  color: var(--pos-text);
}

.pos-cart-list {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.pos-cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--pos-line);
}

.pos-cart-line-copy {
  min-width: 0;
}

.pos-cart-line-copy strong,
.pos-cart-line-copy span {
  display: block;
}

.pos-cart-line-copy strong {
  overflow-wrap: anywhere;
}

.pos-cart-line-copy span {
  margin-top: 3px;
  color: var(--pos-muted);
  font-size: 13px;
}

.pos-line-total {
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.pos-cart-controls {
  display: grid;
  grid-template-columns: 48px 48px 48px;
  gap: 6px;
  align-items: center;
}

.pos-step-button,
.pos-remove-button {
  min-width: 48px;
  min-height: 48px;
  border-radius: 10px;
  font-weight: 900;
}

.pos-step-button {
  border: 1px solid var(--pos-line);
  background: #ffffff;
  color: var(--pos-text);
  font-size: 20px;
}

.pos-cart-quantity {
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 48px;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.pos-remove-button {
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid #e7aaa7;
  background: var(--pos-primary-soft);
  color: #7b211c;
}

.pos-cart-footer {
  padding: 16px 18px 18px;
  border-top: 1px solid var(--pos-line);
  background: #f8fafb;
}

.pos-cart-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.pos-cart-summary div:last-child {
  text-align: right;
}

.pos-cart-summary span,
.pos-cart-summary strong {
  display: block;
}

.pos-cart-summary span {
  color: var(--pos-muted);
  font-size: 13px;
  font-weight: 750;
}

.pos-cart-summary strong {
  margin-top: 2px;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.pos-checkout-button {
  width: 100%;
  background: var(--pos-primary);
  color: #ffffff;
}

.pos-checkout-button:hover:not(:disabled) {
  background: var(--pos-primary-hover);
}

.pos-mobile-cart-button {
  display: none;
}

.pos-cart-footer p {
  margin: 10px 0 0;
  color: var(--pos-muted);
  font-size: 12px;
}

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

.pos-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--pos-radius);
  color: var(--pos-text);
  box-shadow: 0 24px 80px rgba(17, 22, 29, 0.34);
}

.pos-dialog::backdrop {
  background: rgba(17, 22, 29, 0.72);
}

.pos-dialog-content {
  padding: 26px;
}

.pos-dialog h2 {
  margin-top: 6px;
  font-size: 30px;
}

.pos-dialog p {
  color: var(--pos-muted);
}

.pos-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 900px) {
  body.pos-cart-open {
    overflow: hidden;
  }

  .pos-shell {
    padding-bottom: max(86px, calc(env(safe-area-inset-bottom) + 78px));
  }

  .pos-topbar {
    grid-template-columns: auto 1fr;
  }

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

  .pos-source {
    grid-column: 1 / -1;
    justify-self: stretch;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    text-align: left;
  }

  .pos-workspace {
    grid-template-columns: 1fr;
  }

  .pos-demo-tools {
    grid-template-columns: 1fr;
  }

  .pos-cart-panel {
    min-height: 0;
    max-height: none;
    display: none;
    position: fixed;
    z-index: 40;
    inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    box-shadow: 0 24px 80px rgba(17, 22, 29, 0.42);
  }

  .pos-cart-panel.is-mobile-open {
    display: grid;
  }

  .pos-cart-list {
    max-height: none;
  }

  .pos-mobile-cart-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .pos-mobile-cart-button {
    min-height: 58px;
    display: flex;
    position: fixed;
    z-index: 20;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: var(--pos-surface-strong);
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(17, 22, 29, 0.28);
    font-weight: 850;
    text-align: left;
  }

  body.pos-cart-open .pos-mobile-cart-button {
    visibility: hidden;
  }

  .pos-mobile-cart-button strong {
    font-variant-numeric: tabular-nums;
    text-align: right;
  }
}

@media (max-width: 640px) {
  .pos-shell {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    padding-bottom: max(86px, calc(env(safe-area-inset-bottom) + 78px));
  }

  .pos-topbar {
    gap: 10px;
  }

  .pos-brand img {
    width: 68px;
  }

  .pos-brand h1 {
    font-size: 18px;
  }

  .pos-boundary,
  .pos-data-alert {
    align-items: flex-start;
    flex-direction: column;
  }

  .pos-data-alert button {
    width: 100%;
  }

  .pos-catalog-panel {
    padding: 12px;
  }

  .pos-demo-help,
  .pos-demo-feedback {
    padding: 14px;
  }

  .pos-demo-feedback form {
    grid-template-columns: 1fr;
  }

  .pos-demo-field,
  .pos-demo-feedback-privacy,
  .pos-demo-feedback form > .pos-checkout-button,
  .pos-demo-feedback-status {
    grid-column: 1;
  }

  .pos-panel-heading {
    grid-template-columns: 1fr;
  }

  .pos-catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pos-product-button {
    min-height: 126px;
    padding: 12px;
  }

  .pos-cart-line {
    grid-template-columns: 1fr;
  }

  .pos-cart-controls {
    grid-template-columns: 1fr 1fr 1fr;
  }

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

@media (max-width: 380px) {
  .pos-topbar {
    grid-template-columns: 1fr;
  }

  .pos-back-link {
    justify-content: center;
    width: 100%;
  }

  .pos-brand {
    justify-self: start;
  }

  .pos-source {
    grid-column: 1;
  }

  .pos-catalog {
    grid-template-columns: 1fr;
  }

  .pos-cart-heading {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .pos-cart-heading-actions {
    width: 100%;
  }

  .pos-cart-heading-actions .pos-secondary-button {
    min-width: 0;
    flex: 1 1 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .pos-product-button,
  .pos-category-button,
  .pos-checkout-button,
  .pos-secondary-button,
  .pos-step-button,
  .pos-remove-button,
  .pos-back-link,
  .pos-mobile-cart-button {
    transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
  }
}
