/* ── checkout.css: /cart, /checkout, /account/orders/[id] ── */

/* ── Shared ── */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b6660;
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 16px;
}
.back:hover { color: #1a1d24; }
.muted  { color: #9b9591; }
.small  { font-size: 12px; }

/* ── /cart ── */
.cart { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.cart h1 { font-size: 22px; font-weight: 600; margin-bottom: 16px; }

.cart-empty { text-align: center; padding: 60px 20px; }
.cart-empty p { color: #9b9591; margin-bottom: 16px; }
.cart-cta {
  display: inline-block;
  background: #e87b00;
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 500;
}

.cart-warnings { margin-bottom: 12px; }
.warn {
  background: rgba(232,123,0,0.08);
  border: 1px solid rgba(232,123,0,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #b35c00;
}

.cart-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

.cart-items { list-style: none; padding: 0; margin: 0; }
.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f0ede9;
}
.cart-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #f5f3ef;
}
.ci-info { min-width: 0; }
.ci-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1d24;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ci-title:hover { color: #e87b00; }
.ci-sku  { font-size: 11px; color: #9b9591; margin-top: 2px; }
.ci-price{ font-size: 13px; color: #6b6660; margin-top: 4px; }
.ci-moq  { font-size: 12px; color: #e87b00; margin-top: 2px; }

.ci-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #e5e2de;
  border-radius: 8px;
  overflow: hidden;
}
.ci-controls button {
  width: 32px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 18px;
  color: #1a1d24;
  transition: background .15s;
}
.ci-controls button:hover { background: #f5f3ef; }
.qty-input {
  width: 44px;
  height: 36px;
  border: none;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  background: none;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.ci-total { text-align: right; font-size: 14px; font-weight: 600; white-space: nowrap; }
.ci-total .muted { font-weight: 400; font-size: 12px; }

.ci-remove {
  background: none;
  border: none;
  color: #c9c5c1;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.ci-remove:hover { color: #e53935; background: #fef2f2; }

.cart-summary {
  background: #faf7f2;
  border-radius: 14px;
  padding: 20px;
  position: sticky;
  top: 80px;
}
.cart-summary h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.cs-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}
.cs-row.total { font-size: 18px; font-weight: 700; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e5e2de; }
.cs-cta {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: #e87b00;
  color: #fff;
  text-align: center;
  border-radius: 10px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: background .2s;
}
.cs-cta:hover { background: #c96d00; }
.cs-cta.disabled {
  background: #c9c5c1;
  pointer-events: none;
  cursor: not-allowed;
}

/* ── /checkout ── */
.checkout { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.checkout h1 { font-size: 22px; font-weight: 600; margin-bottom: 20px; }
.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.ch-card {
  background: #fff;
  border: 1px solid #e5e2de;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.ch-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.ch-empty { color: #9b9591; font-size: 14px; }
.ch-info ol { padding-left: 20px; margin: 0; }
.ch-info li { font-size: 14px; color: #6b6660; margin-bottom: 8px; line-height: 1.5; }

.ch-address-list { list-style: none; padding: 0; margin: 0 0 12px; }
.ch-address-list li {
  border: 1px solid #e5e2de;
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}
.ch-address-list label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}
.ch-address-list input[type=radio] { margin-top: 3px; accent-color: #e87b00; }
.addr-text { font-size: 14px; }
.addr-text strong { display: block; margin-bottom: 2px; }
.addr-text div { color: #6b6660; font-size: 13px; }

.ch-cta, .ch-cta-secondary {
  background: none;
  border: 1px dashed #c9c5c1;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  color: #6b6660;
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-top: 8px;
}
.ch-cta:hover, .ch-cta-secondary:hover { border-color: #e87b00; color: #e87b00; }

#customer-note {
  width: 100%;
  height: 90px;
  border: 1px solid #e5e2de;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
#customer-note:focus { outline: none; border-color: #e87b00; }

.checkout-summary {
  background: #faf7f2;
  border-radius: 14px;
  padding: 20px;
  position: sticky;
  top: 80px;
}
.checkout-summary h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.cs-items { list-style: none; padding: 0; margin: 0 0 16px; }
.cs-items li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0ede9;
  font-size: 13px;
}
.cs-items img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: #f5f3ef;
  flex-shrink: 0;
}
.ci-title-mini { font-weight: 500; color: #1a1d24; }
.cs-totals { margin: 12px 0 16px; }
.ch-submit {
  width: 100%;
  padding: 14px;
  background: #e87b00;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s;
}
.ch-submit:hover { background: #c96d00; }
.ch-submit:disabled { background: #c9c5c1; cursor: not-allowed; }

/* ── /account/orders/[id] ── */
.order-page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.oc-success-banner {
  background: rgba(34,197,94,.1);
  border: 1px solid #22c55e;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  color: #1d7c3e;
  font-weight: 500;
}
.op-header { margin-bottom: 20px; }
.op-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.op-meta { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.op-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.status-new          { background: #f5f3ef; color: #6b6660; }
.status-confirmed    { background: rgba(34,197,94,.12); color: #166534; }
.status-paid_factory { background: rgba(59,130,246,.12); color: #1d4ed8; }
.status-in_production{ background: rgba(168,85,247,.12); color: #7e22ce; }
.status-in_warehouse { background: rgba(245,158,11,.12); color: #92400e; }
.status-shipped      { background: rgba(20,184,166,.12); color: #134e4a; }
.status-received     { background: rgba(34,197,94,.15); color: #14532d; }

.op-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}
.op-card {
  background: #fff;
  border: 1px solid #e5e2de;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.op-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.tl-step {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  position: relative;
}
.tl-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 34px;
  bottom: -10px;
  width: 2px;
  background: #e5e2de;
}
.tl-step.passed:not(:last-child)::before { background: #22c55e; }
.tl-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e5e2de;
  color: #9b9591;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.tl-step.passed .tl-dot { background: #22c55e; color: #fff; }
.tl-step.current .tl-dot {
  background: #e87b00;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(232,123,0,.2);
}
.tl-label { font-size: 14px; font-weight: 500; color: #1a1d24; }
.tl-step:not(.passed) .tl-label { color: #9b9591; }
.tl-meta { font-size: 12px; color: #9b9591; margin-top: 2px; }
.tl-notes { margin-top: 4px; color: #6b6660; font-style: italic; }

/* order items */
.op-items { list-style: none; padding: 0; margin: 0; }
.op-items li {
  display: grid;
  grid-template-columns: 56px 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0ede9;
}
.op-items img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #f5f3ef;
}
.oi-info a { font-size: 14px; font-weight: 500; color: #1a1d24; text-decoration: none; }
.oi-info a:hover { color: #e87b00; }
.oi-info .muted { font-size: 12px; }
.oi-qty   { font-size: 13px; color: #6b6660; white-space: nowrap; }
.oi-price { font-size: 13px; color: #6b6660; white-space: nowrap; }
.oi-total { font-size: 14px; font-weight: 600; white-space: nowrap; }

.op-address { font-size: 14px; line-height: 1.6; }
.op-address .muted { margin-top: 4px; }

.op-side .op-card.op-manager,
.op-side .op-card.op-rep { background: #faf7f2; }

/* ── Toast ── */
.co-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1d24;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  white-space: nowrap;
}
.co-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.co-toast--err { background: #dc2626; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .cart-layout,
  .checkout-grid,
  .op-grid {
    grid-template-columns: 1fr;
  }
  .cart-summary,
  .checkout-summary {
    position: static;
    order: -1;
  }
  .cart-item {
    grid-template-columns: 60px 1fr;
    grid-template-rows: auto auto auto;
  }
  .ci-controls { order: 3; }
  .ci-total    { order: 4; }
  .ci-remove   { order: 5; grid-column: 2; justify-self: end; }
  .op-grid .op-side { order: -1; }
}

@media (max-width: 480px) {
  .cart h1,
  .checkout h1,
  .op-header h1 { font-size: 18px; }
  .cart-item {
    grid-template-columns: 56px 1fr;
    gap: 8px;
  }
  .cart-item img { width: 56px; height: 56px; }
  .op-items li {
    grid-template-columns: 48px 1fr auto;
    grid-template-rows: auto auto;
  }
  .oi-price { display: none; }
}
