/* Order history & order details — card layout, mobile-first */

.orders-page,
.order-page {
  background: #f6f7fb;
  padding: 18px 0 30px;
}

.orders-shell,
.order-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 14px;
}

.orders-head,
.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.orders-title,
.order-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #111827;
}

.order-btn {
  height: 38px;
  border-radius: 10px;
  border: 0;
  background: #0f9a6d;
  color: #fff;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.12s ease;
}

.order-btn:hover {
  background: #0c7d59;
  color: #fff;
}

.order-btn.order-btn-secondary {
  background: #eef2f7;
  color: #1f2937;
}

.order-btn.order-btn-secondary:hover {
  background: #e4e7ec;
  color: #111827;
}

.order-btn:focus-visible {
  outline: 2px solid #0f9a6d;
  outline-offset: 2px;
}

/* --- Order history: clickable cards --- */

.orders-list {
  display: grid;
  gap: 10px;
}

@media (min-width: 720px) {
  .orders-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

.orders-list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.04);
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.orders-list-card:hover {
  border-color: #c7d7ee;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
  transform: translateY(-1px);
}

.orders-list-card:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.orders-list-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.orders-list-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.orders-list-card-id {
  font-size: 0.82rem;
  font-weight: 700;
  color: #667085;
  letter-spacing: 0.02em;
  min-width: 0;
  word-break: break-word;
}

.orders-update-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: #ef4444;
  vertical-align: middle;
}

.orders-list-card-date {
  font-size: 0.88rem;
  color: #475467;
  white-space: nowrap;
  flex-shrink: 0;
}

.orders-list-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.orders-chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff4ff;
  color: #1d4ed8;
  border: 1px solid #c7d7fe;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
}

.orders-list-card-mid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.orders-list-thumb-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.orders-list-thumb-cell {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.orders-list-thumb-img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  border: 1px solid #e8edf5;
  object-fit: cover;
  background: #fff;
  display: block;
}

.orders-list-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  border: 1px dashed #d6deea;
  color: #98a2b3;
  background: #f8fafc;
  font-size: 0.95rem;
}

.orders-list-thumb-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 44px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid #e8edf5;
  background: #f8fafc;
  font-size: 0.88rem;
  font-weight: 800;
  color: #667085;
}

.orders-list-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.orders-list-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
  flex-shrink: 0;
}

.orders-list-mode {
  font-size: 0.8rem;
  color: #667085;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-list-chevron {
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  color: #98a2b3;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-chip.is-paid {
  background: #ecfdf3;
  color: #027a48;
  border-color: #a6f4c5;
}

.status-chip.is-pending {
  background: #fff7ed;
  color: #b54708;
  border-color: #fed7aa;
}

.status-chip.is-neutral {
  background: #f2f4f7;
  color: #475467;
  border-color: #e4e7ec;
}

/* Статус замовлення (workflow) */
.status-chip.status-chip--workflow.status-chip--pending_approval {
  background: #fffaeb;
  color: #b54708;
  border-color: #fedf89;
}

.status-chip.status-chip--workflow.status-chip--clarification {
  background: #f4f3ff;
  color: #5925dc;
  border-color: #d9d6fe;
}

.status-chip.status-chip--workflow.status-chip--approved {
  background: #ecfdf3;
  color: #027a48;
  border-color: #a6f4c5;
}

.status-chip.status-chip--workflow.status-chip--in_progress {
  background: #eff8ff;
  color: #175cd3;
  border-color: #b2ddff;
}

.status-chip.status-chip--workflow.status-chip--awaiting_client_payment {
  background: #f0fdf9;
  color: #107569;
  border-color: #5fe9d0;
}

.status-chip.status-chip--workflow.status-chip--packed {
  background: #eef4ff;
  color: #1d4ed8;
  border-color: #c7d7fe;
}

.status-chip.status-chip--workflow.status-chip--shipped {
  background: #eef4ff;
  color: #3538cd;
  border-color: #c7d7fe;
}

.status-chip.status-chip--workflow.status-chip--completed {
  background: #ecfdf3;
  color: #05603a;
  border-color: #75e0a7;
}

.status-chip.status-chip--workflow.status-chip--rejected {
  background: #fef3f2;
  color: #b42318;
  border-color: #fecdca;
}

.status-chip.status-chip--workflow.status-chip--cancelled {
  background: #f2f4f7;
  color: #667085;
  border-color: #d0d5dd;
}

/* Статус оплати */
.status-chip.status-chip--payment.status-chip--none {
  background: #f2f4f7;
  color: #475467;
  border-color: #e4e7ec;
}

.status-chip.status-chip--payment.status-chip--awaiting {
  background: #fff7ed;
  color: #b54708;
  border-color: #fed7aa;
}

.status-chip.status-chip--payment.status-chip--verifying {
  background: #eef4ff;
  color: #1d4ed8;
  border-color: #c7d7fe;
}

.status-chip.status-chip--payment.status-chip--paid {
  background: #ecfdf3;
  color: #027a48;
  border-color: #a6f4c5;
}

.order-line--chips {
  align-items: center;
}

.order-line--chips .status-chip {
  flex-shrink: 0;
  text-align: center;
}

.order-comment {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eef2f7;
  grid-column: 1 / -1;
}

.order-comment-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #667085;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.order-comment-text {
  margin: 0;
  font-size: 0.9rem;
  color: #101828;
  line-height: 1.45;
  white-space: pre-wrap;
}

.order-shipping-block {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  grid-column: 1 / -1;
}

.order-line--stack {
  align-items: flex-start;
}

.order-line--stack > span:first-child {
  padding-top: 2px;
}

.order-shipping-text {
  text-align: right;
  font-size: 0.88rem;
  font-weight: 600;
  color: #101828;
  line-height: 1.45;
  max-width: min(100%, 20rem);
}

.order-chat-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  margin-bottom: 12px;
  padding-right: 2px;
}

.order-chat-notice {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eff4ff;
  color: #1d4ed8;
  border: 1px solid #c7d7fe;
  font-size: 0.84rem;
  font-weight: 600;
}

.order-chat-msg {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid #e4e7ec;
}

.order-chat-msg.is-client {
  background: #eff4ff;
  border-color: #c7d7fe;
}

.order-chat-msg.is-manager {
  background: #f8fafc;
}

.order-chat-msg p {
  margin: 0;
  font-size: 0.88rem;
  color: #101828;
  line-height: 1.4;
}

.order-chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: #667085;
}

.order-chat-empty {
  margin: 0;
  color: #667085;
  font-size: 0.88rem;
}

.order-chat-form {
  border-top: 1px solid #eef2f7;
  padding-top: 10px;
}

.order-chat-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #1d4ed8;
  font-weight: 700;
}

.order-chat-link-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
}

.order-chat-list--page {
  max-height: 520px;
}

.orders-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: #667085;
  font-size: 0.95rem;
  background: #fff;
  border: 1px dashed #e4e7ec;
  border-radius: 16px;
}

.order-sidebar > .order-card + .order-card {
  margin-top: 12px;
}

/* --- Order details layout --- */

.order-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 992px) {
  .order-layout {
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 14px;
    align-items: start;
  }
}

.order-card {
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
  overflow: hidden;
}

.order-card-head {
  padding: 13px 15px 10px;
  border-bottom: 1px solid #eef2f7;
  font-size: 0.92rem;
  font-weight: 800;
  color: #111827;
}

.order-card-head--with-chat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-head-chat-btn {
  position: relative;
  min-height: 32px;
  padding: 0 10px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #d6deea;
  background: #fff;
  color: #344054;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.order-head-chat-btn:hover {
  border-color: #b8c6dd;
  color: #1f2937;
}

.order-head-chat-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
}

.order-card-body {
  padding: 14px 15px;
}

.order-lines {
  display: grid;
  gap: 8px;
}

.order-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
  color: #475467;
}

.order-line strong {
  color: #111827;
  text-align: right;
}

/* Line items: clickable product cards */

.order-items-list {
  display: grid;
  gap: 10px;
  padding: 12px 14px 16px;
}

.order-item-card {
  display: block;
  padding: 14px 14px;
  background: #fafbfc;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.order-item-card:hover {
  border-color: #d0d9e6;
  background: #fff;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06);
}

.order-item-card:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.order-item-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.order-item-card-main {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
}

.order-item-thumb-wrap {
  width: 64px;
  height: 64px;
}

.order-item-thumb,
.order-item-thumb-fallback {
  width: 100%;
  height: 100%;
  border-radius: 12px;
}

.order-item-thumb {
  object-fit: cover;
  border: 1px solid #e5e7eb;
  background: #fff;
}

.order-item-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #d6deea;
  color: #98a2b3;
  background: #f8fafc;
}

.order-item-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
}

.order-item-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

.order-item-meta {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: #667085;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.order-item-row span.lbl {
  color: #98a2b3;
  font-weight: 600;
  margin-right: 6px;
}

.order-item-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: #98a2b3;
  display: flex;
  align-items: center;
  gap: 4px;
}

.order-item-hint i {
  font-size: 0.7rem;
}

/* Desktop: compact table for line items (no horizontal scroll — full width) */

.order-items-table-wrap {
  display: none;
}

@media (min-width: 900px) {
  .order-items-list {
    display: none;
  }

  .order-items-table-wrap {
    display: block;
    overflow: visible;
  }

  .order-items-table {
    width: 100%;
    border-collapse: collapse;
  }

  .order-items-table th,
  .order-items-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #eef2f7;
    font-size: 0.9rem;
    text-align: left;
  }

  .order-items-table th {
    background: #f8fafc;
    color: #667085;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.72rem;
    font-weight: 700;
  }

  .order-items-table tr:last-child td {
    border-bottom: 0;
  }

  .order-items-table td.num {
    text-align: right;
    white-space: nowrap;
  }

  .order-items-table a {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
  }

  .order-items-table a:hover {
    text-decoration: underline;
  }

  .order-table-product {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .order-table-thumb-wrap {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .order-table-thumb,
  .order-table-thumb-fallback {
    width: 100%;
    height: 100%;
    border-radius: 10px;
  }

  .order-table-thumb {
    object-fit: cover;
    border: 1px solid #e5e7eb;
    background: #fff;
  }

  .order-table-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #d6deea;
    color: #98a2b3;
    background: #f8fafc;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
  }
}

/* Оплата на сторінці замовлення */
.order-pay-lead {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #475467;
}

.order-pay-muted {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: #667085;
}

.order-pay-liqpay {
  margin-bottom: 18px;
}

.order-pay-fop {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #eef2f7;
}

.order-pay-fop-title {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #344054;
}

/* Holubka warm palette harmonization */
.orders-page,
.order-page {
  background: var(--hk-base-50, #f6f2ee);
}

.orders-title,
.order-title,
.orders-list-price {
  color: var(--hk-text-primary, #2b2b2b);
}

.orders-list-card {
  border-color: var(--hk-base-200, #e4d8cc);
  box-shadow: 0 4px 16px rgba(43, 43, 43, 0.05);
}

.orders-list-card:hover {
  border-color: #d9c9b9;
  box-shadow: 0 10px 28px rgba(43, 43, 43, 0.09);
}

.orders-list-card:focus-visible {
  outline: 2px solid var(--hk-primary, #6b7a52);
}

.order-btn {
  background: var(--hk-primary, #6b7a52);
}

.order-btn:hover {
  background: var(--hk-primary-hover, #55633f);
}

.order-btn.order-btn-secondary {
  background: var(--hk-base-100, #efe7df);
  color: var(--hk-text-primary, #2b2b2b);
}

.orders-chat-badge {
  background: #f5ece3;
  color: var(--hk-accent-hover, #c38e5d);
  border-color: #ecd7c1;
}

.status-chip.is-paid {
  background: #e8f5e9;
  color: var(--hk-success, #4caf50);
  border-color: #cfead2;
}

.order-chat-notice,
.order-chat-msg.is-client {
  background: #f5ece3;
  border-color: #ecd7c1;
  color: var(--hk-accent-hover, #c38e5d);
}

.order-chat-link,
.order-items-table a {
  color: var(--hk-primary, #6b7a52);
}

.order-item-card:focus-visible {
  outline: 2px solid var(--hk-primary, #6b7a52);
}
