/* ── Reset & Base ───────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-text:        #1d1d1d;
  --c-text-muted:  #6b7280;
  --c-bg:          #ffffff;
  --c-bg-soft:     #f7f5f2;
  --c-border:      #e0dbd5;
  --c-border-form: #ccc7c0;
  --c-shadow:      rgba(0,0,0,0.06);
  --c-green:       #16a34a;
  --c-green-bg:    #dcfce7;
  --c-red:         #dc2626;

  --radius-card:   10px;
  --radius-input:  6px;
  --radius-btn:    6px;

  --max-w: 1100px;
  --gutter: clamp(16px, 4vw, 40px);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--c-text);
  background-color: var(--c-bg-soft);
  min-height: 100vh;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

[x-cloak] { display: none !important; }

/* ── Animations ─────────────────────────────────────────────────────────────── */

@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

.co-header {
  background-color: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  padding: 0 var(--gutter);
}
.co-header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.co-header__logo img {
  display: block;
  height: 42px;
  width: auto;
}
.co-header__cart {
  display: flex;
  align-items: center;
  color: var(--c-text);
  text-decoration: none;
}
.co-header__cart svg {
  width: 22px;
  height: 22px;
}

/* ── Step bar ───────────────────────────────────────────────────────────────── */

.co-steps {
  max-width: var(--max-w);
  margin: 2rem auto 0;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 6px;
}
.co-step-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--c-text);
}
.co-step-btn.is-pending { color: var(--c-text-muted); cursor: default; }
.co-step-btn.is-done    { color: var(--c-green); }
.co-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background-color 200ms, border-color 200ms, color 200ms;
}
.co-step-btn.is-active  .co-step-circle { border-color: var(--c-text); background-color: var(--c-text); color: var(--c-bg); }
.co-step-btn.is-done    .co-step-circle { border-color: var(--c-green); background-color: var(--c-green); color: #fff; }
.co-step-btn.is-pending .co-step-circle { border-color: var(--c-border); color: var(--c-text-muted); background-color: transparent; }
.co-step-label { display: none; }
@media (min-width: 480px) { .co-step-label { display: inline; } }
.co-step-divider { flex: 1; max-width: 40px; height: 1px; background-color: var(--c-border); }

/* ── Layout grid ────────────────────────────────────────────────────────────── */

.co-wrap {
  max-width: var(--max-w);
  margin: 2rem auto 4rem;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}
@media (max-width: 900px) {
  .co-wrap { grid-template-columns: 1fr; }
  .co-sidebar { order: -1; }
}

/* ── Card ───────────────────────────────────────────────────────────────────── */

.co-card {
  background-color: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: 0 2px 12px var(--c-shadow);
  animation: fade-up 220ms ease both;
}
.co-card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-text);
  margin-bottom: 1.5rem;
}

/* ── Form fields ────────────────────────────────────────────────────────────── */

.co-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) { .co-grid-2 { grid-template-columns: 1fr; } }

.co-field { display: flex; flex-direction: column; }

.co-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-text-muted);
  margin-bottom: 5px;
}

.co-input {
  width: 100%;
  border: 1px solid var(--c-border-form);
  border-radius: var(--radius-input);
  padding: 10px 14px;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--c-text);
  background-color: var(--c-bg);
  font-family: inherit;
  outline: none;
  transition: border-color 150ms;
  -webkit-appearance: none;
}
.co-input:focus  { border-color: var(--c-text); }
.co-input.error  { border-color: var(--c-red); }
.co-input[readonly] { cursor: default; background-color: var(--c-bg-soft); }
.co-input--pr    { padding-right: 40px; }

.co-input-wrap { position: relative; }
.co-input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  padding: 0;
  line-height: 1;
}
.co-input-icon:hover { color: var(--c-text); }
.co-input-icon svg { width: 16px; height: 16px; }

.co-err {
  color: var(--c-red);
  font-size: 0.6875rem;
  margin-top: 4px;
}

/* ── Dropdown ───────────────────────────────────────────────────────────────── */

.co-dropdown {
  position: absolute;
  z-index: 60;
  width: 100%;
  background-color: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 28px rgba(0,0,0,0.10);
  margin-top: 4px;
  max-height: 230px;
  overflow-y: auto;
}
.co-dropdown-item {
  padding: 10px 14px;
  font-size: 0.8125rem;
  cursor: pointer;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  line-height: 1.35;
}
.co-dropdown-item:last-child { border-bottom: none; }
.co-dropdown-item:hover { background-color: var(--c-bg-soft); }
.co-dropdown-item__sub {
  font-size: 0.6875rem;
  color: var(--c-text-muted);
  margin-top: 2px;
}

/* ── Spinner ────────────────────────────────────────────────────────────────── */

.co-spinner {
  animation: spin 0.9s linear infinite;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Address summary ────────────────────────────────────────────────────────── */

.co-summary-box {
  background-color: var(--c-bg-soft);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin-bottom: 1.5rem;
}
.co-summary-box__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-text-muted);
  margin-bottom: 4px;
}
.co-summary-box__value {
  font-size: 0.875rem;
  color: var(--c-text);
  line-height: 1.4;
}

/* ── WFP block ──────────────────────────────────────────────────────────────── */

.co-wfp-block {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.5rem;
}
.co-wfp-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background-color: var(--c-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
}
.co-wfp-name { font-weight: 600; font-size: 0.9375rem; }
.co-wfp-desc { font-size: 0.75rem; color: var(--c-text-muted); margin-top: 2px; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.co-actions {
  display: flex;
  gap: 10px;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.co-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-btn);
  padding: 11px 28px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 150ms, background-color 150ms;
  white-space: nowrap;
  border: none;
}
.co-btn--primary { background-color: var(--c-text); color: var(--c-bg); }
.co-btn--primary:hover:not(:disabled) { opacity: 0.85; }
.co-btn--primary:disabled { opacity: 0.6; cursor: wait; }

.co-btn--ghost {
  background-color: transparent;
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.co-btn--ghost:hover { border-color: var(--c-text); }
.co-btn--full { width: 100%; }

/* ── Section spacing ────────────────────────────────────────────────────────── */
.co-section { margin-bottom: 18px; }
.co-divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 28px 0;
}

/* ── Single-column wrap (success) ───────────────────────────────────────────── */
.co-wrap--single {
  grid-template-columns: 1fr;
  max-width: 560px;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */

.co-sidebar { position: sticky; top: 24px; }
.co-sidebar__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
}
.co-items { display: flex; flex-direction: column; gap: 14px; }
.co-item  { display: flex; gap: 12px; align-items: flex-start; }
.co-item__img {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--c-bg-soft);
  flex-shrink: 0;
}
.co-item__img img { width: 100%; height: 100%; object-fit: cover; }
.co-item__qty {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background-color: var(--c-text);
  color: var(--c-bg);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.co-item__info { flex: 1; min-width: 0; }
.co-item__name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.co-item__variant {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  margin-top: 2px;
}
.co-item__price {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 4px;
}

.co-totals {
  border-top: 1px solid var(--c-border);
  padding-top: 14px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.875rem;
}
.co-total-row { display: flex; justify-content: space-between; color: var(--c-text-muted); }
.co-total-row--main {
  font-weight: 700;
  font-size: 1rem;
  color: var(--c-text);
  border-top: 1px solid var(--c-border);
  padding-top: 8px;
  margin-top: 2px;
}

.co-badges {
  border-top: 1px solid var(--c-border);
  padding-top: 14px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-size: 0.75rem;
  color: var(--c-text-muted);
}
.co-badge { display: flex; align-items: center; gap: 5px; }
.co-badge svg { width: 14px; height: 14px; }

/* ── Skeleton ───────────────────────────────────────────────────────────────── */

.co-skeleton {
  height: 60px;
  background-color: var(--c-bg-soft);
  border-radius: 8px;
  animation: pulse 1.5s ease-in-out infinite;
  margin-bottom: 10px;
}

/* ── Success screen ─────────────────────────────────────────────────────────── */

.co-success {
  text-align: center;
  padding: 3rem 28px;
}
.co-success__icon {
  width: 64px;
  height: 64px;
  background-color: var(--c-green-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}
.co-success__icon svg { width: 32px; height: 32px; color: var(--c-green); }
.co-success__title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.co-success__text {
  font-size: 0.9375rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* ── Payment cards ──────────────────────────────────────────────────────────── */

.co-pay-group {
  display: flex;
  flex-direction: column;
  gap: .625rem;
}

.co-pay-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.co-pay-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.125rem;
  border: 2px solid var(--c-border);
  border-radius: .875rem;
  cursor: pointer;
  background: #fff;
  transition: border-color .18s, box-shadow .18s, background .18s;
  user-select: none;
}

.co-pay-card:hover {
  border-color: #b0a8a0;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

.co-pay-card--active {
  border-color: #1d1d1d;
  background: #faf9f8;
  box-shadow: 0 2px 12px rgba(0,0,0,.10);
}

/* кастомний radio-кружок */
.co-pay-dot {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid #ccc;
  border-radius: 50%;
  background: #fff;
  transition: border-color .15s, background .15s;
  position: relative;
}

.co-pay-dot--on {
  border-color: #1d1d1d;
  background: #1d1d1d;
}

.co-pay-dot--on::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #fff;
}

.co-pay-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.co-pay-text {
  flex: 1;
  min-width: 0;
}

.co-pay-text strong {
  display: block;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--c-text);
}

.co-pay-text small {
  display: block;
  font-size: .78rem;
  color: var(--c-text-muted);
  margin-top: .1rem;
}

.co-pay-badge {
  flex-shrink: 0;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: #1d1d1d;
  color: #fff;
}
