/* ПРАЙМ — корзина, чекаут, страница заказа (агент B).
   Токены и базовые компоненты — в site.css. Mobile-first там, здесь
   таблицы свёрстаны для десктопа и перевёрстываются в карточки на мобиле. */

.ta-l { text-align: left; }

/* ---------- корзина ---------- */
.cart-h1 { margin-top: 18px; }

.cart-panel { padding: 0; overflow: hidden; }

.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th {
  padding: 12px 14px; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--txt-3); text-align: center;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.cart-table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: center; }
.cart-table tbody tr:last-child td { border-bottom: 0; }

.ct-img { width: 84px; }
.ct-img img {
  width: 68px; height: 68px; object-fit: contain; margin: 0 auto;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 4px;
}

.ct-name { text-align: left; max-width: 420px; }
.ct-name a { font-weight: 500; font-size: 14px; line-height: 1.35; color: var(--txt); }
.ct-name a:hover { color: var(--brand-hot); }
.ct-sku { display: block; margin-top: 4px; font-size: 12px; color: var(--txt-3); }

.ct-price, .ct-sum { font-family: var(--font-d); font-weight: 600; font-size: 15.5px; white-space: nowrap; }
.ct-sum { font-weight: 700; font-size: 17px; }

.ct-qty form { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qty-apply {
  border: 1px solid var(--line); background: transparent; color: var(--txt-2);
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-s);
  transition: border-color .15s, color .15s;
}
.qty-apply:hover { border-color: var(--brand); color: var(--brand-hot); }
.ct-step { font-size: 11.5px; color: var(--txt-3); }

.ct-del { width: 52px; }
.ct-del-btn {
  width: 34px; height: 34px; display: grid; place-items: center; margin: 0 auto;
  border: 1px solid var(--line); border-radius: 50%; background: transparent;
  color: var(--txt-3); font-size: 14px; line-height: 1;
  transition: border-color .15s, color .15s, background .15s;
}
.ct-del-btn:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }

/* пропавший товар */
.ct-gone td.ct-gone-msg {
  background: var(--warn-soft); color: var(--warn); font-weight: 500;
  font-size: 13.5px; text-align: left; padding: 12px 14px;
}
.ct-gone .mono { font-size: 12px; opacity: .8; }

/* итоговая плашка */
.cart-foot {
  margin-top: 14px; display: flex; flex-direction: column; gap: 14px; align-items: stretch;
}
.cart-note { margin: 0; font-size: 13px; color: var(--txt-2); }
.cart-total { font-family: var(--font-d); font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.cart-total b { font-size: 30px; font-weight: 700; }
.cart-total b small { font-size: 17px; font-weight: 500; }
.cart-total-n { margin-left: 8px; font-family: var(--font-b); font-size: 13px; font-weight: 400; color: var(--txt-3); }
.cart-actions { display: flex; flex-direction: column-reverse; gap: 10px; }
.cart-actions .btn { width: 100%; }

@media (min-width: 768px) {
  .cart-foot { flex-direction: row; align-items: center; justify-content: flex-end; gap: 24px; }
  .cart-note { margin-right: auto; max-width: 300px; }
  .cart-actions { flex-direction: row; }
  .cart-actions .btn { width: auto; }
}

/* пустая корзина */
.cart-empty { text-align: center; padding: 52px 20px 56px; }
.cart-empty svg { margin: 0 auto 14px; color: var(--txt-3); opacity: .5; }
.cart-empty h2 { margin-bottom: 6px; }
.cart-empty p { margin: 0 0 22px; color: var(--txt-2); }

/* --- мобильная перевёрстка таблицы в карточки (без JS) --- */
@media (max-width: 719px) {
  .cart-table, .cart-table tbody { display: block; }
  .cart-table thead { display: none; }
  .cart-table tr.ct-row {
    display: grid; grid-template-columns: 76px 1fr auto;
    grid-template-areas:
      "img name name"
      "img price sum"
      "qty qty del";
    gap: 6px 12px; align-items: center;
    padding: 12px; border-bottom: 1px solid var(--line);
  }
  .cart-table tbody tr:last-child { border-bottom: 0; }
  .cart-table td { display: block; padding: 0; border: 0; width: auto; text-align: left; }
  .ct-img { grid-area: img; align-self: start; }
  .ct-name { grid-area: name; max-width: none; }
  .ct-price { grid-area: price; font-size: 14px; align-self: end; }
  .ct-price::before { content: attr(data-th) ": "; font-family: var(--font-b); font-weight: 400; font-size: 12px; color: var(--txt-3); }
  .ct-sum { grid-area: sum; text-align: right; align-self: end; }
  .ct-qty { grid-area: qty; }
  .ct-qty form { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
  .ct-del { grid-area: del; justify-self: end; }
  .ct-gone { display: block; padding: 0; border-bottom: 1px solid var(--line); }
  .ct-gone td.ct-gone-msg { display: block; }
}

/* ---------- чекаут ---------- */
.co-h1 { margin-top: 18px; }

.co-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) { .co-grid { grid-template-columns: 1fr 360px; gap: 24px; } }

.co-two { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 600px) { .co-two { grid-template-columns: 1fr 1fr; } }

.req { color: var(--brand); font-weight: 700; }

.co-errors {
  background: var(--bad-soft); color: var(--bad); border-radius: var(--r-s);
  padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; font-weight: 500;
}
.co-errors p { margin: 0; }

/* способ получения — сегменты */
.co-delivery { border: 0; padding: 0; margin: 0 0 14px; }
.co-delivery legend { font-size: 13px; font-weight: 600; color: var(--txt-2); padding: 0; margin-bottom: 5px; }
.co-radio { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.co-radio-opt {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: var(--r-s); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.co-radio-opt:hover { border-color: var(--brand); }
.co-radio-opt input { accent-color: var(--brand); margin: 0; }
.co-radio-opt:has(input:checked) {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand-hot);
}

/* адрес прячем при самовывозе (CSS-only; без :has поле просто остаётся видимым) */
.co-form:has(input[name="delivery_method"][value="pickup"]:checked) .co-address { display: none; }

.co-submit { width: 100%; margin-top: 6px; }
.co-hint { margin: 12px 0 0; font-size: 13px; color: var(--txt-2); text-align: center; }

/* сводка заказа */
.co-summary h3 { font-size: 17px; margin-bottom: 12px; text-transform: uppercase; }
@media (min-width: 900px) { .co-summary { position: sticky; top: 16px; } }

.co-items { list-style: none; margin: 0 0 12px; padding: 0; max-height: 340px; overflow-y: auto; }
.co-items li {
  display: flex; align-items: baseline; gap: 8px; padding: 8px 0;
  border-bottom: 1px dashed var(--line); font-size: 13px;
}
.co-items li:last-child { border-bottom: 0; }
.co-item-name {
  flex: 1; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.co-item-qty { color: var(--txt-3); white-space: nowrap; }
.co-item-sum { font-weight: 600; white-space: nowrap; }

.co-total {
  display: flex; align-items: baseline; justify-content: space-between;
  border-top: 2px solid var(--ink); padding-top: 12px;
  font-family: var(--font-d); font-size: 16px; font-weight: 600; text-transform: uppercase;
}
.co-total b { font-size: 24px; font-weight: 700; }
.co-summary-note { margin: 10px 0 0; font-size: 12.5px; color: var(--txt-3); }
.co-back { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--txt-2); }
.co-back:hover { color: var(--brand-hot); }

/* ---------- страница заказа ---------- */
.od-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.od-head h1 { margin: 0; }
.od-date { margin: 4px 0 14px; font-size: 13px; color: var(--txt-3); }

/* статусный бейдж (по мотивам .stock) */
.od-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font: 600 13px/1 var(--font-b); padding: 7px 13px; border-radius: 20px; white-space: nowrap;
}
.od-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-new { background: var(--brand-soft); color: var(--brand-hot); }
.st-sent { background: #E9EDF2; color: var(--txt-2); }
.st-reserved, .st-shipped, .st-done { background: var(--ok-soft); color: var(--ok); }
.st-assembling, .st-problem { background: var(--warn-soft); color: var(--warn); }
.st-cancelled { background: var(--bad-soft); color: var(--bad); }

.od-thanks { border-left: 4px solid var(--brand); margin-bottom: 16px; }
.od-thanks p { margin: 0 0 6px; }
.od-thanks p:last-child { margin-bottom: 0; }
.od-save { font-size: 13px; color: var(--txt-2); }
.od-itp { font-size: 13.5px; }

.od-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) { .od-grid { grid-template-columns: 1fr 340px; gap: 24px; } }

.od-items h3, .od-info h3, .od-contacts h3 { font-size: 17px; margin-bottom: 12px; text-transform: uppercase; }

.od-table { width: 100%; border-collapse: collapse; }
.od-table th {
  padding: 8px 10px; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--txt-3); text-align: center;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.od-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.od-table tbody tr:last-child td { border-bottom: 0; }

.odt-name { text-align: left; }
.odt-name a { font-weight: 500; color: var(--txt); }
.odt-name a:hover { color: var(--brand-hot); }
.odt-sku { display: block; margin-top: 3px; font-size: 12px; color: var(--txt-3); }
.odt-item-status {
  display: inline-block; margin-top: 4px; font-size: 11.5px; font-weight: 600;
  color: var(--txt-2); background: var(--bg); border-radius: 20px; padding: 2px 9px;
}
.odt-price, .odt-sum { font-family: var(--font-d); font-weight: 600; white-space: nowrap; }
.odt-sum { font-weight: 700; }
.odt-qty { white-space: nowrap; color: var(--txt-2); }

.od-total {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 14px; padding-top: 12px; border-top: 2px solid var(--ink);
  font-family: var(--font-d); font-size: 17px; font-weight: 600; text-transform: uppercase;
}
.od-total b { font-size: 28px; font-weight: 700; }
.od-total b small { font-size: 16px; font-weight: 500; }

.od-side { display: flex; flex-direction: column; gap: 16px; }
.od-dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13.5px; }
.od-dl dt { color: var(--txt-3); }
.od-dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.od-contacts p { margin: 0 0 14px; font-size: 13.5px; color: var(--txt-2); }
.od-more { width: 100%; }

/* мобильная перевёрстка таблицы заказа */
@media (max-width: 719px) {
  .od-table, .od-table tbody { display: block; }
  .od-table thead { display: none; }
  .od-table tr {
    display: grid; grid-template-columns: 1fr auto;
    grid-template-areas:
      "name name"
      "qty sum";
    gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
  }
  .od-table tbody tr:last-child { border-bottom: 0; }
  .od-table td { display: block; padding: 0; border: 0; text-align: left; }
  .odt-name { grid-area: name; }
  .odt-price { display: none; }
  .odt-qty { grid-area: qty; font-size: 13px; }
  .odt-sum { grid-area: sum; text-align: right; }
}
