.mg-catalog-page,
.mg-catalog-page *,
.mg-drawer,
.mg-drawer * {
    box-sizing: border-box
}

[hidden] { display: none !important; }

.mg-catalog-page {
    max-width: var(--mg-container);
    margin: 0 auto;
    padding: 0 24px 44px;
    background: var(--mg-bg);
    color: var(--mg-text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45
}

.mg-btn {
    height: 42px;
    border: 1px solid var(--mg-line);
    border-radius: 13px;
    background: #fff;
    color: var(--mg-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 15px;
    font-weight: 780;
    white-space: nowrap;
    cursor: pointer;
    transition: .14s ease
}

.mg-btn:hover {
    border-color: var(--mg-line-2);
    transform: translateY(-1px)
}

.mg-btn--primary {
    background: var(--mg-accent);
    border-color: var(--mg-accent);
    color: #fff;
    box-shadow: 0 10px 22px rgba(130, 1, 0, .14)
}

.mg-btn--primary:hover {
    background: var(--mg-accent-dark);
    border-color: var(--mg-accent-dark);
    color: #fff
}

.mg-btn--soft {
    background: #fff;
    border-color: rgba(130, 1, 0, .34);
    color: var(--mg-accent)
}

.mg-btn--small {
    height: 32px;
    padding: 0 10px
}

.mg-icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--mg-line);
    border-radius: 13px;
    background: #fff;
    display: grid;
    place-items: center;
    color: var(--mg-muted);
    cursor: pointer;
    transition: border-color .14s ease, color .14s ease, background-color .14s ease, box-shadow .14s ease, transform .08s ease
}

.mg-catalog-page .mg-badge,
.mg-drawer .mg-badge,
.mg-filter-popover .mg-badge {
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--mg-line);
    background: #f8fafc;
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 850;
    color: #344054;
    white-space: nowrap;
    margin: 0;
}

.mg-catalog-page .mg-badge--accent,
.mg-drawer .mg-badge--accent {
    background: #fff;
    border-color: rgba(130, 1, 0, .34);
    color: var(--mg-accent)
}

.mg-catalog-page .mg-badge--success,
.mg-drawer .mg-badge--success {
    background: var(--mg-success-bg);
    border-color: #bbf7d0;
    color: var(--mg-success)
}

.mg-catalog-page .mg-badge--warn,
.mg-drawer .mg-badge--warn {
    background: var(--mg-warn-bg);
    border-color: #fed7aa;
    color: var(--mg-warn)
}

.mg-catalog-page .mg-badge--blue,
.mg-drawer .mg-badge--blue {
    background: var(--mg-blue-bg);
    border-color: #bfdbfe;
    color: var(--mg-blue)
}

.mg-chip {
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--mg-line);
    background: #fff;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    font-weight: 720;
    font-size: 13px;
    color: #344054;
    cursor: pointer;
    transition: .14s ease
}

.mg-chip:hover {
    border-color: var(--mg-accent);
    color: var(--mg-accent)
}

.mg-chip__x {
    color: var(--mg-soft);
    font-size: 15px;
    line-height: 1
}

.mg-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--mg-success);
    font-weight: 820;
    font-size: 12px;
    white-space: nowrap
}

.mg-dot:before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor
}

.mg-select {
    height: 40px;
    border: 1px solid var(--mg-line);
    border-radius: 12px;
    background: #fff;
    padding: 0 32px 0 12px;
    font-weight: 700;
    color: #344054
}

.mg-device {
    position: relative;
    width: 68%;
    height: 78px;
    border-radius: 18px;
    background: linear-gradient(145deg, #fff, #dfe4eb);
    box-shadow: inset 0 0 0 1px #e5e7eb;
    display: block
}

.mg-device--camera:after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: radial-gradient(circle, #334155 0 26%, #94a3b8 27% 46%, #475467 47%)
}

.mg-device--bullet {
    width: 72%;
    height: 54px;
    border-radius: 999px
}

.mg-device--bullet:before {
    content: "";
    position: absolute;
    right: -22px;
    top: 18px;
    width: 42px;
    height: 18px;
    border-radius: 999px;
    background: #cbd5e1
}

.mg-device--nvr {
    width: 76%;
    height: 54px;
    border-radius: 12px;
    background: linear-gradient(145deg, #f8fafc, #cbd5e1)
}

.mg-device--lock {
    width: 44px;
    height: 108px;
    border-radius: 15px;
    background: linear-gradient(145deg, #f8fafc, #cbd5e1)
}

.mg-device--sensor {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #fff, #dfe4eb)
}

.mg-device--cable {
    width: 78%;
    height: 16px;
    border-radius: 999px;
    background: #475467
}

.mg-catalog-head {
    padding: 30px 0 18px
}

.mg-breadcrumbs {
    font-size: 12px;
    color: var(--mg-muted);
    margin-bottom: 8px
}

.mg-catalog-head__row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px
}

.mg-catalog-head h1 {
    margin: 0;
    font-size: 42px;
    line-height: 1.04;
    letter-spacing: -.06em;
    font-weight: 950
}

.mg-catalog-head p {
    margin: 8px 0 0;
    color: var(--mg-muted);
    font-size: 17px;
    max-width: 780px
}

.mg-catalog-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 22px;
    align-items: start
}

.mg-catalog-main {
    min-width: 0
}

.mg-project-promo {
    border: 1px solid rgba(130, 1, 0, .18);
    background: #fff;
    border-radius: 24px;
    margin: 0 0 24px;
    overflow: hidden;
    box-shadow: 0 18px 54px rgba(15, 23, 42, .04)
}

.mg-project-promo__main {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 22px
}

.mg-project-promo__icon {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: var(--mg-accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 950;
    box-shadow: 0 16px 34px rgba(130, 1, 0, .24)
}

.mg-project-promo__eyebrow {
    display: inline-flex;
    height: 28px;
    border-radius: 999px;
    background: var(--mg-accent);
    color: #fff;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 10px
}

.mg-project-promo h2 {
    font-size: 31px;
    line-height: 1.05;
    letter-spacing: -.055em;
    margin: 0
}

.mg-project-promo p {
    margin: 8px 0 0;
    color: var(--mg-muted);
    font-size: 15px;
    max-width: 860px
}

.mg-project-promo__tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px
}

.mg-project-promo__actions {
    display: grid;
    gap: 10px;
    min-width: 260px
}

.mg-project-promo__actions .mg-btn {
    height: 48px
}

.mg-project-promo__details {
    display: none;
    border-top: 1px solid var(--mg-line);
    padding: 18px 22px;
    background: #f8fafc
}

.mg-project-promo__details.is-open {
    display: block
}

.mg-project-promo__details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px
}

.mg-project-promo__details h3 {
    margin: 0 0 8px;
    font-size: 18px
}

.mg-project-promo__details ol {
    margin: 0;
    padding-left: 18px;
    color: var(--mg-muted)
}

.mg-project-promo__active {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
}

.mg-project-promo__active[hidden] {
    display: none;
}

.mg-project-promo__active-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: #ecfdf3;
    color: #15803d;
    font-size: 22px;
    font-weight: 950;
}

.mg-project-promo__active-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.mg-project-promo__active-label,
.mg-project-promo__active-copy small {
    color: var(--mg-muted);
    font-size: 11px;
    font-weight: 700;
}

.mg-project-promo__active-copy strong {
    overflow: hidden;
    color: var(--mg-text);
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mg-project-promo__active-actions {
    display: flex;
    gap: 8px;
}

.mg-project-promo__active-actions .mg-btn {
    min-height: 40px;
}

@media (max-width: 760px) {
    .mg-project-promo__active {
        grid-template-columns: 46px minmax(0, 1fr);
    }

    .mg-project-promo__active-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr;
    }
}

.mg-filters {
    position: sticky;
    top: 96px;
    border: 1px solid var(--mg-line);
    border-radius: 22px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
    max-height: calc(100vh - 116px);
    overflow: auto
}

.mg-filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px
}

.mg-filters__head b {
    font-size: 14px;
    letter-spacing: -.03em
}

.mg-filter-block {
    border-top: 1px solid var(--mg-line);
    padding: 14px 0
}

.mg-filter-block:first-of-type {
    border-top: 0;
    padding-top: 0
}

.mg-filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 900;
    font-size: 14px;
    line-height: 1.45;
    margin-bottom: 10px
}

.mg-filter-search {
    width: 100%;
    height: 38px;
    border: 1px solid var(--mg-line);
    border-radius: 12px;
    padding: 0 12px;
    outline: 0;
    margin-bottom: 10px;
    background: #fff
}

.mg-filter-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
    color: #344054;
    font-size: 14px;
    font-weight: 720;
    line-height: 1.25
}

.mg-filter-row span {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0
}

.mg-filter-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--mg-accent);
    flex: 0 0 auto
}

.mg-filter-row em {
    font-style: normal;
    color: var(--mg-soft);
    font-size: 12px;
    font-weight: 800
}

.mg-filter-row--l2 {
    padding-left: 22px
}

.mg-filter-row--l3 {
    padding-left: 44px;
    font-size: 13px
}

.mg-filter-row--extra {
    display: none
}

.mg-filter-block--collapsible.is-expanded .mg-filter-row--extra {
    display: flex
}

.mg-filter-more {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: var(--mg-accent);
    font-size: 13px;
    font-weight: 780;
    text-align: left;
    cursor: pointer
}

.mg-filter-more:hover {
    text-decoration: underline
}

.mg-price-slider {
    position: relative;
    height: 20px;
    margin: 18px 4px 10px
}

.mg-price-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--mg-line);
    border-radius: 999px;
    transform: translateY(-50%);
    pointer-events: none
}

.mg-price-track__fill {
    position: absolute;
    height: 100%;
    background: var(--mg-accent);
    border-radius: 999px
}

.mg-range {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    transform: translateY(-50%);
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    outline: none;
    margin: 0
}

.mg-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--mg-accent);
    box-shadow: 0 1px 5px rgba(0,0,0,.18);
    cursor: pointer;
    pointer-events: all
}

.mg-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--mg-accent);
    box-shadow: 0 1px 5px rgba(0,0,0,.18);
    cursor: pointer;
    pointer-events: all
}

.mg-price-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.mg-price-fields input {
    height: 36px;
    border: 1px solid var(--mg-line);
    border-radius: 10px;
    padding: 0 10px;
    min-width: 0
}

/* ── category nav (left sidebar) ── */
.mg-cat-nav {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.mg-cat-nav__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 11px;
    color: var(--mg-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 720;
    transition: background .12s ease;
    cursor: pointer
}

a.mg-cat-nav__item:hover {
    background: #f2f4f7;
    color: var(--mg-accent)
}

a.mg-cat-nav__item.is-active {
    background: rgba(130, 1, 0, .07);
    color: var(--mg-accent);
    font-weight: 860
}

.mg-cat-nav__item em {
    font-style: normal;
    font-size: 12px;
    color: var(--mg-soft);
    font-weight: 700;
    flex: 0 0 auto;
    text-align: right;
}

.mg-cat-nav__item--l2 {
    padding-left: 20px;
    font-size: 13px
}

.mg-cat-nav__item--l3 {
    padding-left: 34px;
    font-size: 13px
}

/* group items (parent with children) */
.mg-cat-group > .mg-cat-nav__item:hover {
    background: #f2f4f7
}

.mg-cat-group > .mg-cat-nav__item:hover .mg-cat-nav__link {
    color: var(--mg-accent)
}

.mg-cat-group > .mg-cat-nav__item.is-active .mg-cat-nav__link {
    color: var(--mg-accent)
}

.mg-cat-group > .mg-cat-nav__item.is-active {
    background: rgba(130, 1, 0, .07)
}

.mg-cat-nav__link {
    flex: 1;
    color: inherit;
    text-decoration: none;
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.3;
    word-break: break-word;
    font-weight: inherit
}

.mg-cat-nav__meta {
    display: grid;
    grid-template-columns: minmax(2ch, auto) 22px;
    align-items: center;
    gap: 4px;
    justify-items: end;
    flex: 0 0 58px
}

.mg-cat-nav__count {
    min-width: 2ch;
    text-align: right;
}

.mg-cat-toggle {
    width: 22px;
    height: 22px;
    border: 0;
    background: transparent;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--mg-soft);
    border-radius: 7px;
    padding: 0;
    transition: transform .18s ease
}

.mg-cat-toggle:hover {
    background: #e5e7eb;
    color: var(--mg-text)
}

.mg-cat-toggle.is-open {
    transform: rotate(180deg)
}

.mg-cat-toggle-spacer {
    width: 22px;
    height: 22px;
    display: inline-block;
}

.mg-cat-sub {
    margin-left: 0
}

/* ── filterbar ── */
.mg-filterbar {
    border: 1px solid var(--mg-line);
    border-radius: 20px;
    background: #fff;
    margin-bottom: 14px
}

.mg-filterbar__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    flex-wrap: wrap
}

.mg-filterbar__toggle {
    flex: 0 0 auto
}

.mg-filterbar__toggle.is-open {
    background: var(--mg-accent);
    border-color: var(--mg-accent);
    color: #fff;
    box-shadow: 0 10px 22px rgba(130, 1, 0, .14)
}

.mg-filterbar__chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0
}

.mg-filterbar__found {
    font-size: 14px;
    color: var(--mg-muted);
    white-space: nowrap
}

.mg-filterbar__found b {
    color: var(--mg-text)
}

/* ── filter drawer footer ── */
.mg-filter-drawer__foot {
    border-top: 1px solid var(--mg-line);
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    flex: 0 0 auto
}

.mg-filter-popover {
    position: fixed;
    z-index: 160;
    left: 24px;
    bottom: 24px;
    border: 1px solid rgba(130, 1, 0, .22);
    background: #25201d;
    color: #fff;
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 18px 54px rgba(88, 24, 20, .22);
    display: none;
    gap: 8px;
    align-items: center
}

.mg-filter-popover.is-open {
    display: flex
}

.mg-filter-popover [data-filter-popover-text] {
    font-size: 12px;
    color: rgba(255, 255, 255, .72)
}

.mg-toolbar {
    border: 1px solid var(--mg-line);
    border-radius: 20px;
    background: #fff;
    padding: 12px 14px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center
}

.mg-toolbar__left,
.mg-toolbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap
}

.mg-toolbar__left b {
    font-size: 14px;
    line-height: 1.45;
}

.mg-view-switcher {
    display: flex;
    gap: 5px;
    padding: 3px;
    border: 1px solid var(--mg-line);
    border-radius: 13px;
    background: #f2f4f7
}

.mg-view-switcher button {
    width: 38px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--mg-muted);
    display: grid;
    place-items: center;
    font-weight: 950;
    cursor: pointer
}

.mg-view-switcher button.is-active {
    background: #fff;
    color: var(--mg-accent);
    box-shadow: inset 0 0 0 1px rgba(130, 1, 0, .34), 0 10px 28px rgba(88, 24, 20, .06)
}

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

.mg-product-card {
    border: 1px solid var(--mg-line);
    border-radius: 22px;
    background: #fff;
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 382px;
    transition: .14s ease;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02)
}

.mg-product-card:hover {
    border-color: var(--mg-line-2);
    box-shadow: var(--mg-shadow);
    transform: translateY(-2px)
}

.mg-product-card__media {
    height: 172px;
    border: 0;
    border-radius: 17px;
    background: linear-gradient(180deg, #fcfcfd, #f2f4f7);
    display: grid;
    place-items: center;
    position: relative;
    margin-bottom: 13px;
    overflow: hidden;
    cursor: pointer;
    width: 100%;
    padding: 0
}

.mg-product-card__top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    z-index: 3
}

.mg-fav {
    width: 32px;
    height: 32px;
    border: 1px solid var(--mg-line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .9);
    display: grid;
    place-items: center;
    color: var(--mg-muted);
    text-decoration: none;
    opacity: 1 !important;
    transition: color .1s, border-color .1s;
    margin-left: auto
}

.mg-fav:hover {
    color: #820100;
    border-color: rgba(130, 1, 0, .35)
}

.mg-fav.added {
    color: #820100 !important;
    border-color: rgba(130, 1, 0, .45) !important
}

.mg-fav.mg-fav--loading {
    opacity: .5 !important;
    pointer-events: none
}

.mg-icon-btn.compare.added,
.mg-btn.compare.added {
    color: #820100;
    border-color: rgba(130, 1, 0, .45) !important;
}

.mg-icon-btn.compare.mg-compare--loading,
.mg-btn.compare.mg-compare--loading {
    opacity: .6;
    pointer-events: none;
}

.mg-product-card__category {
    font-size: 12px;
    color: var(--mg-muted);
    font-weight: 780;
    margin-bottom: 4px
}

.mg-product-card__title {
    min-height: 42px;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    color: var(--mg-text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.22;
    letter-spacing: -.02em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer
}

.mg-product-card__title:hover {
    color: var(--mg-accent)
}

.mg-product-card__sku {
    font-size: 12px;
    color: var(--mg-muted);
    margin-top: 9px;
    font-weight: 650
}

.mg-product-card__badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 12px 0
}

.mg-product-card__specs {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    z-index: 2
}

.mg-product-card__specs .mg-badge {
    height: 23px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
}

.mg-product-card__extra {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 8px 0 0
}

.mg-card-sub {
    display: block;
    font-size: 10px;
    color: var(--mg-soft);
    font-weight: 500;
    margin-top: 1px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.mg-product-card__bottom {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-end;
    margin-top: auto
}

.mg-product-card__bottom strong {
    font-size: 22px;
    font-weight: 950;
    letter-spacing: -.04em;
    white-space: nowrap
}

.mg-card-prices {
    text-align: right;
}

.mg-card-sub--partner {
    color: #820100;
    font-weight: 700;
}

.mg-card-retail,
.mg-table-retail {
    display: block;
    margin-top: 4px;
    color: var(--mg-muted);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
}

.mg-card-retail {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 0;
    font-size: 9px;
}

.mg-card-retail b {
    color: var(--mg-text);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.mg-table-price-label {
    display: block;
    color: #820100;
    font-size: 10px;
    font-weight: 700;
}

.mg-product-card__actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 14px
}

.mg-product-card__actions .mg-btn,
.mg-product-card__actions .mg-icon-btn {
    height: 44px;
    width: 100%;
    padding: 0
}

.mg-product-card__actions .mg-icon-btn:hover,
.mg-product-card__actions .mg-icon-btn:focus-visible {
    color: var(--mg-accent);
    border-color: rgba(130, 1, 0, .35);
    background: #fff;
    box-shadow: 0 8px 18px rgba(130, 1, 0, .12)
}

.mg-product-card__actions .mg-icon-btn:active,
.mg-product-card__actions .mg-icon-btn.is-pressing,
.mg-product-card__actions .mg-icon-btn.is-clicked {
    transform: translateY(1px) scale(.98);
    box-shadow: none
}

.mg-product-card__actions .mg-icon-btn.compare.added {
    background: rgba(130, 1, 0, .07);
    border-color: rgba(130, 1, 0, .45) !important;
    color: var(--mg-accent)
}

.mg-product-card__actions .mg-icon-btn.compare.added:hover {
    background: rgba(130, 1, 0, .1)
}

.mg-products-table {
    background: #fff;
    border: 1px solid var(--mg-line);
    border-radius: 22px;
    overflow: auto
}

.mg-products-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px
}

.mg-products-table th {
    background: #f8fafc;
    color: var(--mg-muted);
    font-size: 12px;
    text-align: left;
    padding: 12px;
    font-weight: 900;
    border-bottom: 1px solid var(--mg-line);
    white-space: nowrap
}

.mg-products-table td {
    padding: 12px;
    border-bottom: 1px solid var(--mg-line);
    vertical-align: middle
}

.mg-products-table tr:last-child td {
    border-bottom: 0
}

/* column widths */
.mg-products-table th[data-col="photo"],
.mg-products-table td[data-col="photo"] { width: 74px; padding: 8px 12px }

.mg-products-table th[data-col="sku"],
.mg-products-table td[data-col="sku"] { width: 140px; white-space: nowrap; font-size: 12px; color: var(--mg-muted); font-weight: 600 }

.mg-products-table th[data-col="stock"],
.mg-products-table td[data-col="stock"] { width: 120px; white-space: nowrap }

.mg-products-table th[data-col="price"],
.mg-products-table td[data-col="price"] { width: 130px; text-align: right; white-space: nowrap }

.mg-products-table th[data-col="action"],
.mg-products-table td[data-col="action"] { width: 120px; text-align: center }

.mg-products-table td[data-col="specs"] { max-width: 200px }

/* action button compact in table */
.mg-products-table .mg-btn { height: 36px; padding: 0 14px; font-size: 13px }

.mg-row-img {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid var(--mg-line);
    display: grid;
    place-items: center
}

.mg-row-img .mg-device {
    width: 38px;
    height: 30px;
    border-radius: 9px
}

.mg-row-img .mg-device--bullet {
    height: 22px
}

.mg-table-title {
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    color: var(--mg-text);
    cursor: pointer
}

.mg-table-title b {
    display: block;
    font-size: 14px;
    line-height: 1.25
}

.mg-table-title span {
    display: block;
    color: var(--mg-muted);
    font-size: 12px;
    margin-top: 3px
}

.mg-table-title:hover b {
    color: var(--mg-accent)
}

.mg-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .22);
    z-index: 240;
    opacity: 0;
    pointer-events: none;
    transition: .18s
}

.mg-drawer-overlay.is-open {
    opacity: 1;
    pointer-events: auto
}

.mg-drawer {
    position: fixed;
    right: 0;
    top: 0;
    z-index: 250;
    width: 430px;
    max-width: calc(100vw - 16px);
    height: 100vh;
    background: #fff;
    border-left: 1px solid var(--mg-line);
    box-shadow: 0 28px 90px rgba(15, 23, 42, .18);
    transform: translateX(104%);
    transition: .22s ease;
    display: flex;
    flex-direction: column;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--mg-text)
}

.mg-drawer.is-open {
    transform: translateX(0);
    display: flex
}

.mg-drawer__head {
    height: 72px;
    border-bottom: 1px solid var(--mg-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px
}

.mg-drawer__body {
    padding: 20px;
    overflow: auto;
    flex: 1
}

.mg-quick-img {
    aspect-ratio: 1;
    border: 1px solid var(--mg-line);
    border-radius: 22px;
    background: #f8fafc;
    display: grid;
    place-items: center;
    overflow: hidden;
    margin-bottom: 16px
}

.mg-quick-img .mg-device {
    width: 70%;
    height: 106px
}

.mg-quick-title {
    margin: 12px 0 6px;
    font-size: 23px;
    line-height: 1.15;
    letter-spacing: -.03em
}

.mg-quick-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0
}

.mg-quick-meta strong {
    font-size: 24px;
    letter-spacing: -.04em
}

.mg-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0
}

.mg-quick-section {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--mg-line);
    border-radius: 16px;
    background: #f8fafc;
}

.mg-quick-section h3 {
    margin: 0 0 8px;
    color: var(--mg-text);
    font-size: 15px;
}

.mg-quick-section p {
    margin: 0;
    color: var(--mg-muted);
    font-size: 13px;
    line-height: 1.6;
}

.mg-drawer .mg-spec b {
    max-width: 58%;
    text-align: right;
    overflow-wrap: anywhere;
}


.mg-spec-list {
    border: 1px solid var(--mg-line);
    border-radius: 16px;
    overflow: hidden
}

.mg-spec {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--mg-line)
}

.mg-spec:last-child {
    border-bottom: 0
}

.mg-spec span:first-child {
    color: var(--mg-muted)
}

.mg-table-column-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--mg-line);
    border-radius: 14px;
    padding: 11px;
    margin-bottom: 8px
}

.mg-table-column-row span {
    display: grid
}

.mg-table-column-row small {
    color: var(--mg-muted);
    margin-top: 2px
}

.mg-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 270;
    background: #25201d;
    color: #fff;
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 18px 60px rgba(88, 24, 20, .20);
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: .2s
}

.mg-toast.is-open {
    transform: translateY(0);
    opacity: 1
}

.mg-pagination {
    display: flex;
    gap: 7px;
    justify-content: center;
    align-items: center;
    margin: 26px 0 18px
}

.mg-pagination button,
.mg-pagination .mg-page-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--mg-line);
    border-radius: 11px;
    background: #fff;
    display: grid;
    place-items: center;
    font-weight: 850;
    cursor: pointer;
    text-decoration: none;
    color: var(--mg-text);
    font-size: 14px
}

.mg-pagination button.is-active,
.mg-pagination .mg-page-btn.is-active {
    background: var(--mg-accent);
    border-color: var(--mg-accent);
    color: #fff
}

.mg-pagination .mg-page-btn.is-disabled {
    opacity: .35;
    pointer-events: none
}

.mg-pagination button:hover:not(.is-active),
.mg-pagination .mg-page-btn:hover:not(.is-active):not(.is-disabled) {
    border-color: var(--mg-line-2)
}

.mg-pagination span {
    color: var(--mg-muted)
}

.mg-table-infinite-status {
    margin: 10px 0 20px;
    text-align: center;
}

.mg-table-infinite-status p {
    margin: 0;
    font-size: 13px;
    color: var(--mg-muted);
    font-weight: 600;
}

.mg-table-infinite-status__loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border-radius: 50%;
    border: 2px solid #d7dbe4;
    border-top-color: var(--mg-accent);
    animation: mgTableSpin .8s linear infinite;
    vertical-align: -2px;
}

.mg-table-infinite-sentinel {
    width: 100%;
    height: 2px;
}

@keyframes mgTableSpin {
    to { transform: rotate(360deg); }
}

.mg-trust-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 18px
}

.mg-trust-grid div {
    border: 1px solid var(--mg-line);
    border-radius: 18px;
    background: #fff;
    padding: 14px;
    min-height: 76px
}

.mg-trust-grid b {
    display: block;
    font-size: 13px
}

.mg-trust-grid span {
    display: block;
    color: var(--mg-muted);
    font-size: 12px;
    margin-top: 4px
}

@media(max-width:1200px) {
    .mg-products-grid {
        grid-template-columns: repeat(3, 1fr)
    }

    .mg-project-promo__main {
        grid-template-columns: 64px 1fr
    }

    .mg-project-promo__actions {
        grid-column: 2
    }
}

@media(max-width:960px) {
    .mg-catalog-page {
        padding: 0 16px 36px
    }

    .mg-catalog-layout {
        grid-template-columns: 1fr
    }

    .mg-filters {
        display: none
    }

    .mg-products-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .mg-toolbar {
        display: grid
    }

    .mg-toolbar__right {
        width: 100%
    }

    .mg-select {
        width: 100%
    }

    .mg-project-promo__main {
        grid-template-columns: 1fr
    }

    .mg-project-promo__icon {
        display: none
    }

    .mg-project-promo__actions {
        grid-column: auto
    }

    .mg-project-promo__details-grid {
        grid-template-columns: 1fr
    }

    .mg-trust-grid {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:620px) {
    .mg-catalog-page,
    .mg-catalog-main,
    .mg-project-promo,
    .mg-project-promo__main,
    .mg-project-promo__main > div {
        width: 100%;
        max-width: 100%;
        min-width: 0
    }

    .mg-project-promo__main {
        padding: 22px
    }

    .mg-project-promo__actions {
        min-width: 0;
        width: 100%
    }

    .mg-project-promo h2,
    .mg-project-promo p {
        overflow-wrap: anywhere
    }

    .mg-project-promo__actions .mg-btn {
        white-space: normal;
        text-align: center
    }

    .mg-catalog-head__row {
        display: grid
    }

    .mg-catalog-head h1 {
        font-size: 34px
    }

    .mg-products-grid {
        grid-template-columns: 1fr
    }

    .mg-toolbar__left,
    .mg-toolbar__right {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%
    }

    .mg-view-switcher {
        width: 100%
    }

    .mg-view-switcher button {
        flex: 1;
        width: auto
    }

    .mg-products-table {
        border-radius: 18px
    }

    .mg-product-card__actions {
        grid-template-columns: 1fr 1fr 52px
    }

    .mg-drawer {
        width: 100%;
        max-width: 100%
    }

    .mg-drawer__body {
        padding-bottom: 90px
    }

    .mg-trust-grid {
        grid-template-columns: 1fr
    }

    .mg-project-promo h2 {
        font-size: 26px
    }
}
