:root {
  --stw-form-primary: #0b4b9f;
  --stw-form-bright: #0d7bd8;
  --stw-form-secondary: #0d63c8;
  --stw-form-navy: #082e58;
  --stw-form-ink: #0a3975;
  --stw-form-text: #17324b;
  --stw-form-muted: #607a96;
  --stw-form-soft: #eaf8ff;
  --stw-form-line: #d6e5ef;
  --stw-form-danger: #ec1838;
}

.checkout-card {
  border-color: var(--stw-form-line);
  border-top: 3px solid var(--stw-form-primary);
  box-shadow: 0 8px 24px rgba(8, 46, 88, 0.07);
}

.section-title {
  position: relative;
  min-height: 26px;
  margin-bottom: 16px;
  padding-left: 13px;
  color: var(--stw-form-navy);
  font-size: 17px;
  line-height: 1.35;
}

.section-title::before {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--stw-form-bright), var(--stw-form-primary));
  content: '';
}

.field-label {
  margin-bottom: 6px;
  color: var(--stw-form-ink);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.checkout-fields {
  display: grid;
  gap: 14px;
}

.checkout-fields .form-grid-2 {
  gap: 14px 12px;
  margin: 0;
}

.checkout-fields .form-row-full {
  margin: 0;
}

.comem-input,
.comem-textarea,
.comem-select,
.search-select-trigger {
  border: 1px solid var(--stw-form-line);
  border-radius: 10px;
  background: #fbfdff;
  color: var(--stw-form-text);
  box-shadow: inset 0 1px 1px rgba(8, 46, 88, 0.025);
}

.comem-input,
.comem-select,
.search-select-trigger {
  height: 46px;
}

.comem-input {
  padding-inline: 13px;
}

.comem-textarea {
  min-height: 82px;
  padding: 11px 13px;
  line-height: 1.5;
}

.comem-input::placeholder,
.comem-textarea::placeholder,
.dropdown-search-input::placeholder {
  color: #8298ad;
  opacity: 1;
}

.comem-input:hover:not(:read-only),
.comem-textarea:hover,
.comem-select:hover,
.search-select-trigger:hover {
  border-color: #9fc3df;
}

.comem-input:focus,
.comem-textarea:focus,
.comem-select:focus,
.search-select-wrapper.open .search-select-trigger {
  border-color: var(--stw-form-bright);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 123, 216, 0.13);
}

.comem-input[readonly] {
  border-color: #c8ddec;
  background: #eef6fc;
  color: #496981;
  cursor: default;
}

.comem-input:-webkit-autofill,
.comem-input:-webkit-autofill:hover,
.comem-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--stw-form-text);
  -webkit-box-shadow: 0 0 0 1000px #fbfdff inset;
  transition: background-color 9999s ease-out;
}

.trigger-label {
  color: var(--stw-form-text);
  font-weight: 650;
}

.trigger-arrow {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  margin-left: 8px;
  color: var(--stw-form-primary);
}

.trigger-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-select-wrapper.open .trigger-arrow {
  color: var(--stw-form-primary);
}

.search-select-wrapper {
  min-width: 0;
}

.search-select-wrapper.open {
  z-index: 5;
}

.search-select-dropdown {
  top: calc(100% + 6px);
  width: 100%;
  min-width: 0;
  border-color: #afd0e7;
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(8, 46, 88, 0.16);
}

.search-input-box {
  padding: 10px;
  border-bottom-color: var(--stw-form-line);
  background: #f4faff;
}

.dropdown-search-input {
  height: 40px;
  border-color: var(--stw-form-line);
  border-radius: 8px;
  color: var(--stw-form-text);
  font-size: 13px;
}

.dropdown-search-input:focus {
  border-color: var(--stw-form-bright);
  box-shadow: 0 0 0 3px rgba(13, 123, 216, 0.11);
}

.dropdown-options-list {
  max-height: min(240px, 42vh);
  padding: 3px 0;
}

.dropdown-option {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 13px;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  border-radius: 0;
  background: #fff;
  color: var(--stw-form-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}

.dropdown-option:last-child {
  border-bottom: 0;
}

.dropdown-option:hover {
  background: var(--stw-form-soft);
  color: var(--stw-form-primary);
}

.dropdown-option.selected {
  background: #eaf5ff;
  color: var(--stw-form-primary);
  font-weight: 750;
}

.dropdown-option.selected::after {
  flex: 0 0 auto;
  color: var(--stw-form-primary);
  content: '✓';
}

.dropdown-option:focus-visible {
  position: relative;
  outline: 2px solid var(--stw-form-bright);
  outline-offset: -2px;
}

.comem-input.is-invalid,
.search-select-trigger.is-invalid {
  border-color: var(--stw-form-danger);
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(236, 24, 56, 0.10);
}

.field-error,
.checkout-feedback {
  color: #b3132d;
}

.checkout-payment-method {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--stw-form-line);
  border-radius: 12px;
  background: #fff;
}

.checkout-payment-method h2 {
  margin: 0 0 11px;
  color: var(--stw-form-navy);
  font-size: 14px;
  line-height: 1.35;
}

.checkout-payment-method__option {
  min-height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--stw-form-text);
  font-size: 13px;
}

.checkout-payment-method__badge {
  padding: 4px 6px;
  border-radius: 4px;
  background: #16a767;
  color: #fff;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}

.checkout-payment-method__option input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--stw-form-primary);
}

@media (max-width: 640px) {
  .stw-checkout-route .search-select-wrapper.open .search-select-dropdown {
    position: fixed;
    top: calc(128px + env(safe-area-inset-top, 0px));
    right: 14px;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    left: 14px;
    display: flex;
    width: calc(100vw - 28px);
    min-width: 0 !important;
    max-width: calc(100vw - 28px);
    max-height: none;
    flex-direction: column;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(8, 46, 88, 0.16);
  }

  .stw-checkout-route .search-select-wrapper.open .search-select-dropdown::before {
    flex: 0 0 auto;
    padding: 13px 13px 4px;
    color: var(--stw-form-navy);
    font-size: 15px;
    font-weight: 800;
  }

  #wrapProvince.open .search-select-dropdown::before {
    content: 'Chọn Tỉnh / Thành phố';
  }

  #wrapWard.open .search-select-dropdown::before {
    content: 'Chọn Phường / Xã';
  }

  .stw-checkout-route .search-select-wrapper.open .dropdown-options-list {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow-y: auto;
  }

  .checkout-card {
    border-top-width: 3px;
    border-radius: 12px;
  }

  .section-title {
    margin-bottom: 16px;
    font-size: 16px;
  }

  .form-grid-2,
  .form-row-full {
    margin-bottom: 0;
  }

  .checkout-fields,
  .checkout-fields .form-grid-2 {
    gap: 16px !important;
  }

  .comem-input,
  .comem-select,
  .search-select-trigger {
    min-height: 46px;
    font-size: 13px;
  }

  .comem-textarea {
    min-height: 86px;
    font-size: 13px;
  }
}
