.order-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1090;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.order-sidebar-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.order-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: clamp(340px, 35vw, 460px);
  max-width: 100vw;
  height: 100vh;
  background: var(--surface-primary, #fff);
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  box-shadow: -24px 0 40px rgba(2, 6, 23, 0.2);
  display: flex;
  flex-direction: column;
}

.order-sidebar.is-open {
  transform: translateX(0);
}

.order-sidebar__header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px;
  background: var(--surface-primary, #fff);
  border-bottom: 1px solid #e2e8f0;
}

.order-sidebar__header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-sidebar__edit-btn {
  border: 1px solid transparent;
  background: var(--brand-primary, #2563eb);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.order-sidebar__edit-btn svg {
  width: 19px;
  height: 19px;
}

.order-sidebar__edit-btn:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28);
}

.order-sidebar__edit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.order-sidebar__edit-btn:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.order-sidebar__title {
  margin: 0;
  font-size: clamp(2rem, 1.2rem + 1.4vw, 2.2rem);
  line-height: 1.2;
}

.order-sidebar__meta {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.order-sidebar__status {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 700;
  font-size: 12px;
}

.order-sidebar__close {
  border: 1px solid transparent;
  background: transparent;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #0f172a;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.order-sidebar__close:hover {
  background: #f1f5f9;
}

.order-sidebar__close:focus-visible,
.order-sidebar__tracking-link:focus-visible,
.resi-actions .btn:focus-visible,
.order-sidebar__content input:focus-visible,
.order-sidebar__content select:focus-visible,
.order-sidebar__content button:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.order-sidebar__content {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.order-sidebar__card {
  border: 1px solid #dbe6fb;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05);
}

.card {
  border: 1px solid #dbe2ea;
  border-radius: 14px;
  background: #fff;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.section-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4f6786;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.section-title--between {
  justify-content: space-between;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: #0f172a;
}

.field > span {
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #d5dde8;
  border-radius: 12px;
  background: #f9fafb;
  color: #0f172a;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
}

.field textarea {
  min-height: 116px;
  resize: vertical;
}

.field--readonly {
  border: 1px solid #d5dde8;
  border-radius: 12px;
  background: #f9fafb;
  padding: 12px 14px;
  min-height: 48px;
  display: flex;
  align-items: center;
  color: #0f172a;
  font-weight: 500;
}

.field--readonly.multiline {
  align-items: flex-start;
  min-height: 74px;
}

.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-sidebar__card h3 {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.3;
}

.order-sidebar__details-grid {
  display: grid;
  gap: 10px;
}

.order-sidebar__row {
  display: grid;
  grid-template-columns: minmax(130px, 42%) minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  font-size: 14px;
}

.order-sidebar__row > span {
  color: #0f172a;
  font-weight: 600;
}

.order-sidebar__row > strong {
  text-align: right;
  color: #1e293b;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.resi-field {
  margin-top: 12px;
}

.resi-field .field-label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.resi-field input {
  width: 100%;
}

.order-sidebar__hint,
.order-sidebar__helper-text {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.order-sidebar__hint {
  color: #64748b;
}

.order-sidebar__helper-text {
  color: #b45309;
}

.resi-actions {
  margin-top: 12px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.resi-actions .btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.resi-actions [data-sidebar-copy-resi] {
  flex: 0 0 auto;
  padding-inline: 14px;
}

.resi-actions [data-sidebar-track-link] {
  flex: 1 1 170px;
}

.order-sidebar__tracking-link[aria-disabled='true'],
.order-sidebar__tracking-link:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.order-sidebar__item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.link-button {
  border: 0;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.edit-order-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 0;
}

.edit-order-item:last-child {
  border-bottom: 0;
}

.edit-order-item__meta {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal.edit-order-modal {
  width: min(920px, 95vw);
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal__header,
.modal__footer {
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal__header h2 {
  margin: 0;
  font-size: 42px;
}

.modal__close-btn {
  border: 1px solid #dbe2ea;
  background: #eef2f7;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.modal__body {
  padding: 20px 24px;
  overflow: auto;
  display: grid;
  gap: 16px;
}

.modal__footer {
  margin-top: auto;
  border-top: 1px solid #e2e8f0;
  border-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  bottom: 0;
  background: #fff;
}

.modal__footer-actions {
  display: flex;
  gap: 10px;
}

.edit-total {
  margin: 0;
  color: #64748b;
  font-size: 30px;
}

.edit-total strong {
  color: #0f172a;
}

.order-sidebar__item:last-child {
  border-bottom: none;
}

.order-sidebar__item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  background: #e2e8f0;
}

.order-sidebar__item-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.order-sidebar__item-info strong,
.order-sidebar__item-info div {
  overflow-wrap: anywhere;
}

.order-sidebar__item-total {
  margin-top: 4px;
}

.order-sidebar__form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.order-sidebar__form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.order-sidebar__form .full {
  grid-column: 1 / -1;
}

@media (max-width: 767px) {
  .order-sidebar {
    width: 100vw;
  }

  .order-sidebar__header {
    padding: 16px;
  }

  .order-sidebar__content,
  .order-sidebar__card {
    padding: 14px;
  }

  .order-sidebar__row {
    grid-template-columns: minmax(120px, 46%) minmax(0, 1fr);
  }

  .order-sidebar__form {
    grid-template-columns: 1fr;
  }

  .resi-actions {
    flex-direction: column;
  }

  .resi-actions [data-sidebar-copy-resi],
  .resi-actions [data-sidebar-track-link] {
    width: 100%;
    flex: 1 1 auto;
  }

  .order-sidebar__header-actions {
    flex-direction: column-reverse;
    align-items: flex-end;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal.edit-order-modal {
    max-height: calc(100vh - 24px);
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding: 14px;
  }

  .modal__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .modal__footer-actions {
    justify-content: flex-end;
  }

  .edit-total {
    font-size: 24px;
  }
}


.order-shipping-panel {
  display: grid;
  gap: 14px;
}

.order-shipping-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.order-shipping-panel__label {
  margin: 0;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.order-shipping-panel__order-id {
  margin: 4px 0 0;
  font-size: clamp(1.7rem, 1.1rem + 1vw, 2rem);
  line-height: 1.2;
}

.order-shipping-panel__date {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 14px;
}

.order-shipping-panel__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: #d1fae5;
  color: #15803d;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.shipping-card {
  border: 1px solid #d8dff3;
  border-radius: 14px;
  background: #f7f9ff;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.shipping-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shipping-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #d8e1f3;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  flex: 0 0 auto;
}

.shipping-card__icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.shipping-card__courier p {
  margin: 0;
}

.shipping-card__courier [data-sidebar-courier-name] {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
  color: #1e293b;
}

.shipping-card__courier [data-sidebar-service-name] {
  margin-top: 2px;
  color: #64748b;
  font-size: 14px;
}

.shipping-card__resi {
  background: #fff;
  border: 1px solid #dfe5f3;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.shipping-card__resi-info {
  min-width: 0;
  flex: 1 1 220px;
}

.shipping-card__resi-label {
  display: block;
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.shipping-card__resi-input {
  margin-top: 4px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: #2563eb;
  font-weight: 700;
  font-size: 17px;
}

.shipping-card__resi-input::placeholder {
  color: #93c5fd;
}

.shipping-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 1 auto;
  flex-wrap: wrap;
}

.shipping-card__copy {
  border: 0;
  background: transparent;
  color: #475569;
  min-height: 38px;
  padding: 6px 8px;
  border-radius: 8px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.shipping-card__copy:hover {
  background: #f1f5f9;
}

.shipping-card__copy-feedback {
  font-size: 12px;
  color: #15803d;
  font-weight: 600;
}

.order-sidebar__tracking-link {
  min-height: 38px;
  padding-inline: 16px;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .order-shipping-panel__header {
    align-items: center;
  }

  .order-shipping-panel__status {
    align-self: flex-start;
  }

  .shipping-card__resi {
    align-items: flex-start;
  }

  .shipping-card__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .order-sidebar__tracking-link {
    margin-left: auto;
  }
}
