.vm-app {
  --vm-ink: #202736;
  --vm-muted: #707d91;
  --vm-line: #e3e7ee;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--vm-ink);
  background: var(--vm-customer-page-bg);
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: border-box;
  &.vm-staff-mode {
    background: #f8f9fb;
  }
}

.vm-app,
.vm-dialog {
  .vm-button,
  .vm-icon-button,
  .vm-text-button {
    font: inherit;
    cursor: pointer;
  }
  .vm-button {
    min-height: 48px;
    padding: 12px 22px;
    border: 1px solid var(--vm-line, #e3e7ee);
    border-radius: 12px;
    display: inline-flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    color: #202736;
    background: #fff;
    font-weight: 650;
    line-height: 1.35;
  }
  .vm-button-primary {
    background: var(--vm-primary);
    border-color: var(--vm-primary);
    color: var(--vm-primary-foreground);
    &:hover:not(:disabled) {
      background: var(--vm-primary-hover);
      border-color: var(--vm-primary-hover);
    }
    &:active:not(:disabled) {
      background: var(--vm-primary-active);
      border-color: var(--vm-primary-active);
    }
  }
  .vm-button-outline {
    background: #fff;
    border-color: #697586;
  }
  .vm-icon-button {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid #d7dde8;
    background: #fff;
    color: #283447;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .vm-text-button {
    color: var(--vm-primary);
    border: 0;
    background: none;
    padding: 10px;
    font-weight: 600;
    &:hover:not(:disabled) {
      color: var(--vm-primary-hover);
    }
    &:active:not(:disabled) {
      color: var(--vm-primary-active);
    }
  }
  .vm-full {
    width: 100%;
  }
  .vm-caption {
    display: block;
    color: #707d91;
    font-size: 12px;
    line-height: 1.5;
  }
  .vm-field-error {
    display: block;
    color: #d43842;
    font-size: 12px;
    margin-top: 4px;
  }
  .vm-sku {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  }
  .vm-product-picker {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 0 12px;
    border: 1px solid #d7dde8;
    border-radius: 12px;
    background: #fff;
    height: 48px;
    .vm-product-select {
      width: 100%;
      min-width: 0;
      color: #202736;
      font: inherit;
      font-size: 13px;
      font-weight: 600;
      .ant-select-selector {
        padding-left: 0;
        background: transparent;
        font: inherit;
      }
      .ant-select-selection-search {
        left: 0;
      }
    }
  }
  .vm-stepper {
    display: flex;
    gap: 6px;
    align-items: center;
    input {
      width: 64px;
      min-width: 0;
      height: 46px;
      box-sizing: border-box;
      padding: 5px;
      border: 1px solid #d7dde8;
      border-radius: 12px;
      background: #fff;
      text-align: center;
      font: inherit;
      color: #202736;
      font-size: 18px;
      font-weight: 700;
      appearance: textfield;
      -moz-appearance: textfield;
    }
    input::-webkit-inner-spin-button,
    input::-webkit-outer-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }
    input[aria-invalid="true"] {
      border-color: #e54c55;
    }
  }
  .vm-quantity-editor {
    text-align: center;
    .vm-caption {
      margin-top: 4px;
    }
  }
  .vm-row-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    .vm-button {
      min-height: 46px;
      padding: 10px 12px;
      border-radius: 4px;
      font-size: 13px;
    }
    .vm-row-action-buttons {
      display: flex;
      flex-wrap: nowrap;
      align-items: center;
      gap: 8px;
      > .vm-button {
        flex-shrink: 0;
        white-space: nowrap;
      }
    }
  }
  .vm-button:disabled,
  .vm-icon-button:disabled,
  .vm-product-picker .ant-select-disabled,
  .vm-stepper input:disabled {
    opacity: 0.42;
    cursor: not-allowed;
  }
  .vm-button:focus-visible,
  .vm-icon-button:focus-visible,
  .vm-text-button:focus-visible,
  .vm-product-picker:focus-within,
  .vm-stepper input:focus-visible {
    outline: 3px solid var(--vm-primary-border);
    outline-offset: 2px;
  }
}

.vm-topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  box-sizing: border-box;
  padding: 16px 28px;
  color: #251d3d;
  > div {
    min-width: 0;
  }
  strong {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 750;
  }
  small {
    display: block;
    color: #a9aeb9;
    font-size: 12px;
    margin-top: 3px;
  }
  .vm-brand-mark {
    font-size: 35px;
    line-height: 1;
    color: var(--vm-primary);
  }
  .vm-icon-button {
    background: transparent;
    border-color: var(--vm-primary-border);
  }
}
.vm-topbar-staff {
  background: #202530;
  color: #fff;
  border-bottom: 1px solid #3d4450;
  padding: 12px 24px;
}
.vm-staff-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: #353b46;
  padding: 10px 14px;
  border-radius: 14px;
  color: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
  > span {
    background: #5a606a;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
  }
  strong {
    font-size: 14px;
  }
  small {
    font-size: 11px;
  }
}
.vm-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.vm-page-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 26px;
  border-bottom: 1px solid var(--vm-line);
  background: #fff;
  flex-shrink: 0;
  h1 {
    margin: 0 0 4px;
    color: #202736;
    font-size: 25px;
    line-height: 1.3;
    font-weight: 750;
  }
  p {
    margin: 0;
    font-size: 14px;
    color: #707d91;
    line-height: 1.6;
  }
  .vm-icon-button {
    border: 0;
    height: 36px;
    width: 36px;
    background: transparent;
  }
}
.vm-state {
  flex: 1;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #707d91;
  padding: 24px;
  text-align: center;
}
.vm-sales {
  // Optional presentation tokens: other BigSale callers retain their defaults.
  --pisell-kiosk-primary: var(--vm-primary);
  --pisell-kiosk-primary-hover: var(--vm-primary-hover);
  --pisell-kiosk-primary-active: var(--vm-primary-active);
  --pisell-kiosk-primary-bg: var(--vm-primary-bg);
  --pisell-kiosk-primary-border: var(--vm-primary-border);
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
  &[hidden] {
    display: none;
  }

  // Enlarge voucher items for the vending touch screen without scaling the panel.
  .pisell-sale-detail-promotion-wallet-panel--promotion {
    .pisell-sale-detail-promotion-wallet-panel {
      &__toolbar--three-actions {
        display: none;
      }

      &__records {
        gap: 6px;
      }

      &__record {
        flex-wrap: wrap;
        gap: 15px;
        min-height: 87px;
        padding: 12px 15px;
        border-radius: 15px;
      }

      &__record-main {
        flex-basis: 200px;
      }

      &__record-line {
        gap: 12px;
      }

      &__record-title,
      &__record-amount {
        font-size: 21px;
        line-height: 30px;
      }

      &__record-meta,
      &__record-reason {
        font-size: 18px;
        line-height: 27px;
      }

      &__record-actions {
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 9px;
        margin-left: auto;
      }

      &__record-check {
        width: 30px;
        height: 30px;
        font-size: 18px;
      }

      &__record-action {
        min-width: 126px;
        min-height: 54px;
        padding: 9px 18px;
        border-radius: 12px;
        font-size: 19.5px;
        line-height: 27px;
      }
    }
  }
}

.vm-customer-canvas .vm-scan-start {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  color: var(--vm-customer-ink);

  .vm-scan-start-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px var(--vm-customer-gutter) 40px;
  }
  .vm-scan-start-card {
    flex-shrink: 0;
    width: 100%;
    max-width: 600px;
    margin: auto;
    padding: 40px var(--vm-customer-gutter);
    border: 1px solid rgba(36, 28, 63, 0.1);
    border-radius: 24px;
    background: #fff;
    text-align: center;
    overflow-wrap: anywhere;

    h1 {
      margin: 24px 0 12px;
      font-size: 32px;
      line-height: 1.25;
    }
    p {
      max-width: 32ch;
      margin: 0 auto;
      color: rgba(36, 28, 63, 0.7);
      font-size: 20px;
      line-height: 1.5;
    }
  }
  .vm-scan-start-symbol {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    margin: 0 auto;
    border-radius: 28px;
    background: var(--vm-customer-soft);
    color: var(--vm-customer-primary);
    font-size: 48px;

    .vm-prototype-icon-loader-circle {
      animation: vm-scan-start-spin 1.2s linear infinite;
    }
  }
  .vm-scan-start-actions {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px var(--vm-customer-gutter) 32px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: var(--vm-customer-page-bg);
  }
  .vm-scan-start-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 72px;
    padding: 12px 24px;
    border: 2px solid rgba(36, 28, 63, 0.14);
    border-radius: 16px;
    background: #fff;
    color: var(--vm-customer-ink);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.5;

    .vm-prototype-icon {
      font-size: 28px;
    }
    &:hover:not(:disabled) {
      border-color: var(--vm-primary-border);
    }
    &:active:not(:disabled) {
      transform: scale(0.98);
    }
    &:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }
  }
  .vm-scan-start-retry {
    min-width: 200px;
    margin-left: auto;
    border-color: var(--vm-customer-primary);
    background: var(--vm-customer-primary);
    color: var(--vm-primary-foreground);

    &:hover {
      border-color: var(--vm-primary-hover);
      background: var(--vm-primary-hover);
    }
    &:active {
      border-color: var(--vm-primary-active);
      background: var(--vm-primary-active);
    }
  }
  &.vm-customer-paused .vm-prototype-icon-loader-circle {
    animation-play-state: paused;
  }
}

@container vending-customer (max-width: 620px) {
  .vm-customer-canvas .vm-scan-start {
    .vm-scan-start-card {
      padding: 24px 16px;
    }
    .vm-scan-start-card h1 {
      font-size: 26px;
    }
    .vm-scan-start-actions {
      gap: 12px;
    }
    .vm-scan-start-button {
      flex: 1;
      min-width: 0;
      padding-inline: 16px;
      font-size: 18px;
    }
  }
}

@keyframes vm-scan-start-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vm-customer-canvas .vm-scan-start .vm-prototype-icon-loader-circle {
    animation: none;
  }
}

.vm-service-card:focus-visible,
.vm-staff-badge:focus-visible {
  outline: 3px solid var(--vm-primary-border);
  outline-offset: 4px;
}

.vm-staff-content {
  padding: 28px;
  flex: 1;
  overflow: auto;
}
.vm-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.vm-stat {
  background: #fff;
  border: 1px solid #e3e7ee;
  border-radius: 16px;
  padding: 18px 14px;
  span {
    color: #707d91;
    font-size: 12px;
  }
  strong {
    display: block;
    font-size: 29px;
    font-weight: 750;
    margin-top: 6px;
  }
}
.vm-stat-low strong {
  color: #bd8611;
}
.vm-stat-empty strong {
  color: #e0575d;
}
.vm-service-card {
  display: flex;
  gap: 22px;
  align-items: center;
  width: 100%;
  padding: 28px;
  border: 1px solid var(--vm-primary);
  border-radius: 18px;
  color: var(--vm-primary-foreground);
  background: var(--vm-primary);
  text-align: left;
  font: inherit;
  cursor: pointer;
  &:hover {
    border-color: var(--vm-primary-hover);
    background: var(--vm-primary-hover);
  }
  &:active {
    border-color: var(--vm-primary-active);
    background: var(--vm-primary-active);
  }
  > .anticon {
    font-size: 32px;
  }
  > .anticon:last-child {
    margin-left: auto;
    font-size: 22px;
  }
  h2 {
    color: inherit;
    font-size: 24px;
    margin: 0 0 6px;
    font-weight: 700;
  }
  p {
    color: inherit;
    opacity: 0.85;
    margin: 0;
  }
}
.vm-resume {
  width: 100%;
  margin-top: 28px;
}
.vm-restock > .vm-page-heading {
  flex-wrap: wrap;
}
.vm-restock-title {
  flex: 1;
  min-width: 200px;
  > .vm-caption {
    margin-top: 6px;
  }
}
.vm-fill-all {
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
}
.vm-restock-notice {
  flex-shrink: 0;
  margin: 16px 24px 0;
}
.vm-restock-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 24px 24px;
}
.vm-restock .vm-inline-list {
  min-width: 710px;
}
.vm-restock .vm-list-labels {
  display: grid;
  grid-template-columns: 68px minmax(160px, 1fr) 170px 260px;
  gap: 10px;
  color: #929dad;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
  padding: 8px 14px 18px 0;
  align-items: center;
  text-align: center;
  span:nth-child(2) {
    text-align: left;
  }
}
.vm-restock .vm-channel-group {
  display: block;
  background: #fff;
  border: 1px solid #e0e5ed;
  border-radius: 17px;
  overflow: hidden;
  margin-bottom: 16px;
}
.vm-channel-group-heading {
  padding: 8px 14px;
  color: #707d91;
  background: #f8f9fb;
  border-bottom: 1px solid #e3e7ee;
  font-size: 12px;
  font-weight: 650;
}
.vm-group-items {
  flex: 1;
  min-width: 0;
}
.vm-restock .vm-channel-line {
  position: relative;
  display: grid;
  grid-template-columns: 68px minmax(160px, 1fr) 170px 260px;
  gap: 10px;
  padding: 12px 14px 12px 0;
  align-items: start;
  border-bottom: 1px solid #f0f2f6;
  min-height: 91px;
  box-sizing: border-box;
  &:last-child {
    border-bottom: 0;
  }
  &::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
  }
  .vm-channel-code {
    padding: 11px 0;
    text-align: center;
    font-size: 18px;
  }
  .vm-channel-product {
    min-width: 0;
    > .vm-caption {
      margin-top: 6px;
      overflow-wrap: anywhere;
    }
  }
  .vm-stepper {
    justify-content: center;
    .vm-icon-button {
      width: 46px;
    }
  }
  &.vm-status-empty::before {
    background: #ff6771;
  }
  &.vm-status-low::before {
    background: #f9b500;
  }
  &.vm-status-disabled::before,
  &.vm-status-blocked::before {
    background: #8e98a8;
  }
  &.vm-is-changed {
    background: var(--vm-primary-bg);
  }
}
.vm-channel-test-result {
  display: block;
  color: #707d91;
  font-size: 12px;
  line-height: 1.5;
  &.vm-test-success {
    color: #237d5b;
  }
  &.vm-test-failed {
    color: #d43842;
  }
  &.vm-test-unknown {
    color: #9c6812;
  }
}
.vm-restock-review-dialog .ant-modal-body {
  max-height: 65vh;
  overflow: auto;
}
.vm-restock-review {
  color: #202736;
  font-size: 13px;
  > p {
    margin: 0 0 12px;
  }
  .vm-review-table-scroll {
    overflow-x: auto;
    margin-bottom: 16px;
  }
  .vm-review-table {
    width: 100%;
    min-width: 580px;
    border-collapse: collapse;
    caption {
      color: #202736;
      text-align: left;
      font-weight: 700;
      padding: 4px 0 10px;
    }
    th,
    td {
      border-bottom: 1px solid #e3e7ee;
      padding: 10px;
      text-align: left;
      vertical-align: top;
      overflow-wrap: anywhere;
    }
    th {
      background: #f8f9fb;
      font-size: 12px;
      font-weight: 600;
    }
    th:nth-child(n + 3),
    td:nth-child(n + 3) {
      text-align: right;
      white-space: nowrap;
    }
  }
  .vm-review-summary {
    min-width: 320px;
    th:nth-child(2),
    td:nth-child(2) {
      text-align: right;
    }
  }
  .vm-review-sku {
    display: block;
    color: #707d91;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    margin-top: 4px;
  }
  .vm-review-binding {
    display: block;
    font-size: 12px;
    margin-top: 4px;
  }
  .vm-review-added {
    color: #237d5b;
  }
  .vm-review-removed {
    color: #d43842;
  }
  .vm-review-totals {
    font-weight: 700;
    font-size: 16px;
    margin: 0;
  }
}
.vm-submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px max(16px, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e3e7ee;
  flex-shrink: 0;
  box-shadow: 0 -4px 10px #1b2b4703;
  > div > strong {
    display: block;
    color: #202736;
    font-size: 24px;
    line-height: 1.2;
  }
  .vm-button {
    border-radius: 6px;
    min-height: 56px;
  }
}
@media (max-width: 540px) {
  .vm-topbar {
    padding: 12px 18px;
    min-height: 66px;
  }
  .vm-topbar strong {
    font-size: 14px;
  }
  .vm-page-heading {
    padding: 16px;
    gap: 10px;
    h1 {
      font-size: 21px;
    }
    p {
      font-size: 12px;
    }
  }
  .vm-staff-badge {
    padding: 7px 10px;
    gap: 6px;
    > span {
      display: none;
    }
  }
  .vm-staff-content {
    padding: 18px;
  }
  .vm-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vm-service-card {
    padding: 22px;
    gap: 14px;
    h2 {
      font-size: 20px;
    }
  }
  .vm-restock-notice {
    margin: 14px 16px 0;
  }
  .vm-restock-scroll {
    padding: 14px 16px 18px;
  }
  .vm-submit-bar {
    padding: 12px 16px;
    gap: 12px;
    > div > strong {
      font-size: 20px;
    }
    .vm-button {
      font-size: 13px;
      padding: 10px 14px;
    }
  }
}
