/*
 * Trailhead Shop — стили магазина (задание 5). Подключается после main.css только на страницах
 * /en/store/ и /ru/store/ (у <body> класс .store-page). Хедер и футер Realbugz остаются как на сайте,
 * всё остальное — собственный стиль магазина: зелёный + оранжевый, DM Sans.
 */

.store-page {
    --th-green: #2f4a3a;
    --th-green-dark: #22382b;
    --th-green-soft: #e8efe9;
    --th-orange: #e0812f;
    --th-orange-dark: #c26a1d;
    --th-orange-soft: #fdf1e5;
    --th-text: #22272a;
    --th-muted: #6b716c;
    --th-border: #e2ded6;
    --th-surface: #ffffff;
    --th-photo: #eeeeee;
    --th-danger: #b3261e;
    --th-danger-soft: #fdecea;
    --th-success: #2e7d4f;
    --th-success-soft: #e8f5ec;
    --th-radius: 10px;
    --th-radius-sm: 6px;
    --th-shadow: 0 6px 20px rgba(34, 39, 42, 0.07);

    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--th-text);
}

.store-page main.th-main {
    display: block;
    width: 100%;
    margin: 0 0 56px;
}

.store-page h1,
.store-page h2,
.store-page h3 {
    font-family: 'DM Sans', Arial, sans-serif;
    color: var(--th-text);
    text-align: left;
    letter-spacing: 0;
}

.store-page a {
    color: var(--th-green);
    text-decoration-color: rgba(47, 74, 58, 0.35);
}

.store-page a:hover {
    color: var(--th-orange-dark);
}

.th-muted {
    color: var(--th-muted);
    font-weight: 400;
}

.th-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

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

/* ---------- шарик Realbugz ----------
   Неподвижно «приколот» к левому верхнему углу шапки магазина; на телефоне — кнопка слева от логотипа.
   По клику — панель: требования (в отдельной вкладке), сброс магазина, возврат на Realbugz. */

.th-top {
    position: relative;
    width: 100%;
    margin-top: 8px;
}

.th-rb {
    position: absolute;
    top: -16px;
    left: -16px;
    z-index: 30;
}

/* Шарик — как фавикон Realbugz: кремовый кружок, тонкий контур, «Rb» с засечками акцентного цвета */
.th-rb-ball {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #e8e4dd;
    border-radius: 50%;
    background: #fdfbf7;
    color: #c4553a;
    box-shadow: 0 2px 6px rgba(26, 24, 21, 0.12);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.th-rb-ball:hover,
.th-rb-ball[aria-expanded="true"] {
    border-color: #c4553a;
    transform: scale(1.05);
}

.th-rb-ball:focus-visible {
    outline: 2px solid #c4553a;
    outline-offset: 3px;
}

.th-rb-mark {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.01em;
}

.th-rb-panel {
    position: absolute;
    top: 54px;
    left: 0;
    width: 290px;
    max-width: calc(100vw - 24px);
    padding: 16px;
    background: #fff;
    border: 1px solid #d9d4ca;
    border-radius: var(--th-radius);
    box-shadow: 0 4px 12px rgba(34, 39, 42, 0.08);
}

.th-rb-panel[hidden] {
    display: none;
}

.th-rb-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.th-rb-text {
    margin: 0 0 10px;
    color: var(--th-muted);
    font-size: 13px;
    line-height: 1.45;
}

.th-rb-link {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--th-radius-sm);
    background: transparent;
    color: var(--th-text) !important;
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.th-rb-link:hover {
    background: #fbefeb;
    color: #a44731 !important;
}

.th-rb-back {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--th-border);
    border-radius: 0;
    color: var(--th-muted) !important;
    font-weight: 500;
}

/* ---------- футер магазина ---------- */

.th-footer {
    width: 100%;
    margin-top: auto;
    padding: 18px 4px 4px;
    border-top: 1px solid var(--th-border);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 20px;
    font-size: 14px;
}

.th-footer p {
    margin: 0;
}

/* ---------- шапка магазина ---------- */

.th-header {
    width: 100%;
    min-height: 72px;
    margin-bottom: 24px;
    padding: 10px 18px 10px 38px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    box-shadow: var(--th-shadow);
}

.th-header-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.th-logo {
    flex: none;
    display: block;
    line-height: 0;
}

.th-logo img {
    width: 180px;
    height: auto;
}

.th-search {
    flex: 1;
    display: flex;
    min-width: 0;
    max-width: 520px;
    border: 1px solid var(--th-border);
    border-radius: 999px;
    background: #faf9f6;
    overflow: hidden;
}

.th-search:focus-within {
    border-color: var(--th-green);
    box-shadow: 0 0 0 3px rgba(47, 74, 58, 0.12);
}

.th-search input {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border: 0;
    background: transparent;
    color: var(--th-text);
    font-size: 15px;
    outline: none;
}

.store-page .th-search button {
    flex: none;
    width: 48px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--th-green);
    box-shadow: none;
    transform: none;
    cursor: pointer;
}

.th-search button svg {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}

.th-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.th-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: var(--th-radius-sm);
    color: var(--th-text) !important;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
}

.th-nav-link:hover {
    background: var(--th-green-soft);
}

.th-nav-link svg {
    width: 22px;
    height: 22px;
    flex: none;
}

.th-nav-account .th-nav-text {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.th-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--th-orange);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.th-lang {
    flex: none;
    padding-left: 6px;
    border-left: 1px solid var(--th-border);
}

.th-lang .language-switcher {
    padding-left: 8px;
}

.th-mobile-lang {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 44px;
    padding: 8px 4px 2px;
    color: var(--th-muted);
    font-size: 15px;
}

.th-burger {
    display: none;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    background: #fff;
    color: var(--th-text);
    cursor: pointer;
}

.th-burger svg {
    width: 100%;
    height: 100%;
}

.th-mobile-menu {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--th-border);
}

.th-mobile-menu[hidden] {
    display: none;
}

.th-mobile-menu a,
.th-mobile-menu .th-link-button {
    display: block;
    min-height: 44px;
    padding: 11px 4px;
    color: var(--th-text);
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
}

/* ---------- кнопки ---------- */

.store-page .th-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin: 0;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--th-radius-sm);
    background: #fff;
    color: var(--th-text);
    box-shadow: none;
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transform: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.store-page .th-btn:hover,
.store-page .th-btn:active {
    transform: none;
    box-shadow: none;
}

.store-page .th-btn-primary {
    background: var(--th-green);
    border-color: var(--th-green);
    color: #fff;
}

.store-page .th-btn-primary:hover {
    background: var(--th-green-dark);
    border-color: var(--th-green-dark);
    color: #fff;
}

.store-page .th-btn-ghost {
    background: #fff;
    border-color: var(--th-border);
    color: var(--th-text);
}

.store-page .th-btn-ghost:hover {
    border-color: var(--th-green);
    color: var(--th-green);
}

.store-page .th-btn-danger {
    background: #fff;
    border-color: rgba(179, 38, 30, 0.45);
    color: var(--th-danger);
}

.store-page .th-btn-danger:hover {
    background: var(--th-danger-soft);
    border-color: var(--th-danger);
    color: var(--th-danger);
}

.store-page .th-btn:disabled,
.store-page .th-btn:disabled:hover {
    background: #e7e5e0;
    border-color: #e7e5e0;
    color: #8f948f;
    cursor: not-allowed;
}

.store-page .th-btn-lg {
    min-height: 50px;
    padding: 12px 24px;
    font-size: 16px;
}

.store-page .th-btn-block {
    width: 100%;
}

.th-icon-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    background: #fff;
    color: var(--th-muted);
    cursor: pointer;
}

.th-icon-btn svg {
    width: 22px;
    height: 22px;
}

.th-icon-btn:hover {
    border-color: var(--th-orange);
    color: var(--th-orange);
}

.th-wish.is-active {
    border-color: var(--th-orange);
    color: var(--th-orange);
}

.th-wish.is-active svg path {
    fill: currentColor;
}

.th-link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--th-green);
    font: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(47, 74, 58, 0.35);
    cursor: pointer;
}

.th-link-button:hover {
    color: var(--th-orange-dark);
}

/* ---------- общие блоки ---------- */

.store-page .th-page-title {
    margin: 0 0 16px;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
}

.store-page .th-section-title {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.th-panel {
    min-width: 0;
    margin: 0 0 20px;
    padding: 22px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}

.th-panel > legend {
    float: left;
    width: 100%;
    margin-bottom: 14px;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
}

.th-panel > legend + * {
    clear: both;
}

.th-note {
    margin: 8px 0;
    padding: 10px 14px;
    background: var(--th-green-soft);
    border-radius: var(--th-radius-sm);
    font-size: 15px;
}

.th-hint {
    margin: 6px 0 0;
    color: var(--th-muted);
    font-size: 13px;
}

.th-error {
    min-height: 0;
    margin: 6px 0 0;
    color: var(--th-danger);
    font-size: 14px;
    font-weight: 500;
}

.th-error:empty {
    display: none;
}

.th-banner {
    margin: 0 0 18px;
    padding: 14px 18px;
    border-radius: var(--th-radius);
    font-weight: 600;
}

.th-banner.is-success {
    background: var(--th-success-soft);
    color: var(--th-success);
}

.th-banner.is-warning {
    background: var(--th-orange-soft);
    border: 1px solid rgba(224, 129, 47, 0.45);
    color: #8a4a12;
    font-weight: 500;
}

.th-form-message:empty {
    display: none;
}

.th-form-message {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: var(--th-radius-sm);
    font-size: 15px;
    font-weight: 500;
}

.th-form-message.is-error {
    background: var(--th-danger-soft);
    color: var(--th-danger);
}

.th-form-message.is-success {
    background: var(--th-success-soft);
    color: var(--th-success);
}

.th-empty-page {
    padding: 40px 0;
    text-align: center;
}

.th-empty-page p {
    margin-bottom: 16px;
}

.th-continue {
    display: block;
    margin-top: 14px;
    text-align: center;
    font-size: 15px;
}

.th-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.th-tag-sale {
    background: var(--th-orange);
    color: #fff;
}

.th-tag-out {
    background: #5f6461;
    color: #fff;
}

/* ---------- формы ---------- */

.th-form .th-field,
.th-field {
    margin-bottom: 16px;
}

.th-field label,
.th-field legend {
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 600;
}

.th-req {
    color: var(--th-danger);
}

.th-field input[type="text"],
.th-field input[type="email"],
.th-field input[type="tel"],
.th-field input[type="password"],
.th-field textarea,
.th-promo input,
.th-price-range input,
.th-sort select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cfcac0;
    border-radius: var(--th-radius-sm);
    background: #fff;
    color: var(--th-text);
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
}

.th-field textarea {
    resize: vertical;
}

.th-field input:focus,
.th-field textarea:focus,
.th-promo input:focus,
.th-price-range input:focus,
.th-sort select:focus,
.th-qty-input:focus {
    outline: none;
    border-color: var(--th-green);
    box-shadow: 0 0 0 3px rgba(47, 74, 58, 0.15);
}

.th-field input[readonly] {
    background: #f3f2ee;
    color: var(--th-muted);
}

.store-page .is-invalid,
.store-page .is-invalid:focus {
    border-color: var(--th-danger);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.12);
}

.th-password {
    position: relative;
}

.th-password input {
    padding-right: 96px !important;
}

.th-show-password {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    min-height: 34px;
    padding: 4px 10px;
    border: 0;
    border-radius: 4px;
    background: var(--th-green-soft);
    color: var(--th-green);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.th-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.th-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
}

.th-check input {
    width: 18px;
    height: 18px;
    flex: none;
    accent-color: var(--th-green);
}

.th-check .th-muted {
    margin-left: auto;
    font-size: 13px;
}

/* ---------- каталог ---------- */

.th-catalog {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.th-filters {
    position: sticky;
    top: 16px;
    padding: 18px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}

.store-page .th-filters-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
}

.th-filter-group {
    margin: 0 0 16px;
    padding: 0 0 14px;
    border: 0;
    border-bottom: 1px solid var(--th-border);
}

.th-filter-group legend {
    margin-bottom: 6px;
    padding: 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--th-muted);
}

.th-price-range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.th-results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    flex-wrap: wrap;
}

.th-results-head .th-page-title {
    margin: 0;
}

.th-results-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.th-filters-toggle {
    display: none !important;
}

.th-sort {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--th-muted);
}

/* Своя стрелка вместо системной: системная прилипает к правому краю */
.th-sort select {
    width: auto;
    min-width: 190px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2322272a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    cursor: pointer;
}

.th-results-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin: 12px 0 16px;
}

.th-results-info p {
    margin: 0;
}

.th-count {
    color: var(--th-muted);
    font-size: 15px;
}

.th-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 12px;
    border-radius: 999px;
    background: var(--th-green-soft);
    font-size: 14px;
    font-weight: 600;
}

.th-chip-clear {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--th-text);
    cursor: pointer;
}

.th-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.th-grid > .th-empty {
    grid-column: 1 / -1;
}

.th-grid-wide {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.th-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.th-card:hover {
    border-color: #d2cdc3;
    box-shadow: var(--th-shadow);
}

.th-card-media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    background: var(--th-photo);
}

.th-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.th-tags {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.th-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px 14px;
}

.th-card-title {
    color: var(--th-text) !important;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
}

.th-card-title:hover {
    color: var(--th-green) !important;
    text-decoration: underline;
}

.th-card-actions {
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    gap: 8px;
}

.th-card-actions .th-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    font-size: 14px;
}

.th-rating {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.th-rating-empty {
    color: var(--th-muted);
}

.th-rating-value {
    font-weight: 700;
}

.th-rating-count {
    color: var(--th-muted);
}

/* Звёзды: 5 символов ★, закрашенная часть — по --rating (0–5) */
.th-stars {
    --percent: calc(var(--rating) / 5 * 100%);
    display: inline-block;
    font-size: 15px;
    line-height: 1;
    letter-spacing: 1px;
}

.th-stars::before {
    content: '★★★★★';
    background: linear-gradient(90deg, var(--th-orange) var(--percent), #d6d2ca var(--percent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.th-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.th-price-now {
    font-size: 18px;
    font-weight: 700;
}

.th-price-now.is-sale {
    color: var(--th-orange-dark);
}

.th-price-old {
    color: var(--th-muted);
    font-size: 14px;
}

.th-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 28px;
}

.th-pagination:empty {
    display: none;
}

.th-page-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 10px;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    background: #fff;
    color: var(--th-text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.th-page-btn:hover:not(:disabled) {
    border-color: var(--th-green);
}

.th-page-btn.is-current {
    background: var(--th-green);
    border-color: var(--th-green);
    color: #fff;
}

.th-page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ---------- товар ---------- */

.th-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-bottom: 18px;
    font-size: 14px;
    color: var(--th-muted);
}

.th-product {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}

.th-product-media {
    position: sticky;
    top: 16px;
    background: var(--th-photo);
    border-radius: var(--th-radius);
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.th-product-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.th-product-category {
    margin: 0 0 4px;
    color: var(--th-muted);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.store-page .th-product-title {
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
}

.th-product-rating {
    display: inline-block;
    margin-bottom: 12px;
    text-decoration: none;
}

.th-product-info .th-price-now {
    font-size: 28px;
}

.th-product-info .th-price-old {
    font-size: 18px;
}

.th-stock {
    margin: 8px 0 16px;
    font-size: 15px;
    font-weight: 600;
}

.th-stock.is-in {
    color: var(--th-success);
}

.th-stock.is-out {
    color: var(--th-muted);
}

.th-buy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.th-buy .th-icon-btn {
    width: 50px;
    height: 50px;
}

.th-qty {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #cfcac0;
    border-radius: var(--th-radius-sm);
    background: #fff;
    overflow: hidden;
}

.th-qty-btn {
    width: 44px;
    min-height: 44px;
    border: 0;
    background: #f5f3ef;
    color: var(--th-text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.th-qty-btn:disabled {
    color: #b9b6b0;
    cursor: default;
}

.th-qty-input {
    width: 52px;
    border: 0;
    border-left: 1px solid #e3dfd7;
    border-right: 1px solid #e3dfd7;
    color: var(--th-text);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.th-buy .th-qty-btn,
.th-buy .th-qty-input {
    min-height: 50px;
}

.th-product-description {
    margin: 0 0 20px;
}

.th-product-info .th-section-title {
    margin-top: 28px;
}

.th-specs {
    margin: 0;
}

.th-specs div {
    display: grid;
    grid-template-columns: minmax(120px, 40%) 1fr;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--th-border);
    font-size: 15px;
}

.th-specs dt {
    color: var(--th-muted);
}

.th-specs dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.th-reviews {
    max-width: 760px;
    margin-top: 48px;
}

.th-review-form {
    margin: 0 0 24px;
    padding: 20px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}

.store-page .th-review-form h3 {
    margin: 0 0 12px;
    font-size: 18px;
}

.th-star-input {
    border: 0;
    padding: 0;
}

/* Звёзды-радиокнопки: идут 5→1, чтобы подсветка «до выбранной» работала через ~ */
.th-star-options {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 2px;
}

.th-star-options input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.th-star-options label {
    margin: 0;
    padding: 0 2px;
    color: #d6d2ca;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.th-star-options input:checked ~ label,
.th-star-options label:hover,
.th-star-options label:hover ~ label {
    color: var(--th-orange);
}

.th-star-options input:focus-visible + label {
    outline: 2px solid var(--th-green);
    outline-offset: 2px;
}

.th-review-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.th-review {
    padding: 16px 0;
    border-bottom: 1px solid var(--th-border);
}

.th-review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin-bottom: 6px;
    font-size: 15px;
}

.th-review p {
    margin: 0;
    overflow-wrap: anywhere;
}

/* ---------- корзина ---------- */

.th-cart,
.th-checkout,
.th-order {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.th-summary {
    position: sticky;
    top: 16px;
    padding: 22px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    box-shadow: var(--th-shadow);
}

.th-cart-lines {
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}

.th-cart-head,
.th-cart-line {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 100px 140px 100px 36px;
    align-items: center;
    gap: 8px 14px;
    padding: 14px 18px;
}

.th-cart-head {
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--th-border);
    color: var(--th-muted);
    font-size: 13px;
    font-weight: 600;
}

.th-cart-head span:first-child {
    grid-column: 1 / 3;
}

.th-cart-line + .th-cart-line {
    border-top: 1px solid var(--th-border);
}

.th-cart-thumb {
    display: block;
    width: 72px;
    height: 72px;
    background: var(--th-photo);
    border-radius: var(--th-radius-sm);
    overflow: hidden;
}

.th-cart-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.th-cart-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-weight: 600;
}

.th-cart-name a {
    color: var(--th-text);
    text-decoration: none;
}

.th-cart-name a:hover {
    text-decoration: underline;
}

.th-cart-sum {
    font-weight: 700;
}

.th-label-mobile {
    display: none;
}

.th-cart-remove {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--th-muted);
    font-size: 16px;
    cursor: pointer;
}

.th-cart-remove:hover {
    background: var(--th-danger-soft);
    color: var(--th-danger);
}

.th-cart-error {
    grid-column: 2 / -1;
    margin: 0;
}

.th-promo {
    margin-bottom: 16px;
}

.th-promo label {
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 600;
}

.th-promo-row {
    display: flex;
    gap: 8px;
}

.store-page .th-promo-row .th-btn {
    flex: none;
    width: auto;
}

.th-promo.is-applied p {
    margin: 0 0 6px;
}

.th-totals {
    margin: 0 0 16px;
}

.th-totals div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    font-size: 15px;
}

.th-totals dd {
    margin: 0;
    text-align: right;
}

.th-totals-discount dd {
    color: var(--th-success);
    font-weight: 600;
}

.th-totals-total {
    margin-top: 6px;
    padding-top: 12px !important;
    border-top: 1px solid var(--th-border);
    font-size: 19px !important;
    font-weight: 700;
}

/* ---------- оформление ---------- */

.th-options .th-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    cursor: pointer;
}

.th-options .th-option:has(input:checked) {
    border-color: var(--th-green);
    background: var(--th-green-soft);
}

.th-option input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    flex: none;
    accent-color: var(--th-green);
}

.th-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 15px;
}

.th-option-text .th-muted {
    font-size: 14px;
}

.th-option-price {
    margin-left: auto;
    font-weight: 700;
    white-space: nowrap;
}

.th-mini-lines {
    margin: 0 0 14px;
    padding: 0 0 10px;
    list-style: none;
    border-bottom: 1px solid var(--th-border);
}

.th-mini-lines li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    font-size: 14px;
}

/* ---------- заказ ---------- */

.th-order-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 4px;
}

.th-order-head .th-page-title {
    margin: 0;
}

.th-order-head .th-btn {
    margin-left: auto;
}

.th-order-head + .th-muted {
    margin: 0 0 20px;
}

.th-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.th-status-awaiting_payment {
    background: var(--th-orange-soft);
    color: #8a4a12;
}

.th-status-processing {
    background: #e7eefb;
    color: #24508f;
}

.th-status-shipped {
    background: #efe8fb;
    color: #5b3a9b;
}

.th-status-delivered {
    background: var(--th-success-soft);
    color: var(--th-success);
}

.th-status-cancelled {
    background: #eeeeec;
    color: #5f6461;
}

.th-order-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.th-order-items li {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--th-border);
}

.th-order-items li:last-child {
    border-bottom: 0;
}

.th-order-thumb {
    display: block;
    width: 56px;
    height: 56px;
    background: var(--th-photo);
    border-radius: var(--th-radius-sm);
    overflow: hidden;
}

.th-order-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.th-order-item-name {
    display: flex;
    flex-direction: column;
    font-weight: 600;
}

.th-order-item-name .th-muted {
    font-size: 14px;
}

.th-order-item-sum {
    font-weight: 700;
}

.th-timeline {
    margin: 0 0 16px;
    padding: 0 0 0 18px;
    list-style: none;
    border-left: 2px solid var(--th-border);
}

.th-timeline li {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0 0 14px 4px;
    font-size: 15px;
}

.th-timeline li::before {
    content: '';
    position: absolute;
    top: 6px;
    left: -26px;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--th-green);
    box-shadow: 0 0 0 1px var(--th-green);
}

.th-timeline li:last-child::before {
    background: var(--th-orange);
    box-shadow: 0 0 0 1px var(--th-orange);
}

.th-timeline .th-muted {
    font-size: 13px;
}

.th-pay .th-field-row {
    grid-template-columns: 1fr 120px;
}

/* ---------- вход, регистрация, кабинет ---------- */

.th-auth {
    max-width: 460px;
    margin: 0 auto;
}

.th-auth-switch {
    text-align: center;
}

.th-account {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

.th-orders-head,
.th-orders-row {
    display: grid;
    grid-template-columns: 110px 1fr 100px 170px;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
}

.th-orders-head {
    color: var(--th-muted);
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--th-border);
}

.th-orders-row {
    color: var(--th-text) !important;
    text-decoration: none;
    border-bottom: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    font-size: 15px;
}

.th-orders-row:hover {
    background: var(--th-green-soft);
}

.th-orders-id {
    font-weight: 700;
}

/* ---------- уведомление ---------- */

.th-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 100;
    max-width: min(92vw, 480px);
    padding: 12px 20px;
    border-radius: var(--th-radius);
    background: var(--th-green-dark);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.th-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.th-toast.is-error {
    background: var(--th-danger);
}

/* ---------- планшет ---------- */

@media screen and (max-width: 1024px) {
    .th-catalog {
        grid-template-columns: 1fr;
    }

    .th-filters {
        position: static;
        display: none;
    }

    .th-filters.is-open {
        display: block;
    }

    .th-filters-toggle {
        display: inline-flex !important;
    }

    .th-grid,
    .th-grid-wide {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .th-cart,
    .th-checkout,
    .th-order,
    .th-account {
        grid-template-columns: 1fr;
    }

    .th-summary {
        position: static;
    }

    .th-nav-text {
        display: none;
    }
}

/* ---------- телефон ---------- */

@media screen and (max-width: 768px) {
    .store-page {
        font-size: 15px;
    }

    .th-top {
        margin-top: 0;
    }

    .th-header {
        padding: 10px 12px;
    }

    .th-rb {
        top: 10px;
        left: 12px;
    }

    .th-rb-ball {
        box-shadow: none;
    }

    .th-rb-panel {
        top: 52px;
    }

    .th-logo {
        margin-left: 52px;
    }

    .th-lang {
        display: none;
    }

    .th-header-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .th-logo img {
        width: 132px;
    }

    .th-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    .th-nav-wish,
    .th-nav-account {
        display: none !important;
    }

    .th-burger {
        display: inline-block;
    }

    .th-grid,
    .th-grid-wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .store-page .th-page-title,
    .store-page .th-product-title {
        font-size: 24px;
    }

    .th-results-tools {
        width: 100%;
    }

    .th-sort {
        flex: 1;
    }

    .th-sort span {
        display: none;
    }

    .th-price-range input {
        min-width: 160px;
    }

    .th-sort select {
        min-width: 0;
        width: 100%;
    }

    .th-product {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .th-product-media {
        position: static;
    }

    .th-panel,
    .th-summary {
        padding: 16px;
    }

    .th-field-row,
    .th-pay .th-field-row {
        grid-template-columns: 1fr;
    }

    /* Корзина: строки — карточками */
    .th-cart-head {
        display: none;
    }

    .th-cart-line {
        grid-template-columns: 72px minmax(0, 1fr) 36px;
        grid-template-areas:
            'thumb name remove'
            'thumb price price'
            'qty qty sum'
            'error error error';
        padding: 14px;
    }

    .th-cart-thumb { grid-area: thumb; }
    .th-cart-name { grid-area: name; }
    .th-cart-price { grid-area: price; color: var(--th-muted); }
    .th-cart-qty { grid-area: qty; }
    .th-cart-sum { grid-area: sum; text-align: right; }
    .th-cart-remove { grid-area: remove; align-self: start; }
    .th-cart-error { grid-area: error; }

    .th-label-mobile {
        display: inline;
        font-weight: 400;
        color: var(--th-muted);
    }

    .th-orders-head {
        display: none;
    }

    .th-orders-row {
        grid-template-columns: 1fr auto;
        gap: 4px 12px;
    }

    .th-order-head .th-btn {
        margin-left: 0;
    }
}

@media screen and (max-width: 400px) {
    .th-grid,
    .th-grid-wide {
        grid-template-columns: 1fr;
    }

    .th-card-media {
        aspect-ratio: 4 / 3;
    }
}

/* ---------- экран необработанной ошибки ---------- */

body.th-crash {
    justify-content: center;
    background: #fff;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

body.th-crash::before {
    display: none;
}
