/* Витрина: сначала телефон (от 360 px), без внешних шрифтов и библиотек. */
:root {
    --ink: #1c2321;
    --muted: #5d6763;
    --line: #dfe5e2;
    --bg: #f6f8f7;
    --card: #ffffff;
    --accent: #1f6f5c;
    --accent-ink: #ffffff;
    --soft: #e7f1ee;
    --warn: #8a5a00;
    --radius: 12px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--accent); }

h1:focus { outline: none; }

.muted { color: var(--muted); }

.site-head {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--ink);
}

.site-main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 16px;
}

.site-foot {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.intro { max-width: 640px; padding: 24px 0; }

.button,
.search button {
    display: inline-block;
    min-height: 44px;
    padding: 10px 18px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.shop-head h1 { margin: 4px 0; font-size: 24px; line-height: 1.2; }
.shop-head p { margin: 0 0 12px; }

.search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 12px;
}

.search input,
.search select {
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    font: inherit;
    color: var(--ink);
}

.search input { grid-column: 1 / -1; }

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 12px;
    scrollbar-width: none;
}

.chip {
    flex: none;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.empty { padding: 32px 0; color: var(--muted); }

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
}

.photo {
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 4;
    background: var(--soft);
    color: var(--accent);
    font-size: 40px;
    font-weight: 700;
}

.card-body { padding: 10px; }
.card-body h2 { margin: 6px 0 2px; font-size: 15px; font-weight: 600; line-height: 1.3; }
.card-body p { margin: 0; font-size: 13px; }
.card-body .price { margin-top: 6px; font-size: 17px; font-weight: 700; color: var(--ink); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
}

.badge.mode-preorder { background: #eef1fb; color: #34478a; }
.badge.mode-collection { background: #fbf3e4; color: var(--warn); }

.sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
    margin: 8px 0 0;
    list-style: none;
}

.sizes li {
    min-width: 32px;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
}

.sizes li.out { color: #9aa39f; text-decoration: line-through; }

@media (min-width: 640px) {
    .search { grid-template-columns: minmax(0, 1fr) 180px auto; }
    .search input { grid-column: auto; }
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
}

@media (min-width: 960px) {
    .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.blazor-error-boundary {
    padding: 1rem;
    background: #b32121;
    color: white;
}

.blazor-error-boundary::after { content: "Произошла ошибка."; }

/* Шапка */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head-link { font-size: 14px; text-decoration: none; }

/* Вход и регистрация */
.auth { max-width: 440px; margin: 0 auto; padding: 16px 0 32px; }
.auth h1 { font-size: 24px; line-height: 1.2; margin: 8px 0 8px; }
.button-wide { display: block; width: 100%; text-align: center; }
.button-link {
    min-height: 44px;
    padding: 10px 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}
.steps { padding-left: 20px; color: var(--muted); }
.steps li { margin: 4px 0; }
.code-line { font-size: 18px; margin: 12px 0 4px; }
.code { font-size: 28px; letter-spacing: 6px; font-variant-numeric: tabular-nums; }
.status { margin: 16px 0 4px; font-weight: 600; }
.notice { padding: 10px 12px; border-radius: var(--radius); background: #fbf3e4; color: var(--warn); }
.form { display: grid; gap: 16px; margin-top: 16px; }
.form label { display: grid; gap: 6px; }
.form label > span:first-child { font-weight: 600; }
.form input {
    min-height: 44px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    font: inherit;
    color: var(--ink);
}
.prefixed { display: flex; align-items: stretch; }
.prefixed .prefix {
    display: flex;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    background: var(--soft);
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}
.prefixed input { border-radius: 0 var(--radius) var(--radius) 0; min-width: 0; }

/* QR со ссылкой на бота — только на широком экране: на телефоне ссылка открывается кнопкой. */
.qr { display: none; }
@media (min-width: 640px) {
    .qr { display: block; margin: 16px auto 0; text-align: center; }
    .qr svg { display: block; width: 184px; height: 184px; margin: 0 auto; }
    .qr p { margin: 6px 0 0; font-size: 13px; }
}

/* Фото на витрине: одинаковая высота карточек, кадр 3:4 */
img.photo { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; background: var(--soft); }

/* ---------- Кабинет байера (MudBlazor) ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.buyer-bar { background: #fff !important; color: var(--ink) !important; border-bottom: 1px solid var(--line); }
.buyer-bar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buyer-logout { display: inline; margin: 0; }
.product-filter { width: 100%; }
.product-filter .mud-toggle-item { font-size: 13px; padding-left: 6px; padding-right: 6px; }

.product-list { display: grid; gap: 8px; }
.product-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}
.product-row img, .product-row-nophoto { width: 72px; height: 96px; border-radius: 8px; object-fit: cover; background: var(--soft); display: block; }
.product-row-body { display: grid; gap: 2px; justify-items: start; min-width: 0; }
.product-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.product-row-meta { font-size: 13px; color: var(--muted); }
.add-fab { position: fixed !important; right: 16px; bottom: 16px; z-index: 20; }
.add-fab-space { height: 72px; }

.upload-list { display: grid; gap: 4px; }
.upload-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; min-height: 36px; font-size: 14px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-stage { color: var(--muted); font-size: 13px; text-align: right; max-width: 55vw; }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-cell { position: relative; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: var(--soft); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-badge { position: absolute; left: 6px; top: 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; }
.photo-actions { position: absolute; right: 2px; bottom: 2px; display: flex; background: rgba(255, 255, 255, .9); border-radius: 999px; }
.photo-add { display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--accent); text-decoration: none; border: 1px dashed var(--accent); font-size: 13px; }

.size-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.size-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.product-row-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ai-caption { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--line); color: var(--muted); font-size: 13px; white-space: pre-line; }

/* ---------- Страница товара и подборки ---------- */
.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.badge.mode-sold { background: #f1f1f1; color: var(--muted); }
.crumbs { margin: 0 0 12px; font-size: 14px; }
.crumbs a { text-decoration: none; }

.product { display: grid; gap: 16px; }
.product-photos { min-width: 0; }
.gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    border-radius: var(--radius);
    scrollbar-width: none;
}
.gallery img {
    flex: 0 0 100%;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    scroll-snap-align: start;
    border-radius: var(--radius);
    background: var(--soft);
}
.gallery-hint { margin: 6px 0 0; font-size: 13px; text-align: center; }
.product-body h1 { margin: 8px 0 4px; font-size: 22px; line-height: 1.25; }
.price-big { margin: 0 0 12px; font-size: 26px; font-weight: 700; }
.section-title { margin: 16px 0 6px; font-size: 15px; }
.sizes-big li { min-width: 44px; padding: 8px 10px; font-size: 15px; border-radius: 8px; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 16px 0; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.description { white-space: pre-line; margin: 12px 0; }
.seller { margin-top: 20px; font-size: 14px; }
.more { margin: 16px 0; text-align: center; }

@media (min-width: 768px) {
    .product { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
    .product-body h1 { font-size: 26px; }
}

/* Кабинет: вкладки разделов и блок «Поделиться» */
.buyer-nav { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.buyer-nav a { padding: 8px 10px; white-space: nowrap; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.buyer-nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.share-url { margin: 2px 0 8px; color: var(--muted); word-break: break-all; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.selection-pick { display: grid; grid-template-columns: auto 56px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.selection-pick img, .selection-pick .nophoto { width: 56px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--soft); display: block; }
.selection-pick .meta { min-width: 0; }
.selection-pick .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Этап 6: заказ с витрины и кабинет покупателя. */
.head-links { display: flex; align-items: center; gap: 14px; }
.small { font-size: 13px; }

.order-pick { display: grid; gap: 14px; margin: 4px 0 16px; }
.size-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.size-pick legend { margin-bottom: 8px; padding: 0; font-weight: 600; }
.size-pick label { position: relative; }
.size-pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.size-pick span {
    display: grid;
    place-items: center;
    min-width: 48px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    font-weight: 600;
}
.size-pick input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.size-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.size-pick input:disabled + span { color: #9aa39f; text-decoration: line-through; background: transparent; }
.size-pick input:disabled { cursor: not-allowed; }
.order-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: end; }
.qty { display: grid; gap: 6px; font-weight: 600; }
.qty input {
    min-height: 44px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    font: inherit;
}

.checkout { max-width: 520px; }
.checkout h1 { margin: 0 0 12px; font-size: 24px; }
.checkout-item { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.checkout-item img, .checkout-item .nophoto { width: 72px; height: 96px; border-radius: 8px; object-fit: cover; background: var(--soft); }
.checkout-sum { margin: 4px 0; font-size: 20px; font-weight: 700; }
.nophoto { display: block; background: var(--soft); }
.known { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--soft); }
.form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    font: inherit;
    color: var(--ink);
    resize: vertical;
}
.form .check { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; }
.form .check input { width: 22px; min-height: 22px; height: 22px; margin: 2px 0 0; padding: 0; }
.form .check > span:first-child { font-weight: normal; }
.form .check span { font-weight: normal; }

.my { max-width: 640px; }
.my h1 { margin: 0 0 4px; font-size: 24px; }
.success { padding: 10px 12px; border-radius: var(--radius); background: var(--soft); color: var(--accent); font-weight: 600; }
.my-link { display: grid; gap: 8px; margin: 16px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.my-link .share-url { margin: 0; font-size: 14px; }
.my-link-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button-light { background: var(--soft); color: var(--accent); }
.share-only { display: none; }
.can-share .share-only { display: inline-block; }

.order-list { display: grid; gap: 12px; margin: 0; }
.order-card { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.order-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; font-size: 14px; }
.order-head a { font-weight: 600; }
.order-items { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.order-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
.order-item img, .order-item .nophoto { width: 56px; height: 75px; border-radius: 8px; object-fit: cover; }
.order-item-body { display: grid; gap: 4px; justify-items: start; min-width: 0; font-size: 14px; }
.order-item-title { font-weight: 600; font-size: 15px; }
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.st-new { background: #fbf3e4; color: var(--warn); }
.st-work { background: #eef1fb; color: #34478a; }
.st-done { background: var(--soft); color: var(--accent); }
.st-off { background: #eef0ef; color: var(--muted); }
.history { font-size: 13px; color: var(--muted); }
.history summary { cursor: pointer; }
.history ol { margin: 4px 0 0; padding-left: 18px; }
.link-button { padding: 4px 0; border: 0; background: none; color: #a33a2b; font: inherit; text-decoration: underline; cursor: pointer; }
.order-comment { margin: 10px 0 0; font-size: 14px; }
.order-foot { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.order-pay { margin: 10px 0 0; font-size: 14px; white-space: pre-line; }

.text-page { max-width: 640px; }
.text-page h1 { font-size: 24px; }
.text-page h2 { margin: 20px 0 6px; font-size: 17px; }

/* Заказ в кабинете байера. */
.order-line { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; }
.order-line img, .order-line .product-row-nophoto { width: 56px; height: 75px; border-radius: 8px; object-fit: cover; }
.order-line-body { min-width: 0; }
.order-line-body a { color: inherit; }
.order-history { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.order-total { display: flex; justify-content: space-between; margin: 16px 0 4px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 16px; }

/* Каналы Telegram в кабинете. */
.channel-steps { margin: 8px 0 0; padding-left: 20px; }
.channel-steps li { margin-bottom: 6px; }
