.orders-account-banner,
.orders-toolbar,
.orders-section-header,
.orders-queue-head,
.orders-chip-row,
.orders-status-form,
.orders-request-grid,
.orders-product-picker,
.orders-product-row,
.orders-product-identity,
.orders-choice,
.orders-summary-list > div,
.orders-line-items li {
  display: flex;
  align-items: center;
}

.orders-account-banner,
.orders-toolbar,
.orders-section-header,
.orders-queue-head {
  justify-content: space-between;
  gap: 1rem;
}

.orders-account-banner,
.orders-toolbar,
.orders-request-grid,
.orders-history,
.orders-queue {
  margin-top: 1rem;
}

.orders-account-banner {
  background: #3c2537;
  color: #fff5ed;
}

.orders-account-banner .eyebrow,
.orders-account-banner .muted {
  color: #f2d2ba;
}

.orders-account-banner h2 {
  margin: .15rem 0 .25rem;
}

.orders-toolbar {
  align-items: end;
  flex-wrap: wrap;
}

.orders-toolbar label,
.orders-search-field {
  min-width: min(100%, 220px);
}

.orders-queue {
  display: grid;
  gap: .8rem;
}

.orders-queue-card,
.orders-history-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(15px, 2vw, 22px);
}

.orders-chip-row {
  gap: .45rem;
  flex-wrap: wrap;
}

.orders-chip-row strong {
  font-size: 1.05rem;
}

.orders-total {
  font-size: 1.15rem;
  white-space: nowrap;
}

.orders-item-summary {
  margin: .85rem 0;
  color: var(--ink);
}

.orders-details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: .65rem 0;
}

.orders-details summary {
  font-size: .85rem;
}

.orders-details-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: .75rem;
  margin: .8rem 0;
}

.orders-details-list div {
  min-width: 0;
}

.orders-details-list dt {
  color: var(--muted);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.orders-details-list dd {
  margin: .2rem 0 0;
  overflow-wrap: anywhere;
}

.orders-line-items {
  display: grid;
  gap: .4rem;
  margin: .8rem 0 0;
  padding: 0;
  list-style: none;
}

.orders-line-items li {
  justify-content: space-between;
  gap: .8rem;
  border-top: 1px dashed var(--line);
  padding-top: .4rem;
  font-size: .86rem;
}

.orders-status-form {
  gap: .6rem;
  padding-top: .85rem;
  flex-wrap: wrap;
}

.orders-status-form label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
}

.orders-status-form select {
  min-width: 145px;
}

.orders-request-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  gap: 1rem;
}

.orders-request-grid > .card {
  min-width: 0;
}

.orders-product-picker {
  margin-top: 0;
}

.orders-product-picker .orders-section-header {
  align-items: end;
}

.orders-product-list {
  display: grid;
  gap: .35rem;
  max-height: 660px;
  overflow: auto;
  padding-right: .2rem;
}

.orders-product-row {
  justify-content: space-between;
  gap: .8rem;
  padding: .62rem .5rem;
  border-bottom: 1px solid var(--line);
}

.orders-product-row:last-child {
  border-bottom: 0;
}

.orders-product-identity {
  min-width: 0;
  flex: 1 1 auto;
  gap: .65rem;
}

.orders-product-identity img,
.orders-product-placeholder {
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 8px;
  background: #f2e5e7;
}

.orders-product-placeholder {
  display: grid;
  place-items: center;
  color: var(--primary);
}

.orders-product-identity strong,
.orders-product-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orders-product-identity small {
  color: var(--muted);
  font-size: .76rem;
}

.orders-product-price {
  color: var(--primary-dark);
  font-weight: 700;
  white-space: nowrap;
}

.orders-product-unavailable {
  background: #fbf8f5;
  opacity: .75;
}

.orders-qty-label {
  min-width: 74px;
  width: 74px;
  font-size: .72rem;
}

.orders-qty-label input {
  width: 74px;
  padding: .42rem;
}

.orders-choice-group {
  display: grid;
  gap: .5rem;
  margin: .85rem 0 1rem;
}

.orders-choice {
  align-items: flex-start;
  gap: .65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .7rem;
}

.orders-choice input {
  margin-top: .2rem;
}

.orders-choice span {
  display: grid;
  gap: .1rem;
}

.orders-choice small {
  color: var(--muted);
}

.orders-submit-card {
  align-self: start;
  position: sticky;
  top: 88px;
}

.orders-summary-list {
  display: grid;
  gap: .7rem;
  margin: 1rem 0;
}

.orders-summary-list > div {
  justify-content: space-between;
  gap: .8rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: .55rem;
}

.orders-summary-list dt {
  color: var(--muted);
}

.orders-summary-list dd {
  margin: 0;
  font-weight: 750;
}

.orders-disclaimer {
  color: var(--muted);
  font-size: .8rem;
  margin: 1rem 0;
}

.btn-wide {
  width: 100%;
}

.orders-history-list {
  display: grid;
  gap: .65rem;
}

.orders-history-card p {
  margin-top: .7rem;
  color: var(--muted);
  font-size: .88rem;
}

.badge-neutral {
  background: #eee8e4;
  color: #5b4f4d;
}

.orders-access-card {
  max-width: 670px;
}

.orders-access-card h2 {
  margin: .75rem 0 .4rem;
}

.orders-access-heading {
  display: grid;
  gap: .15rem;
}

@media (max-width: 900px) {
  .orders-request-grid {
    grid-template-columns: 1fr;
  }

  .orders-submit-card {
    position: static;
  }
}

@media (max-width: 610px) {
  .orders-product-row {
    align-items: flex-end;
    flex-wrap: wrap;
  }

  .orders-product-identity {
    min-width: calc(100% - 1px);
  }

  .orders-section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .orders-section-header .orders-search-field {
    width: 100%;
  }
}

/* Focused order view: the queue stays compact while one order gets a clear
 * handoff surface for owners and a useful tracking view for customers. */
.orders-card-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: .85rem;
  padding-top: .85rem;
}

.orders-card-actions .orders-status-form {
  border-top: 0;
  margin: 0;
  padding: 0;
}

.orders-open-link {
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: none;
  text-underline-offset: 3px;
}

.orders-open-link:hover,
.orders-open-link:focus-visible {
  text-decoration: underline;
}

.orders-detail-panel {
  margin-top: 1rem;
  scroll-margin-top: 1rem;
  outline: none;
}

.orders-detail-panel.is-focused {
  border-color: #d7a16c;
  box-shadow: 0 0 0 3px #e8c8aa66, var(--shadow);
}

.orders-detail-header,
.orders-detail-ref,
.orders-detail-section-heading,
.orders-message-head,
.orders-history-meta,
.orders-message-actions,
.orders-detail-total {
  display: flex;
  align-items: center;
}

.orders-detail-header,
.orders-detail-section-heading,
.orders-history-meta,
.orders-message-actions,
.orders-detail-total {
  justify-content: space-between;
  gap: 1rem;
}

.orders-detail-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.orders-detail-header h2 {
  margin: .15rem 0 .35rem;
}

.orders-detail-ref {
  gap: .45rem;
  flex-wrap: wrap;
}

.orders-detail-close {
  flex: 0 0 auto;
}

.orders-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 1rem;
  margin-top: 1rem;
}

.orders-detail-main,
.orders-detail-side {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.orders-detail-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfb;
  padding: 1rem;
}

.orders-detail-section h3 {
  margin: .15rem 0 0;
  font-size: 1rem;
}

.orders-detail-section-heading {
  align-items: flex-start;
  margin-bottom: .85rem;
}

.orders-status-form-detail {
  padding-top: 0;
  justify-content: flex-end;
}

.orders-progress {
  display: flex;
  overflow-x: auto;
  list-style: none;
  margin: 0;
  padding: .35rem .15rem .15rem;
  scrollbar-width: thin;
}

.orders-progress-step {
  position: relative;
  display: grid;
  flex: 1 0 88px;
  justify-items: center;
  gap: .45rem;
  min-width: 88px;
  color: var(--muted);
  font-size: .7rem;
  text-align: center;
}

.orders-progress-step:not(:last-child)::after {
  position: absolute;
  top: 13px;
  left: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 2px;
  background: var(--line);
  content: '';
}

.orders-progress-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
}

.orders-progress-step.is-complete,
.orders-progress-step.is-current {
  color: var(--primary-dark);
}

.orders-progress-step.is-complete .orders-progress-dot,
.orders-progress-step.is-current .orders-progress-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.orders-progress-step.is-complete::after {
  background: var(--primary);
}

.orders-progress-step.is-current {
  font-weight: 800;
}

.orders-progress-step.is-cancelled {
  color: var(--error, #8b3348);
}

.orders-progress-step.is-cancelled .orders-progress-dot {
  border-color: #b85a6c;
  background: #fff1f3;
  color: #8b3348;
}

.orders-timeline,
.orders-message-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.orders-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: .7rem;
  min-height: 66px;
}

.orders-timeline-item:not(:last-child)::before {
  position: absolute;
  top: 16px;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--line);
  content: '';
}

.orders-timeline-marker {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  margin-top: .12rem;
  border: 3px solid #ead0b9;
  border-radius: 50%;
  background: var(--card);
}

.orders-timeline-copy {
  min-width: 0;
  padding-bottom: .85rem;
}

.orders-timeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .7rem;
}

.orders-timeline-head time,
.orders-message-head time,
.orders-message small,
.orders-history-meta span {
  color: var(--muted);
  font-size: .74rem;
}

.orders-timeline-copy small {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
}

.orders-timeline-copy p {
  margin: .35rem 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: .84rem;
}

.orders-detail-empty {
  border: 1px dashed var(--line);
  border-radius: 9px;
  padding: .8rem;
  color: var(--muted);
  font-size: .84rem;
}

.orders-facts-list {
  display: grid;
  gap: .7rem;
  margin: 0;
}

.orders-facts-list div {
  display: grid;
  gap: .15rem;
}

.orders-facts-list dt {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.orders-facts-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: .88rem;
}

.orders-facts .orders-line-items {
  margin-top: 1rem;
}

.orders-detail-total {
  border-top: 1px solid var(--line);
  margin-top: .85rem;
  padding-top: .85rem;
  color: var(--muted);
  font-size: .82rem;
}

.orders-detail-total strong {
  color: var(--primary-dark);
  font-size: 1.05rem;
}

.orders-message-list {
  display: grid;
  gap: .55rem;
  margin-bottom: .9rem;
}

.orders-message {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  padding: .7rem;
}

.orders-message-head {
  align-items: baseline;
  flex-wrap: wrap;
  gap: .45rem;
}

.orders-message-head time {
  margin-left: auto;
}

.orders-message p {
  margin: .45rem 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: .84rem;
}

.orders-message-form label {
  display: grid;
  gap: .35rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.orders-message-form textarea {
  min-height: 84px;
  resize: vertical;
}

.orders-message-actions {
  align-items: flex-end;
  margin-top: .55rem;
}

.orders-message-actions small {
  max-width: 25rem;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.4;
}

.orders-history-meta {
  align-items: center;
  margin-top: .85rem;
}

@media (max-width: 900px) {
  .orders-detail-grid {
    grid-template-columns: 1fr;
  }

  .orders-detail-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 610px) {
  .orders-detail-header,
  .orders-detail-section-heading,
  .orders-message-actions,
  .orders-history-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .orders-detail-close,
  .orders-status-form-detail,
  .orders-message-actions .btn {
    width: 100%;
  }

  .orders-status-form-detail {
    align-items: stretch;
  }

  .orders-status-form-detail label,
  .orders-status-form-detail select {
    width: 100%;
  }

  .orders-detail-side {
    grid-template-columns: 1fr;
  }

  .orders-timeline-head {
    align-items: flex-start;
    flex-direction: column;
    gap: .2rem;
  }

  .orders-message-head time {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orders-detail-panel {
    scroll-behavior: auto;
  }
}
