:root {
    --bg: #f3f5f8;
    --panel: #ffffff;
    --soft: #f8fafc;
    --text: #111827;
    --muted: #667085;
    --line: #d9e0ea;
    --brand: #e30613;
    --brand-dark: #b8000b;
    --ink: #111827;
    --danger: #b42318;
    --ok: #157347;
    --warn: #9a6700;
    --radius: 8px;
    --tap: 48px;
    --shadow: 0 14px 34px rgba(17, 24, 39, .10);
    --shadow-soft: 0 8px 22px rgba(17, 24, 39, .07);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100dvh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, #ffffff 0, var(--bg) 280px),
        var(--bg);
    line-height: 1.5;
}

img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.topbar {
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.telegram-user-bar {
    border-top: 1px solid #edf0f5;
    padding: 8px 20px;
    background: #eef6ff;
    color: #1f4f78;
    text-align: center;
    font-size: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: 0;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--ink);
    font-weight: 700;
}

.nav a:hover {
    background: #eef2f7;
    text-decoration: none;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 30px 20px 56px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-end;
    margin-bottom: 24px;
}

h1, h2, h3 { margin: 0 0 10px; line-height: 1.2; }
h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 900; letter-spacing: 0; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p { margin: 0 0 12px; }

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

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.card, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.card form,
.card details,
.favorite-form {
    position: relative;
    z-index: 2;
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-3px);
        border-color: #c8d1de;
        box-shadow: var(--shadow);
    }
}

.card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background:
        linear-gradient(135deg, #111827 0 46%, #e30613 46% 54%, #f1f5f9 54% 100%);
}

.product-placeholder {
    display: grid;
    place-items: center;
    min-height: 190px;
}

.product-placeholder::before {
    content: "DIMAX";
    color: #ffffff;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 0;
}

.card-body {
    padding: 18px;
    display: flex;
    flex: 1;
    flex-direction: column;
}

.card-body form { margin-top: auto; }

.price {
    font-size: 22px;
    font-weight: 900;
    margin: 10px 0 16px;
    color: var(--brand);
}

.tier-list {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.tier-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 9px;
    border: 0;
    border-radius: 6px;
    background: #fff200;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
}

.tier-line strong {
    color: #111827;
    white-space: nowrap;
}

.tier-editor {
    gap: 9px;
}

.tier-edit-row {
    display: grid;
    grid-template-columns: minmax(110px, .8fr) minmax(140px, 1fr);
    gap: 10px;
}

.order-total {
    display: grid;
    gap: 10px;
    margin: 16px 0 4px;
}

.order-total > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    background: #111827;
    color: #fff;
}

.order-total span {
    color: #d1d5db;
}

.order-total strong {
    white-space: nowrap;
}

.panel {
    padding: 20px;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}

label { font-weight: 700; font-size: 14px; }

input, textarea, select {
    width: 100%;
    min-height: var(--tap);
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    padding: 12px 13px;
    font: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(227, 6, 19, .12);
}

textarea {
    min-height: 108px;
    resize: vertical;
}

.drop-zone {
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 132px;
    padding: 18px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.drop-zone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--brand);
    background: #fff5f5;
    box-shadow: 0 0 0 4px rgba(227, 6, 19, .08);
}

.drop-title {
    font-weight: 900;
    color: var(--text);
}

.drop-text {
    color: var(--muted);
    font-size: 13px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: var(--radius);
    padding: 12px 16px;
    min-height: var(--tap);
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    box-shadow: 0 8px 18px rgba(227, 6, 19, .18);
    transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}

.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.secondary { background: #111827; color: #fff; box-shadow: 0 8px 18px rgba(17, 24, 39, .13); }
.btn.secondary:hover { background: #263244; }
.btn.danger { background: var(--danger); }
.btn:disabled {
    cursor: not-allowed;
    opacity: .55;
    transform: none;
}

.flash {
    padding: 13px 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--line);
    background: #eefbf4;
    color: var(--ok);
    font-weight: 700;
}

.flash.error {
    background: #fff1f0;
    color: var(--danger);
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: var(--panel);
}

th, td {
    text-align: left;
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-size: 13px;
    color: var(--muted);
    background: var(--soft);
    text-transform: uppercase;
    letter-spacing: 0;
}

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
}

.badge.new { background: #e0f2fe; color: #075985; }
.badge.accepted { background: #dcfce7; color: #166534; }
.badge.done { background: #f0fdf4; color: #16703a; }
.badge.cancelled { background: #fee2e2; color: #991b1b; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }

.telegram-admin-box,
.telegram-checkout-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    border: 1px solid #cfe3ff;
    border-radius: var(--radius);
    background: #f4f9ff;
}

.telegram-admin-box {
    margin-top: 16px;
}

.telegram-admin-box p {
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

.telegram-checkout-user {
    margin-bottom: 14px;
    color: #1f4f78;
}

.footer {
    border-top: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    padding: 20px 20px 96px;
    text-align: center;
}

.setup-page {
    background:
        linear-gradient(180deg, #ffffff 0, var(--bg) 360px),
        var(--bg);
}

.wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 34px 18px;
}

.setup-page .panel {
    padding: 24px;
    box-shadow: var(--shadow);
}

.alert {
    padding: 13px 15px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    background: #fff1f0;
    color: var(--danger);
    font-weight: 700;
}

.ok { background: #eefbf4; color: var(--ok); }

.mobile-market-head {
    display: none;
}

.product-rating {
    display: none;
}

.sort-menu {
    position: relative;
    width: fit-content;
    margin: 0 0 18px;
}

.sort-menu summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    color: var(--muted);
    font-size: 14px;
}

.sort-menu summary::-webkit-details-marker {
    display: none;
}

.sort-menu summary::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-right: 2px solid #111827;
    border-bottom: 2px solid #111827;
    transform: translateY(-2px) rotate(45deg);
}

.sort-menu[open] summary::after {
    transform: translateY(2px) rotate(225deg);
}

.sort-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    min-width: 220px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(17, 24, 39, .14);
}

.sort-options a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 16px;
    border-bottom: 1px solid #edf0f5;
    color: #252b36;
    font-size: 14px;
}

.sort-options a:last-child {
    border-bottom: 0;
}

.sort-options a:hover {
    background: #f7f8fb;
    text-decoration: none;
}

.sort-options a.active {
    color: var(--brand);
}

.sort-options a.active::after {
    content: "✓";
    font-weight: 900;
}

@media (max-width: 920px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    :root {
        --brand: #7000ff;
        --brand-dark: #5b00d6;
        --bg: #ffffff;
        --line: #eef0f5;
        --radius: 10px;
        --shadow-soft: none;
    }

    body {
        background: #ffffff;
        color: #1f2430;
    }

    .topbar {
        position: static;
        border-bottom: 0;
        background: #ffffff;
        backdrop-filter: none;
    }

    .catalog-page .topbar {
        display: none;
    }

    .topbar-inner {
        align-items: stretch;
        flex-direction: column;
        padding: 12px 16px 4px;
        gap: 8px;
    }

    .brand {
        min-height: 26px;
        font-size: 22px;
        line-height: 1;
        text-transform: uppercase;
    }

    .container {
        padding: 0 12px 28px;
    }

    .mobile-market-head {
        display: block;
        padding: 0 0 14px;
    }

    .mobile-market-brand {
        display: grid;
        grid-template-columns: 38px 1fr auto;
        align-items: center;
        gap: 10px;
        margin-bottom: 14px;
    }

    .mobile-logo {
        display: grid;
        place-items: center;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: #7000ff;
        color: #fff;
        font-weight: 900;
        box-shadow: 0 8px 18px rgba(112, 0, 255, .22);
    }

    .mobile-market-brand strong,
    .mobile-market-brand span {
        display: block;
    }

    .mobile-market-brand strong {
        font-size: 14px;
    }

    .mobile-market-brand span {
        color: #697386;
        font-size: 11px;
        margin-top: 1px;
    }

    .mobile-call {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 34px;
        padding: 0 12px;
        border-radius: 10px;
        background: #7000ff;
        color: #fff;
        font-size: 13px;
        font-weight: 800;
    }

    .mobile-call:hover {
        text-decoration: none;
    }

    .mobile-search {
        display: grid;
        grid-template-columns: 28px 1fr auto;
        align-items: center;
        gap: 4px;
        height: 42px;
        margin-bottom: 12px;
        padding: 0 8px 0 12px;
        border-radius: 9px;
        background: #edf0f5;
    }

    .mobile-search span {
        width: 15px;
        height: 15px;
        border: 2px solid #1f2937;
        border-radius: 50%;
        position: relative;
    }

    .mobile-search span::after {
        content: "";
        position: absolute;
        width: 7px;
        height: 2px;
        right: -6px;
        bottom: -4px;
        background: #1f2937;
        transform: rotate(45deg);
        border-radius: 2px;
    }

    .mobile-search input {
        min-height: 34px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        font-size: 15px;
    }

    .mobile-search input:focus {
        box-shadow: none;
    }

    .mobile-search button {
        min-height: 30px;
        border: 0;
        border-radius: 8px;
        padding: 0 10px;
        background: #ffffff;
        color: #7000ff;
        font-weight: 800;
    }

    .mobile-breadcrumb {
        color: #657086;
        font-size: 11px;
        margin: 10px 0 12px;
    }

    .mobile-market-head h1 {
        margin: 0 0 12px;
        font-size: 16px;
        font-weight: 500;
    }

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

    .mobile-chips::-webkit-scrollbar {
        display: none;
    }

    .mobile-chips a {
        flex: 0 0 auto;
        padding: 9px 12px;
        border-radius: 12px;
        background: #eef0f5;
        color: #111827;
        font-size: 14px;
        font-weight: 700;
    }

    .mobile-chips a:hover {
        text-decoration: none;
    }

    .mobile-market-head .sort-menu {
        margin: 14px 0 0;
    }

    .mobile-market-head .sort-menu summary {
        display: inline-flex;
        align-items: center;
        min-height: 34px;
        padding: 0 10px;
        border-radius: 10px;
        background: #ffffff;
        color: #5f6675;
        font-size: 13px;
    }

    .mobile-market-head .sort-options {
        min-width: 190px;
    }

    .desktop-sort {
        display: none;
    }

    .catalog-head {
        display: none;
    }

    .nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .nav a {
        justify-content: center;
        min-height: 44px;
        padding: 9px 8px;
        background: #f1f5f9;
        font-size: 14px;
        text-align: center;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
        margin-bottom: 18px;
    }

    .page-head .btn { width: 100%; }

    h1 { font-size: 30px; }
    h2 { font-size: 22px; }

    .grid { grid-template-columns: 1fr; gap: 14px; }
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 20px 12px;
    }

    .product-card {
        position: relative;
        display: grid;
        grid-template-rows: auto 1fr;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: #ffffff;
        overflow: visible;
    }

    .product-card::after {
        content: "♡";
        position: absolute;
        top: 7px;
        right: 7px;
        display: grid;
        place-items: center;
        width: 27px;
        height: 27px;
        border-radius: 50%;
        background: rgba(255, 255, 255, .82);
        color: #7b8190;
        font-size: 19px;
        line-height: 1;
        z-index: 2;
    }

    .product-card .card-img {
        width: 100%;
        aspect-ratio: 1 / 1.25;
        border-radius: 8px;
        object-fit: cover;
        background:
            linear-gradient(135deg, #e8ebf2 0 38%, #ffffff 38% 52%, #e1e5ee 52% 100%);
    }

    .product-card .product-placeholder {
        min-height: 0;
        height: auto;
    }

    .product-card .product-placeholder::before {
        color: #7000ff;
        font-size: 22px;
    }

    .product-card .card-body {
        display: grid;
        grid-template-rows: auto auto auto auto 1fr auto;
        padding: 8px 4px 0;
        min-height: 0;
    }

    .product-card .price {
        order: 1;
        margin: 0 0 4px;
        color: #7000ff;
        font-size: 16px;
        line-height: 1.15;
        font-weight: 900;
    }

    .product-card .product-title {
        order: 3;
        margin: 3px 0 2px;
        font-size: 13px;
        line-height: 1.22;
        font-weight: 500;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-card .product-desc {
        order: 4;
        margin: 0 0 4px;
        font-size: 11px;
        line-height: 1.25;
        color: #6b7280;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-card .tier-list {
        order: 2;
        gap: 4px;
        margin: 0 0 5px;
    }

    .product-card .tier-line {
        display: none;
        padding: 4px 6px;
        border: 0;
        border-radius: 5px;
        background: #ffff00;
        color: #111827;
        font-size: 11px;
        line-height: 1.1;
        font-weight: 700;
    }

    .product-card .tier-line:first-child {
        display: flex;
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
    }

    .product-card .tier-line strong {
        color: #111827;
        font-size: 11px;
    }

    .product-rating {
        display: block;
        order: 5;
        margin: 0 0 8px;
        color: #6b7280;
        font-size: 11px;
        line-height: 1.2;
    }

    .product-card form {
        order: 6;
        margin-top: auto;
    }

    .product-card .btn {
        min-height: 34px;
        padding: 8px 10px;
        border-radius: 7px;
        background: #7000ff;
        box-shadow: none;
        font-size: 13px;
    }

    .product-card .btn::before {
        content: "+";
        font-weight: 900;
    }

    .panel { padding: 16px; margin-bottom: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .card-body { padding: 16px; }
    .btn { width: 100%; }
    .actions { align-items: stretch; }
    .actions > * { flex: 1 1 150px; }
    table { min-width: 720px; }
    .tier-edit-row { grid-template-columns: 1fr; }
    .tier-line { align-items: flex-start; flex-direction: column; }
    .order-total > div { align-items: flex-start; flex-direction: column; }

    .wrap { padding: 18px 14px 40px; }
    .setup-page .panel { padding: 18px; }
}

@media (max-width: 380px) {
    .nav { grid-template-columns: 1fr; }
    h1 { font-size: 27px; }
    .container { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 720px) {
    :root {
        --brand: #e30613;
        --brand-dark: #b8000b;
        --bg: #f3f5f8;
        --line: #d9e0ea;
        --radius: 8px;
        --shadow-soft: 0 8px 22px rgba(17, 24, 39, .07);
    }

    body {
        background:
            linear-gradient(180deg, #ffffff 0, var(--bg) 260px),
            var(--bg);
    }

    .catalog-page .topbar {
        display: block;
    }

    .topbar {
        position: sticky;
        border-bottom: 1px solid var(--line);
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(12px);
    }

    .topbar-inner {
        padding: 14px 16px;
    }

    .brand {
        min-height: 34px;
        font-size: 22px;
        color: #111827;
    }

    .container {
        padding: 22px 14px 40px;
    }

    .catalog-head {
        display: flex;
        gap: 14px;
        margin-bottom: 16px;
    }

    .catalog-head h1 {
        font-size: 34px;
        line-height: 1.05;
    }

    .catalog-head p {
        font-size: 15px;
        line-height: 1.35;
    }

    .catalog-head .btn {
        width: 100%;
        min-height: 44px;
        border-radius: 7px;
        background: #111827;
        box-shadow: 0 8px 18px rgba(17, 24, 39, .14);
    }

    .desktop-sort {
        display: block;
        margin: 0 0 18px;
    }

    .sort-menu summary {
        color: #556070;
        font-size: 14px;
    }

    .sort-options {
        left: 0;
        min-width: 210px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 16px 10px;
    }

    .product-card {
        position: relative;
        display: grid;
        grid-template-rows: auto 1fr;
        overflow: hidden;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        background: #ffffff;
        box-shadow: 0 6px 16px rgba(17, 24, 39, .06);
    }

    .product-card::after {
        content: "♡";
        position: absolute;
        top: 7px;
        right: 7px;
        z-index: 2;
        display: grid;
        place-items: center;
        width: 27px;
        height: 27px;
        border-radius: 50%;
        background: rgba(255, 255, 255, .84);
        color: #7b8190;
        font-size: 18px;
    }

    .product-card .card-img {
        width: 100%;
        aspect-ratio: 1 / 1.08;
        border-radius: 0;
        object-fit: cover;
        background:
            linear-gradient(135deg, #111827 0 38%, #e30613 38% 48%, #eef2f7 48% 100%);
    }

    .product-card .product-placeholder {
        min-height: 0;
    }

    .product-card .product-placeholder::before {
        color: #ffffff;
        font-size: 22px;
    }

    .product-card .card-body {
        display: grid;
        grid-template-rows: auto auto auto auto 1fr auto;
        padding: 9px 9px 10px;
        min-height: 0;
    }

    .product-card .price {
        order: 1;
        margin: 0 0 5px;
        color: #e30613;
        font-size: 17px;
        line-height: 1.12;
        font-weight: 900;
    }

    .product-card .tier-list {
        order: 2;
        gap: 0;
        margin: 0 0 6px;
    }

    .product-card .tier-line {
        display: none;
        align-items: center;
        justify-content: space-between;
        flex-direction: row;
        gap: 8px;
        padding: 5px 7px;
        border: 0;
        border-radius: 5px;
        background: #fff200;
        color: #111827;
        font-size: 11px;
        font-weight: 800;
        line-height: 1.1;
    }

    .product-card .tier-line:first-child {
        display: flex;
    }

    .product-card .tier-line strong {
        color: #111827;
        font-size: 11px;
        white-space: nowrap;
    }

    .product-card .product-title {
        order: 3;
        margin: 0 0 4px;
        font-size: 13px;
        line-height: 1.22;
        font-weight: 700;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-card .product-desc {
        order: 4;
        margin: 0 0 5px;
        color: #667085;
        font-size: 11px;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-rating {
        display: block;
        order: 5;
        margin: 0 0 8px;
        color: #667085;
        font-size: 11px;
        line-height: 1.2;
    }

    .product-card form {
        order: 6;
        margin-top: auto;
    }

    .product-card .btn {
        width: 100%;
        min-height: 36px;
        padding: 8px;
        border-radius: 7px;
        background: #e30613;
        box-shadow: none;
        font-size: 13px;
    }

    .product-card .btn::before {
        content: "+";
        font-weight: 900;
    }
}

.desktop-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.desktop-menu a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #111827;
    font-weight: 800;
}

.desktop-menu a:hover {
    background: #eef2f7;
    text-decoration: none;
}

.mobile-footbar {
    display: none;
}

.footer {
    padding-bottom: 20px;
}

@media (max-width: 720px) {
    .desktop-menu {
        display: none;
    }

    .mobile-footbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        min-height: 58px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        border-top: 1px solid #e5e7eb;
        border-radius: 0;
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(12px);
        box-shadow: 0 -8px 20px rgba(17, 24, 39, .08);
        transform: none;
        width: auto;
    }

    .mobile-footbar a {
        display: grid;
        place-items: center;
        gap: 2px;
        min-height: 44px;
        color: #667085;
        font-size: 11px;
        font-weight: 700;
    }

    .mobile-footbar a:first-child {
        color: var(--brand);
    }

    .mobile-footbar span {
        font-size: 22px;
        line-height: 1;
    }

    .footer {
        padding-bottom: 82px;
    }
}

.catalog-search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin: 0 0 18px;
}

.favorite-form {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
}

.favorite-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: #667085;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(17, 24, 39, .12);
}

.favorite-btn.active {
    color: var(--brand);
}

.review-box {
    display: grid;
    gap: 8px;
    margin: 0 0 12px;
}

.review-box summary {
    cursor: pointer;
    color: var(--brand);
    font-size: 13px;
    font-weight: 800;
}

.review-box > strong {
    color: var(--brand);
    font-size: 13px;
}

.review-box input,
.review-box select,
.review-box textarea {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
}

.review-box textarea {
    min-height: 70px;
}

.product-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: auto;
}

.product-actions form {
    margin: 0;
}

.cart-list {
    display: grid;
    gap: 14px;
}

.cart-item {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 14px;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.cart-item:last-of-type {
    border-bottom: 0;
}

.cart-item img,
.cart-img-placeholder {
    display: grid;
    place-items: center;
    width: 96px;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    object-fit: cover;
    background: #111827;
    color: #fff;
    font-weight: 900;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 20px;
}

.admin-quick-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-quick-panel p {
    margin-bottom: 0;
}

.admin-quick-panel .btn {
    min-width: 220px;
}

.mobile-footbar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    width: min(520px, calc(100% - 32px));
    min-height: 58px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
    box-shadow: 0 14px 34px rgba(17, 24, 39, .14);
    transform: translateX(-50%);
}

.mobile-footbar a {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 44px;
    border-radius: 10px;
    color: #667085;
    font-size: 12px;
    font-weight: 800;
}

.mobile-footbar a:hover {
    background: #f3f5f8;
    text-decoration: none;
}

.mobile-footbar a:first-child {
    color: var(--brand);
}

.mobile-footbar span {
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 720px) {
    .catalog-search {
        grid-template-columns: 1fr auto;
        gap: 8px;
        margin-bottom: 14px;
    }

    .catalog-search input {
        min-height: 42px;
        border-radius: 8px;
        background: #eef2f7;
    }

    .catalog-search .btn {
        width: auto;
        min-height: 42px;
        padding: 8px 12px;
    }

    .product-card::after {
        content: none;
    }

    .product-card .favorite-form {
        top: 7px;
        right: 7px;
    }

    .product-card .favorite-btn {
        width: 28px;
        height: 28px;
        font-size: 18px;
        box-shadow: none;
    }

    .product-card .review-box {
        order: 6;
        margin: 0 0 8px;
    }

    .product-card .review-box summary {
        font-size: 11px;
    }

    .product-card .review-box input,
    .product-card .review-box select,
    .product-card .review-box textarea {
        min-height: 34px;
        padding: 6px 8px;
        font-size: 12px;
    }

    .product-card .review-box textarea {
        min-height: 54px;
    }

    .product-card .product-actions {
        order: 7;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .product-card .product-actions form {
        margin: 0;
    }

    .product-card .cart-add-btn {
        background: #111827;
    }

    .mobile-footbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        min-height: 58px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        border-top: 1px solid #e5e7eb;
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(12px);
        box-shadow: 0 -8px 20px rgba(17, 24, 39, .08);
    }

    .mobile-footbar a {
        display: grid;
        place-items: center;
        gap: 2px;
        color: #667085;
        font-size: 11px;
        font-weight: 700;
    }

    .mobile-footbar a:first-child {
        color: var(--brand);
    }

    .mobile-footbar span {
        font-size: 22px;
        line-height: 1;
    }

    .footer {
        padding-bottom: 82px;
    }

    .cart-item {
        grid-template-columns: 76px 1fr;
    }

    .cart-item form {
        grid-column: 1 / -1;
    }

    .cart-item img,
    .cart-img-placeholder {
        width: 76px;
    }

    .admin-quick-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-quick-panel .btn {
        min-width: 0;
    }
}

/* Final responsive polish: keep the web menu on desktop and the app-like bar only on mobile. */
.mobile-footbar {
    display: none !important;
}

@media (min-width: 921px) {
    .desktop-menu {
        display: flex !important;
    }

    .footer {
        padding-bottom: 20px !important;
    }
}

@media (max-width: 920px) {
    body {
        background: #f4f6fa;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: block !important;
        border-bottom: 1px solid #d8e0ea;
        background: #fff;
    }

    .topbar-inner {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 68px;
        padding: 16px;
    }

    .brand {
        min-height: auto;
        font-size: 22px;
        letter-spacing: 0;
    }

    .desktop-menu {
        display: none !important;
    }

    .container {
        width: 100%;
        padding: 22px 14px 96px;
    }

    .catalog-head {
        display: flex !important;
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 16px;
    }

    .catalog-head h1 {
        font-size: 34px;
        line-height: 1.05;
    }

    .catalog-head .lead {
        font-size: 16px;
    }

    .catalog-head .btn {
        width: 100%;
        min-height: 48px;
        border-radius: 7px;
        background: #111827;
        box-shadow: 0 14px 28px rgba(17, 24, 39, .14);
    }

    .catalog-search {
        display: grid !important;
        grid-template-columns: 1fr auto;
        gap: 8px;
        margin-bottom: 14px;
    }

    .catalog-search input {
        min-height: 44px;
        border-radius: 8px;
        background: #eef2f7;
        font-size: 15px;
    }

    .catalog-search .btn {
        width: auto;
        min-height: 44px;
        padding: 8px 14px;
        border-radius: 8px;
        background: var(--brand);
    }

    .desktop-sort {
        display: block !important;
        margin-bottom: 14px;
    }

    .product-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 10px;
    }

    .product-card {
        position: relative;
        display: grid;
        overflow: hidden;
        min-width: 0;
        border: 1px solid #dbe3ee;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 10px 24px rgba(17, 24, 39, .08);
    }

    .product-card::after {
        content: none !important;
    }

    .product-card-link {
        display: grid;
        min-width: 0;
        color: inherit;
        text-decoration: none;
    }

    .product-card .card-img {
        width: 100%;
        aspect-ratio: 1 / 1.08;
        min-height: 0;
        border-radius: 0;
        background: #edf1f6;
    }

    .product-card .card-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .product-card .product-placeholder {
        min-height: 0;
    }

    .product-card .product-placeholder::before {
        color: #fff;
        font-size: clamp(22px, 7vw, 30px);
    }

    .product-card .card-body {
        display: grid;
        min-width: 0;
        padding: 9px;
    }

    .product-card .price {
        order: 1;
        margin: 0 0 4px;
        color: var(--brand);
        font-size: 18px;
        line-height: 1.1;
        letter-spacing: 0;
    }

    .product-card .tier-list {
        order: 2;
        display: block;
        margin: 0 0 6px;
    }

    .product-card .tier-line {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        min-height: 26px;
        padding: 4px 7px;
        border: 0;
        border-radius: 5px;
        background: #fff200;
        color: #000;
        font-size: 11px;
        font-weight: 900;
        line-height: 1.15;
    }

    .product-card .tier-line span:last-child {
        white-space: nowrap;
    }

       .product-card .product-title {
        order: 3;
        display: -webkit-box;
        overflow: hidden;
        margin: 10px 0 10px;
        color: #050b18;
        font-size: 13px;
        line-height: 1.2;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }


    .product-card .product-desc {
        order: 4;
        display: -webkit-box;
        overflow: hidden;
        min-height: 26px;
        margin: 0 0 2px;
        color: #52637a;
        font-size: 11px;
        line-height: 1.2;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .product-rating {
        order: 5;
        margin: 0 0 8px;
        color: #52637a;
        font-size: 11px;
        line-height: 1.2;
    }

    .product-card .review-box {
        display: none !important;
    }

    .product-card .product-actions {
        order: 6;
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        margin-top: 0;
    }

    .product-card .product-actions form:first-child {
        display: none;
    }

    .product-card .product-actions form:last-child {
        display: block;
        margin: 0;
    }

    .product-card .product-actions .btn {
        width: 100%;
        min-height: 36px;
        padding: 8px 10px;
        border-radius: 7px;
        background: var(--brand);
        color: #fff;
        font-size: 13px;
        box-shadow: none;
    }

    .favorite-form {
        position: absolute;
        top: 7px;
        right: 7px;
        z-index: 8;
    }

    .favorite-btn {
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        min-height: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, .92);
        color: #6b7890;
        font-size: 18px;
        line-height: 1;
        box-shadow: 0 6px 18px rgba(17, 24, 39, .08);
    }

    .favorite-btn.active,
    .favorite-btn:hover {
        color: var(--brand);
        background: #fff;
    }

    .mobile-footbar {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 80 !important;
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        width: 100% !important;
        min-height: 62px;
        padding: 6px 10px calc(7px + env(safe-area-inset-bottom));
        border: 0;
        border-top: 1px solid #e3e8f0;
        border-radius: 0 !important;
        background: rgba(255, 255, 255, .98);
        box-shadow: 0 -10px 24px rgba(17, 24, 39, .10);
        transform: none !important;
        backdrop-filter: blur(12px);
    }

    .mobile-footbar.has-back {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .mobile-footbar a {
        display: grid;
        place-items: center;
        gap: 3px;
        min-width: 0;
        min-height: 48px;
        border-radius: 10px;
        color: #6b7890;
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
        text-decoration: none;
    }

    .mobile-footbar a:first-child {
        color: var(--brand);
    }

    .mobile-footbar span {
        display: block;
        font-size: 22px;
        line-height: 1;
    }

    .mobile-footbar .footbar-icon {
        display: grid;
        place-items: center;
        width: 24px;
        height: 24px;
        font-size: 0;
    }

    .mobile-footbar .footbar-icon svg {
        display: block;
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .footer {
        padding-bottom: 86px !important;
    }
}

@media (max-width: 380px) {
    .container {
        padding-inline: 10px;
    }

    .product-grid {
        gap: 14px 8px;
    }

    .product-card .price {
        font-size: 16px;
    }

    .product-card .tier-line {
        font-size: 10px;
        padding-inline: 5px;
    }
}

/* Keep the favorite heart pinned to the product image corner on every layout. */
.product-card > .favorite-form {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 20 !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
}

.product-card > .favorite-form .favorite-btn {
    display: grid !important;
    place-items: center;
    width: 32px !important;
    height: 32px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(209, 218, 230, .9) !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, .94) !important;
    color: #6b7890 !important;
    line-height: 1 !important;
    box-shadow: 0 8px 18px rgba(17, 24, 39, .16) !important;
    backdrop-filter: blur(8px);
}

.product-card > .favorite-form .favorite-btn.active,
.product-card > .favorite-form .favorite-btn:hover {
    border-color: rgba(227, 6, 19, .25) !important;
    background: #fff !important;
    color: var(--brand) !important;
}

@media (max-width: 920px) {
    .product-card > .favorite-form {
        top: 7px !important;
        right: 7px !important;
    }

    .product-card > .favorite-form .favorite-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 18px !important;
    }
}

/* No generated product placeholder: show a plain state only when an image is missing. */
.card-img {
    background: #f3f6fb !important;
}

.product-placeholder,
.product-placeholder::before {
    content: none !important;
}

.no-image {
    display: grid !important;
    place-items: center !important;
    color: #7a8798 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    text-transform: none !important;
    background: #f3f6fb !important;
}

.product-card .no-image {
    aspect-ratio: 4 / 3;
}

@media (max-width: 920px) {
    .product-card .no-image {
        aspect-ratio: 1 / 1.08;
    }
}

.checkout-form {
    margin-bottom: 20px;
}

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

.checkout-main {
    display: grid;
    gap: 16px;
}

.checkout-side {
    position: sticky;
    top: 86px;
    display: grid;
    gap: 14px;
}

.checkout-card {
    display: grid;
    gap: 16px;
}

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

.checkout-product-media {
    width: 132px;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
    background: #f3f6fb;
}

.checkout-product-body h2 {
    margin-bottom: 6px;
}

.checkout-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.checkout-price span,
.summary-row span,
.checkout-submit-bar span {
    color: var(--muted);
}

.checkout-price strong {
    color: var(--brand);
    font-size: 22px;
    white-space: nowrap;
}

.checkout-quantity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.quantity-stepper {
    display: grid;
    grid-template-columns: 44px 72px 44px;
    min-height: 44px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

.quantity-stepper input {
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    text-align: center;
    font-weight: 800;
    -moz-appearance: textfield;
}

.quantity-stepper input::-webkit-outer-spin-button,
.quantity-stepper input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.qty-btn {
    min-height: 44px;
    border: 0;
    background: #fff;
    color: #687386;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.qty-btn:hover {
    background: #f3f6fb;
}

.checkout-tiers {
    margin: 0;
}

.customer-panel h2,
.checkout-summary h2,
.review-panel h2 {
    margin-bottom: 14px;
}

.checkout-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
}

.checkout-fields .full {
    grid-column: 1 / -1;
}

.phone-panel .field {
    margin-bottom: 0;
}

.checkout-summary {
    display: grid;
    gap: 12px;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.summary-row.total {
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 20px;
}

.summary-row.total strong,
.checkout-submit-bar strong {
    color: var(--brand);
    white-space: nowrap;
}

.checkout-submit-bar {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.checkout-submit-bar > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.checkout-submit-bar .btn {
    width: 100%;
}

@media (max-width: 920px) {
    .checkout-head {
        margin-bottom: 14px;
    }

    .checkout-head h1 {
        font-size: 30px;
    }

    .checkout-shell {
        display: block;
    }

    .checkout-main {
        gap: 12px;
    }

    .checkout-side {
        position: static;
        display: block;
    }

    .checkout-card,
    .customer-panel,
    .checkout-summary {
        padding: 14px;
        margin-bottom: 12px;
    }

    .checkout-product {
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 12px;
    }

    .checkout-product-media {
        width: 92px;
        border-radius: 8px;
    }

    .checkout-product-body h2 {
        display: -webkit-box;
        overflow: hidden;
        margin-bottom: 4px;
        font-size: 16px;
        line-height: 1.2;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .checkout-product-body .muted {
        display: -webkit-box;
        overflow: hidden;
        margin-bottom: 0;
        font-size: 12px;
        line-height: 1.25;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .checkout-price {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
        margin-top: 8px;
        padding-top: 8px;
    }

    .checkout-price strong {
        font-size: 20px;
    }

    .checkout-quantity {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .quantity-stepper {
        width: 140px;
        grid-template-columns: 42px 56px 42px;
    }

    .checkout-tiers {
        display: grid;
        grid-template-columns: 1fr;
    }

    .checkout-fields {
        grid-template-columns: 1fr;
    }

    .checkout-summary {
        margin-bottom: 88px;
    }

    .checkout-submit-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 62px;
        z-index: 70;
        grid-template-columns: minmax(0, .8fr) minmax(150px, 1fr);
        align-items: center;
        gap: 10px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        border-right: 0;
        border-left: 0;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -8px 22px rgba(17, 24, 39, .12);
    }

    .checkout-submit-bar > div {
        display: grid;
        gap: 0;
    }

    .checkout-submit-bar span {
        font-size: 11px;
    }

    .checkout-submit-bar strong {
        overflow: hidden;
        font-size: 16px;
        text-overflow: ellipsis;
    }

    .checkout-submit-bar .btn {
        min-height: 46px;
        padding: 10px 12px;
        font-size: 14px;
    }
}
