/* =========================
   Base
========================= */

body {
  background: var(--vp-background);
  color: var(--vp-text);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  overscroll-behavior-y: contain;
}

button,
input,
textarea {
  color: inherit;
}

.vp-app {
  width: min(100%, var(--vp-page-width));
  min-height: 100vh;
  margin: 0 auto;
  padding:
    18px
    14px
    calc(104px + env(safe-area-inset-bottom));
}


/* =========================
   Header
========================= */

.vp-header {
  margin-bottom: 14px;
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-surface);
  padding: 18px;
  box-shadow: var(--vp-shadow);
}

.vp-header__eyebrow {
  margin-bottom: 4px;
  color: var(--vp-primary);
  font-size: 13px;
  font-weight: 700;
}

.vp-header__buyer {
  font-size: 22px;
  font-weight: 750;
  line-height: 1.35;
}

.vp-order-info {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  border-top: 1px solid var(--vp-border);
  padding-top: 13px;
}

.vp-order-info__row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.vp-order-info__label {
  color: var(--vp-text-secondary);
  font-size: 13px;
}

.vp-order-info__value {
  min-width: 0;
  color: var(--vp-text);
  font-size: 14px;
  text-align: right;
  overflow-wrap: anywhere;
}


/* =========================
   Sections
========================= */

.vp-section {
  margin-top: 14px;
}

.vp-section__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 9px;
}

.vp-section__title {
  color: var(--vp-text);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.4;
}

.vp-section__hint {
  margin-top: 2px;
  color: var(--vp-text-muted);
  font-size: 12px;
  line-height: 1.4;
}


/* =========================
   Product Section
========================= */

.vp-products-section {
  overflow: hidden;
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-surface);
  box-shadow: var(--vp-shadow);
}

.vp-products-section
.vp-section__header {
  padding: 14px 16px 11px;
}


/* =========================
   Buyer Note
========================= */

.vp-buyer-note {
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-surface);
  padding: 15px 16px;
  box-shadow: var(--vp-shadow);
}

.vp-buyer-note__text {
  margin-top: 8px;
  color: var(--vp-text-secondary);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}


/* =========================
   Vendor Details
========================= */

.vp-vendor-details {
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-surface);
  padding: 15px 16px 16px;
  box-shadow: var(--vp-shadow);
}

.vp-vendor-details
.vp-section__title {
  margin-bottom: 14px;
}

.vp-field + .vp-field {
  margin-top: 14px;
}

.vp-field__label {
  display: block;
  margin-bottom: 6px;
  color: var(--vp-text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.vp-field__input,
.vp-field__textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--vp-border-strong);
  border-radius: var(--vp-radius-medium);
  outline: none;
  background: var(--vp-surface);
}

.vp-field__input {
  min-height: 48px;
  padding: 10px 12px;
  font-size: 15px;
}

.vp-field__input[type="date"] {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.vp-field__textarea {
  min-height: 104px;
  padding: 11px 12px;
  font-size: 15px;
  line-height: 1.55;
}

.vp-field__textarea::placeholder {
  color: var(--vp-text-muted);
}

.vp-field__input:focus,
.vp-field__textarea:focus {
  border-color: var(--vp-primary);
  box-shadow:
    0 0 0 3px
    var(--vp-primary-soft);
}


/* =========================
   Buttons
========================= */

.vp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: var(--vp-radius-medium);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.vp-button:active {
  transform: scale(0.98);
}

.vp-button--primary {
  border: 1px solid var(--vp-primary);
  background: var(--vp-primary);
  color: #ffffff;
}

.vp-button--primary:hover {
  background: var(--vp-primary-hover);
}

.vp-button--cancel {
  border: 1px solid var(--vp-danger-border);
  background: var(--vp-surface);
  color: var(--vp-danger);
}

.vp-button--cancel:hover {
  border-color: var(--vp-danger);
  background: var(--vp-danger-soft);
}


/* =========================
   Bottom Bar
========================= */

.vp-bottom-spacer {
  height: 16px;
}

.vp-bottom-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;

  display: grid;
  grid-template-columns:
    minmax(0, 0.85fr)
    minmax(0, 1.15fr);

  gap: 9px;

  width: min(
    100%,
    var(--vp-page-width)
  );

  margin: 0 auto;

  border-top:
    1px solid
    var(--vp-border);

  background:
    rgba(255, 255, 255, 0.96);

  padding:
    11px
    14px
    calc(
      11px +
      env(safe-area-inset-bottom)
    );

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.vp-bottom-bar
.vp-button {
  width: 100%;
}


/* =========================
   Mobile
========================= */

@media (max-width: 560px) {
  .vp-app {
    padding:
      10px
      10px
      calc(
        100px +
        env(safe-area-inset-bottom)
      );
  }

  .vp-header {
    padding: 16px 15px;
  }

  .vp-header__buyer {
    font-size: 21px;
  }

  .vp-order-info__row {
    grid-template-columns:
      100px
      minmax(0, 1fr);
  }

  .vp-products-section
  .vp-section__header {
    padding:
      13px
      14px
      10px;
  }

  .vp-buyer-note,
  .vp-vendor-details {
    padding-right: 14px;
    padding-left: 14px;
  }

  .vp-bottom-bar {
    gap: 8px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .vp-button {
    padding-right: 10px;
    padding-left: 10px;
    font-size: 13px;
  }
  
}

/* =========================
   Product Rows
========================= */

.vp-product-list {
  overflow: hidden;
  border-top: 1px solid var(--vp-border);
}

.vp-product-row {
  padding: 13px 16px 12px;
  background: var(--vp-row-even);
}

.vp-product-row:nth-child(even) {
  background: var(--vp-row-odd);
}

.vp-product-row__top {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 12px;
  align-items: baseline;
}

.vp-product-row__name {
  min-width: 0;
  font-size: 15px;
  font-weight: 720;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.vp-product-row__quantity {
  color: var(--vp-text);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.vp-product-row__price-line {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 12px;
  align-items: baseline;
  margin-top: 5px;
}

.vp-product-row__unit-price {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  color: var(--vp-text-secondary);
}

.vp-product-row__unit-price-number {
  font-size: 13px;
  font-weight: 600;
}

.vp-product-row__unit-price-unit {
  color: var(--vp-text-muted);
  font-size: 10px;
  font-weight: 500;
}

.vp-product-row__total {
  color: var(--vp-text);
  font-size: 15px;
  font-weight: 750;
  white-space: nowrap;
}

.vp-product-row__free {
  margin-top: 4px;
  color: var(--vp-primary);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.vp-product-row__free strong {
  font-weight: 700;
}


/* =========================
   Product Rows - Mobile
========================= */

@media (max-width: 560px) {
  .vp-product-row {
    padding:
      12px
      14px
      11px;
  }

  .vp-product-row__top,
  .vp-product-row__price-line {
    gap: 10px;
  }

  .vp-product-row__name {
    font-size: 14px;
  }

  .vp-product-row__quantity {
    font-size: 13px;
  }

  .vp-product-row__total {
    font-size: 14px;
  }
}

/* =========================
   Product Edit Mode
========================= */

.vp-product-row {
  position: relative;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.vp-product-row--editing {
  margin: 6px;
  border: 1px solid var(--vp-primary-border);
  border-radius: var(--vp-radius-medium);
  background: var(--vp-surface) !important;
  box-shadow: var(--vp-shadow-focus);
}

.vp-product-editor {
  margin-top: 14px;
  border-top: 1px solid var(--vp-border);
  padding-top: 13px;
}

.vp-product-editor__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.vp-product-editor__field {
  min-width: 0;
}

.vp-product-editor__label {
  display: block;
  margin-bottom: 5px;
  color: var(--vp-text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.vp-product-editor__input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--vp-border-strong);
  border-radius: var(--vp-radius-small);
  outline: none;
  background: var(--vp-surface);
  padding: 7px 8px;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}

.vp-product-editor__input:focus {
  font-size: 16px;
  border-color: var(--vp-primary);
  box-shadow: 0 0 0 3px var(--vp-primary-soft);
}

.vp-product-editor__price-result {
  min-height: 18px;
  margin-top: 4px;
  color: var(--vp-text-muted);
  font-size: 10px;
  text-align: center;
}

.vp-product-editor__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.vp-product-editor__button {
  min-height: 38px;
  border-radius: var(--vp-radius-small);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
}

.vp-product-editor__button--cancel {
  border: 1px solid var(--vp-border);
  background: var(--vp-surface);
  color: var(--vp-text-secondary);
}

.vp-product-editor__button--save {
  border: 1px solid var(--vp-primary);
  background: var(--vp-primary);
  color: #fff;
}

.vp-product-editor__price-hint {
  margin-top: 5px;
  color: var(--vp-text-muted);
  font-size: 10px;
  line-height: 1.35;
  text-align: left;
}

.vp-product-editor__price-result {
  min-height: 0;
  margin-top: 3px;
  color: var(--vp-primary);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
}

@media (max-width: 420px) {
  .vp-product-editor__grid {
    gap: 7px;
  }

  .vp-product-editor__input {
    padding-right: 5px;
    padding-left: 5px;
  }
}

/* =========================
   Review View
========================= */

.vp-review-view {
  padding-bottom: 18px;
}

.vp-review-header {
  margin-bottom: 14px;
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-surface);
  padding: 18px;
  box-shadow: var(--vp-shadow);
}

.vp-review-header__eyebrow {
  margin-bottom: 4px;
  color: var(--vp-primary);
  font-size: 13px;
  font-weight: 700;
}

.vp-review-header__title {
  font-size: 22px;
  font-weight: 750;
  line-height: 1.35;
}

.vp-review-header__description {
  margin-top: 5px;
  color: var(--vp-text-secondary);
  font-size: 13px;
  line-height: 1.5;
}


/* =========================
   Review Sections
========================= */

.vp-review-section {
  margin-top: 14px;
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-surface);
  padding: 15px 16px;
  box-shadow: var(--vp-shadow);
}

.vp-review-section__title {
  margin-bottom: 11px;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.4;
}


/* =========================
   Review Order Info
========================= */

.vp-review-info {
  display: grid;
  gap: 8px;
}

.vp-review-info__row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.vp-review-info__label {
  color: var(--vp-text-secondary);
  font-size: 13px;
}

.vp-review-info__value {
  min-width: 0;
  color: var(--vp-text);
  font-size: 14px;
  text-align: right;
  overflow-wrap: anywhere;
}


/* =========================
   Review Products
========================= */

.vp-review-product-list {
  overflow: hidden;
  margin: 0 -16px -15px;
  border-top: 1px solid var(--vp-border);
}

.vp-review-product {
  padding: 12px 16px 11px;
  background: var(--vp-row-even);
}

.vp-review-product:nth-child(even) {
  background: var(--vp-row-odd);
}

.vp-review-product__top {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 12px;
  align-items: baseline;
}

.vp-review-product__name {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.vp-review-product__quantity {
  color: var(--vp-text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.vp-review-product__price-line {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 12px;
  align-items: baseline;
  margin-top: 4px;
}

.vp-review-product__unit-price {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--vp-text-secondary);
}

.vp-review-product__unit-price-number {
  font-size: 12px;
  font-weight: 600;
}

.vp-review-product__unit-price-unit {
  color: var(--vp-text-muted);
  font-size: 10px;
}

.vp-review-product__total {
  color: var(--vp-text);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.vp-review-product__free {
  margin-top: 4px;
  color: var(--vp-primary);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.vp-review-product__free strong {
  font-weight: 700;
}


/* =========================
   Review Notes
========================= */

.vp-review-note {
  color: var(--vp-text-secondary);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}


/* =========================
   Review Total
========================= */

.vp-review-total {
  display: grid;
  gap: 11px;
  margin-top: 14px;
  border: 1px solid var(--vp-primary-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-primary-soft);
  padding: 15px 16px;
}

.vp-review-total__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: var(--vp-text-secondary);
  font-size: 14px;
}

.vp-review-total__row strong {
  color: var(--vp-text);
  font-size: 15px;
}

.vp-review-total__row--grand {
  border-top: 1px solid var(--vp-primary-border);
  padding-top: 11px;
  color: var(--vp-text);
  font-weight: 700;
}

.vp-review-total__row--grand strong {
  color: var(--vp-primary);
  font-size: 20px;
  font-weight: 800;
}


/* =========================
   Review Actions
========================= */

.vp-review-actions {
  display: grid;
  grid-template-columns:
    minmax(0, 0.85fr)
    minmax(0, 1.15fr);

  gap: 9px;
  margin-top: 14px;
}

.vp-review-actions .vp-button {
  width: 100%;
}

.vp-button--secondary {
  border: 1px solid var(--vp-border);
  background: var(--vp-surface);
  color: var(--vp-text-secondary);
}

.vp-button--secondary:hover {
  border-color: var(--vp-border-strong);
  background: var(--vp-row-odd);
}


/* =========================
   Review Mobile
========================= */

@media (max-width: 560px) {
  .vp-review-header {
    padding: 16px 15px;
  }

  .vp-review-header__title {
    font-size: 21px;
  }

  .vp-review-section {
    padding-right: 14px;
    padding-left: 14px;
  }

  .vp-review-info__row {
    grid-template-columns:
      110px
      minmax(0, 1fr);
  }

  .vp-review-product-list {
    margin-right: -14px;
    margin-left: -14px;
  }

  .vp-review-product {
    padding-right: 14px;
    padding-left: 14px;
  }

  .vp-review-actions {
    grid-template-columns: 1fr;
  }
}

/* =========================
   Cancel View
========================= */

.vp-cancel-view {
  padding-bottom: 18px;
}

.vp-cancel-header {
  margin-bottom: 14px;
  border: 1px solid var(--vp-danger-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-surface);
  padding: 18px;
  box-shadow: var(--vp-shadow);
}

.vp-cancel-header__eyebrow {
  margin-bottom: 4px;
  color: var(--vp-danger);
  font-size: 13px;
  font-weight: 700;
}

.vp-cancel-header__title {
  color: var(--vp-danger);
  font-size: 22px;
  font-weight: 750;
  line-height: 1.35;
}

.vp-cancel-header__description {
  margin-top: 5px;
  color: var(--vp-text-secondary);
  font-size: 13px;
  line-height: 1.5;
}


/* =========================
   Cancel Reason
========================= */

.vp-cancel-section {
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius-large);
  background: var(--vp-surface);
  padding: 16px;
  box-shadow: var(--vp-shadow);
}

.vp-cancel-reason__label {
  display: block;
  margin-bottom: 7px;
  color: var(--vp-text);
  font-size: 14px;
  font-weight: 700;
}

.vp-cancel-reason__input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 120px;

  border: 1px solid var(--vp-border-strong);
  border-radius: var(--vp-radius-medium);
  outline: none;

  background: var(--vp-surface);
  padding: 11px 12px;

  color: var(--vp-text);
  font-size: 15px;
  line-height: 1.55;
}

.vp-cancel-reason__input::placeholder {
  color: var(--vp-text-muted);
}

.vp-cancel-reason__input:focus {
  border-color: var(--vp-danger);
  box-shadow:
    0 0 0 3px
    var(--vp-danger-soft);
}

.vp-cancel-reason__error {
  margin-top: 7px;
  color: var(--vp-danger);
  font-size: 12px;
  line-height: 1.4;
}


/* =========================
   Cancel Actions
========================= */

.vp-cancel-actions {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1fr);

  gap: 9px;
  margin-top: 14px;
}

.vp-cancel-actions .vp-button {
  width: 100%;
}

.vp-button--danger {
  border: 1px solid var(--vp-danger);
  background: var(--vp-danger);
  color: #ffffff;
}

.vp-button--danger:hover {
  background: var(--vp-danger-hover);
}

.vp-button--danger:active {
  background: var(--vp-danger-hover);
}


/* =========================
   Cancel Mobile
========================= */

@media (max-width: 560px) {
  .vp-cancel-header {
    padding: 16px 15px;
  }

  .vp-cancel-header__title {
    font-size: 21px;
  }

  .vp-cancel-section {
    padding: 14px;
  }

  .vp-cancel-actions {
    grid-template-columns: 1fr;
  }
}