/* ===== Цвета и базовые настройки (меняйте здесь) ===== */
:root {
  --bg: #ffffff;
  --stage: #f4f4f2;
  --text: #16161a;
  --muted: #6b6b73;
  --line: #e4e4e7;
  --accent: #0b6b3a;        /* фирменный цвет */
  --accent-soft: #e7f2ec;
  --warn: #a15c00;
  --warn-soft: #fff4e0;
  --error: #c62828;
  --radius: 14px;
  --topbar: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ===== Шапка ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 22px; letter-spacing: .06em; color: var(--text); text-decoration: none; }
.logo img { display: block; height: 36px; width: auto; }
.topbar__back { color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.topbar__back:hover { color: var(--text); }

/* ===== Раскладка: превью слева, шаги справа ===== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(380px, 1fr);
  min-height: calc(100vh - var(--topbar));
}

.preview {
  position: sticky; top: var(--topbar);
  height: calc(100vh - var(--topbar));
  background: var(--stage);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px;
}
.preview__stage {
  position: relative;
  width: 100%; max-width: 560px;
  aspect-ratio: 400 / 460;
  max-height: calc(100vh - var(--topbar) - 110px);
  display: flex; align-items: center; justify-content: center;
}
#mockup { width: 100%; height: 100%; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .10)); transition: filter .2s; }
.preview__empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted); font-weight: 600;
}
.preview__caption { margin-top: 16px; font-weight: 600; color: var(--muted); min-height: 1.5em; }

.print-area { fill: none; stroke-width: 1.5; stroke-dasharray: 6 5; pointer-events: none; }
#designImg.draggable { cursor: grab; }
#designImg.draggable:active { cursor: grabbing; }

/* ===== Правая панель ===== */
.panel {
  display: flex; flex-direction: column;
  min-height: calc(100vh - var(--topbar));
  border-left: 1px solid var(--line);
  scroll-margin-top: var(--topbar);
}
.panel__body { flex: 1; padding: 28px 40px 32px; }

.stepper {
  list-style: none; margin: 0; padding: 18px 40px 0;
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.stepper li { flex: 1; min-width: 0; }
.stepper button {
  width: 100%;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 0 0 14px;
  border: 0; background: none; text-align: left;
  border-bottom: 3px solid transparent;
  color: var(--muted);
}
.stepper button:disabled { cursor: default; opacity: .5; }
.stepper__num { font-size: 12px; font-weight: 700; }
.stepper__title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stepper .is-done button { color: var(--text); }
.stepper .is-done .stepper__num::after { content: ' ✓'; color: var(--accent); }
.stepper .is-active button { color: var(--text); border-bottom-color: var(--text); }

.h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 6px; font-weight: 800; }
.lead { color: var(--muted); margin: 0 0 24px; }
.hint { color: var(--muted); font-size: 13px; }
.lead--tight { margin-bottom: 6px; }
.footnote { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.footnote a { color: var(--text); }
.check--qty { margin-top: 16px; font-size: 13px; }
#qtyTotals + .footnote { margin-top: 12px; }
.footnote--chips { margin-top: -6px; }

/* ===== Шаг 1: карточки изделий ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 14px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff; text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: #b9b9c0; transform: translateY(-1px); }
.card.is-selected { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.card__pic { width: 100%; height: 130px; margin-bottom: 10px; object-fit: contain; background: #fff; border-radius: 10px; }
.card__name { font-weight: 700; }
.card__desc { font-size: 12px; color: var(--muted); }
.card__price { margin-top: 8px; font-weight: 700; font-size: 14px; }

/* ===== Шаг 2: цвета ===== */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 6px; border: 1.5px solid transparent; border-radius: var(--radius);
  background: none;
}
.swatch:hover { background: var(--stage); }
.swatch.is-selected { border-color: var(--text); }
.swatch__dot { width: 44px; height: 44px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.swatch__name { font-size: 12px; font-weight: 600; text-align: center; }

/* ===== Шаг 3: загрузка ===== */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 220px; padding: 24px;
  border: 2px dashed #c9c9cf; border-radius: var(--radius);
  background: #fafafa; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop__icon { font-size: 28px; }
.drop__title { font-weight: 700; }
.drop__hint { color: var(--muted); font-size: 13px; }

.file { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.file__thumb {
  width: 56px; height: 56px; object-fit: contain; border-radius: 8px;
  background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px;
}
.file__info { flex: 1; min-width: 0; }
.file__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file__meta { font-size: 12px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field__label { font-size: 13px; font-weight: 600; }
.field__error { color: var(--error); font-size: 12px; min-height: 0; }
.field__error:empty { display: none; }
input[type="range"] { width: 100%; accent-color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; }
.chip:hover { border-color: var(--text); }
.chip.is-selected { background: var(--text); border-color: var(--text); color: #fff; }

.note { padding: 12px 14px; border-radius: 10px; background: var(--stage); font-size: 13px; }
.note--warn { background: var(--warn-soft); color: var(--warn); }
.error { color: var(--error); font-size: 13px; }

.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }

/* ===== Шаг 4: проверка ===== */
.summary { margin: 0 0 20px; border-top: 1px solid var(--line); }
.summary > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; text-align: right; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag--warn { background: var(--warn-soft); color: var(--warn); }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--text); flex: none; }

/* ===== Шаг 5: количество ===== */
.qty { border-top: 1px solid var(--line); }
.qty__row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qty__size { font-weight: 700; }
.stepper-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper-input button { width: 40px; height: 40px; border: 0; background: #fff; font-size: 18px; }
.stepper-input button:hover { background: var(--stage); }
.stepper-input input { width: 56px; height: 40px; border: 0; text-align: center; font-weight: 700; -moz-appearance: textfield; }
.stepper-input input::-webkit-outer-spin-button,
.stepper-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.totals { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--stage); display: grid; gap: 4px; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; }
.totals s { color: var(--muted); font-weight: 500; margin-left: 6px; }
.totals__hint { color: var(--accent); font-weight: 600; font-size: 13px; }

/* ===== Шаг 6: форма ===== */
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input {
  width: 100%; padding: 12px 14px;
  border: 1px solid #d4d4d8; border-radius: 10px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(22, 22, 26, .08); }
textarea.input { resize: vertical; }

/* ===== Готово ===== */
.done { text-align: center; max-width: 520px; margin: 24px auto 0; }
.done .summary dd { text-align: right; }
.done__icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 30px; font-weight: 800;
}
.done__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

/* ===== Нижняя панель с ценой и кнопками ===== */
.panel__footer {
  position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 40px;
  background: #fff; border-top: 1px solid var(--line);
}
.price { display: flex; flex-direction: column; }
.price__label { font-size: 12px; color: var(--muted); }
.price__note { font-size: 11px; color: var(--muted); line-height: 1.3; max-width: 230px; }
.note__small { font-size: 12px; opacity: .8; }
.footnote--after { margin: 14px 0 0; }
.price__value { font-size: 20px; font-weight: 800; white-space: nowrap; }
.nav { display: flex; gap: 8px; }
.btn { padding: 13px 26px; border-radius: 999px; font-weight: 700; border: 1.5px solid var(--text); transition: background .15s, opacity .15s; }
.btn--primary { background: var(--text); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #33333a; }
.btn--primary:disabled { opacity: .3; cursor: not-allowed; }
.btn--ghost { background: #fff; }
.btn--ghost:hover { background: var(--stage); }

button:focus-visible, .drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Телефоны и планшеты ===== */
@media (max-width: 900px) {
  :root { --topbar: 56px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .logo img { height: 26px; }
  .topbar__back { font-size: 12px; white-space: nowrap; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .preview { position: relative; top: 0; height: auto; padding: 16px; }
  .preview__stage { max-width: 340px; max-height: none; }
  .panel { border-left: 0; min-height: 0; }
  .stepper { padding: 14px 16px 0; }
  .stepper li { flex: none; }
  .stepper button { padding-right: 14px; }
  .panel__body { padding: 20px 16px 24px; }
  .panel__footer { padding: 12px 16px; }
  .h1 { font-size: 23px; }
  .btn { padding: 12px 20px; }
  .price__value { font-size: 17px; }
  .panel__footer { gap: 10px; }
  .form__row { grid-template-columns: 1fr; gap: 0; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
