:root {
    --ink: #18212f;
    --muted: #647084;
    --line: rgba(24, 33, 47, .12);
    --glass: rgba(255, 255, 255, .68);
    --glass-strong: rgba(255, 255, 255, .84);
    --brand: #fb4f7a;
    --brand-dark: #c72f5b;
    --teal: #12b8a6;
    --amber: #ffb84d;
    --blue: #4f7cff;
    --shadow: 0 24px 70px rgba(37, 44, 68, .16);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    background:
        radial-gradient(circle at top left, rgba(251, 79, 122, .30), transparent 34rem),
        radial-gradient(circle at 90% 6rem, rgba(18, 184, 166, .28), transparent 28rem),
        linear-gradient(135deg, #fff8fb 0%, #f4fbff 42%, #fffaf0 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255,255,255,.48) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.48) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 70%);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
}

.site-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 12px;
    z-index: 20;
    margin: 12px auto 0;
    width: min(1120px, calc(100% - 24px));
    border: 1px solid rgba(255,255,255,.78);
    border-radius: 999px;
    background: rgba(255,255,255,.66);
    box-shadow: 0 18px 50px rgba(31, 41, 55, .10);
    backdrop-filter: blur(20px) saturate(160%);
}

.nav {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 10px 8px 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 850;
    letter-spacing: 0;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 14px;
    color: white;
    background: linear-gradient(135deg, var(--brand), var(--teal));
    box-shadow: 0 12px 26px rgba(251, 79, 122, .26);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #38445a;
    font-size: 14px;
    font-weight: 700;
}

.nav-links a {
    padding: 10px 12px;
    border-radius: 999px;
}

.nav-links a:hover {
    background: rgba(255,255,255,.78);
}

.nav-toggle,
.hamburger-btn {
    display: none;
}

.hamburger-btn {
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid rgba(255,255,255,.86);
    border-radius: 999px;
    background: rgba(255,255,255,.74);
    box-shadow: 0 12px 28px rgba(31, 41, 55, .08);
    cursor: pointer;
}

.hamburger-btn span {
    display: block;
    width: 19px;
    height: 2px;
    border-radius: 999px;
    background: #18212f;
}

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

.btn,
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    padding: 0 18px;
    cursor: pointer;
    font-weight: 800;
    line-height: 1;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), #ff7a59);
    box-shadow: 0 14px 30px rgba(251, 79, 122, .30);
}

.btn-dark {
    color: #fff;
    background: #18212f;
    box-shadow: 0 14px 30px rgba(24, 33, 47, .20);
}

.btn-soft {
    color: var(--ink);
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(255,255,255,.86);
}

.btn-line {
    color: var(--ink);
    background: rgba(255,255,255,.34);
    border: 1px solid var(--line);
}

.btn-danger {
    color: #b42318;
    background: #fff1f0;
}

.btn-full {
    width: 100%;
}

.icon-btn {
    width: 44px;
    padding: 0;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(255,255,255,.86);
}

.cart-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cart-link {
    color: #18212f;
}

.hero {
    padding: 56px 0 28px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
    gap: 32px;
    align-items: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    border: 1px solid rgba(255,255,255,.78);
    border-radius: 999px;
    padding: 8px 12px;
    color: #6d3851;
    background: rgba(255,255,255,.58);
    backdrop-filter: blur(18px);
    font-size: 13px;
    font-weight: 800;
}

.hero h1,
.page-title {
    margin: 18px 0 14px;
    max-width: 740px;
    font-size: clamp(40px, 8vw, 78px);
    line-height: .94;
    letter-spacing: 0;
}

.hero-copy,
.page-copy {
    max-width: 650px;
    color: #536074;
    font-size: 18px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.hero-search {
    display: flex;
    gap: 10px;
    width: min(560px, 100%);
    margin-top: 22px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.82);
    border-radius: 999px;
    background: rgba(255,255,255,.68);
    box-shadow: 0 18px 40px rgba(31, 41, 55, .08);
    backdrop-filter: blur(20px);
}

.hero-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 0 12px;
    color: var(--ink);
}

.hero-showcase {
    position: relative;
    min-height: 470px;
}

.floating-board {
    position: absolute;
    inset: 18px 0 0 auto;
    width: min(460px, 100%);
    border: 1px solid rgba(255,255,255,.76);
    border-radius: 34px;
    padding: 18px;
    background: rgba(255,255,255,.48);
    box-shadow: var(--shadow);
    backdrop-filter: blur(26px) saturate(160%);
}

.showcase-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.mini-template {
    position: relative;
    overflow: hidden;
    min-height: 170px;
    border-radius: 24px;
    padding: 16px;
    color: #fff;
    background: linear-gradient(135deg, #fb4f7a, #ffb84d);
}

.mini-template:nth-child(2) {
    margin-top: 34px;
    background: linear-gradient(135deg, #12b8a6, #4f7cff);
}

.mini-template:nth-child(3) {
    margin-top: -28px;
    background: linear-gradient(135deg, #7c5cff, #fb4f7a);
}

.mini-template:nth-child(4) {
    background: linear-gradient(135deg, #18212f, #4f7cff);
}

.mini-template::after {
    content: "";
    position: absolute;
    right: -28px;
    bottom: -42px;
    width: 120px;
    height: 120px;
    border-radius: 36px;
    background: rgba(255,255,255,.28);
    transform: rotate(18deg);
}

.mini-template strong {
    position: relative;
    z-index: 1;
    display: block;
    max-width: 140px;
    font-size: 22px;
    line-height: 1.08;
}

.mini-template span {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 800;
    opacity: .86;
}

.glass-card,
.product-card,
.admin-card,
.panel,
.result-card {
    border: 1px solid rgba(255,255,255,.72);
    border-radius: var(--radius-xl);
    background: var(--glass);
    box-shadow: 0 22px 60px rgba(31, 41, 55, .10);
    backdrop-filter: blur(24px) saturate(160%);
}

.section {
    padding: 36px 0;
}

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

.section-head h2,
.panel h2 {
    margin: 0;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.08;
}

.section-head p {
    max-width: 560px;
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

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

.product-card {
    overflow: hidden;
    display: flex;
    min-width: 0;
    flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 28px 76px rgba(31, 41, 55, .16);
}

.product-media-shell {
    position: relative;
    overflow: hidden;
    margin: 10px;
    border-radius: 22px;
}

.product-media {
    position: relative;
    display: block;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(251,79,122,.9), rgba(18,184,166,.9));
}

.aspect-a4 { aspect-ratio: 210 / 297; }
.aspect-poster { aspect-ratio: 2 / 3; }
.aspect-wide { aspect-ratio: 16 / 9; }
.aspect-square { aspect-ratio: 1 / 1; }
.aspect-custom { aspect-ratio: 4 / 3; }

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

.placeholder-preview {
    position: relative;
    overflow: hidden;
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 190px;
    place-items: center;
    padding: 18px;
    color: #fff;
    text-align: center;
    font-weight: 900;
    line-height: 1.1;
}

.placeholder-preview::before {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(255,255,255,.46);
    border-radius: 16px;
}

.placeholder-preview::after {
    content: "Template Cikgu";
    position: absolute;
    left: 50%;
    top: 50%;
    color: rgba(255,255,255,.48);
    font-size: clamp(18px, 4vw, 44px);
    font-weight: 900;
    text-shadow: 0 2px 8px rgba(24,33,47,.16);
    transform: translate(-50%, -50%) rotate(-24deg);
    white-space: nowrap;
    pointer-events: none;
}

.placeholder-preview span {
    position: relative;
    z-index: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 6px 10px;
    color: #fff;
    background: rgba(24,33,47,.76);
    font-size: 12px;
    font-weight: 850;
    backdrop-filter: blur(14px);
}

.product-media .badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
}

.video-badge {
    left: auto !important;
    right: 12px;
}

.product-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    padding: 4px 16px 16px;
}

.share-icon-btn {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(255,255,255,.86);
    border-radius: 999px;
    color: #18212f;
    background: rgba(255,255,255,.78);
    box-shadow: 0 16px 36px rgba(31, 41, 55, .12);
    backdrop-filter: blur(18px) saturate(160%);
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.share-icon-btn:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,.9);
    box-shadow: 0 18px 42px rgba(31, 41, 55, .16);
}

.share-icon-btn.is-copied {
    color: #075e55;
    background: rgba(217, 255, 244, .9);
}

.share-icon {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.product-share-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 3;
}

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

.detail-share-btn {
    width: 48px;
    height: 48px;
}

.admin-share-btn {
    box-shadow: none;
}

.role-badge,
.readonly-pill {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: 8px 12px;
    color: #075e55;
    background: rgba(18,184,166,.14);
    font-size: 13px;
    font-weight: 850;
}

.role-badge-super {
    color: #7a2e0e;
    background: rgba(255,184,77,.22);
}

.muted-text {
    color: var(--muted);
    font-weight: 750;
}

.product-title {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
}

.product-meta {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-top: auto;
}

.price {
    color: var(--brand-dark);
    font-size: 20px;
    font-weight: 900;
}

.old-price {
    color: #8791a3;
    font-size: 14px;
    text-decoration: line-through;
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

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

.category-card {
    padding: 18px;
    border-radius: 24px;
    background: rgba(255,255,255,.62);
    border: 1px solid rgba(255,255,255,.82);
    box-shadow: 0 16px 36px rgba(31, 41, 55, .08);
    transition: transform .18s ease;
}

.category-card:hover {
    transform: translateY(-2px);
}

.category-card strong {
    display: block;
    font-size: 18px;
}

.category-card span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.page-hero {
    padding: 46px 0 20px;
}

.filter-bar,
.cart-layout,
.checkout-layout,
.detail-layout,
.admin-layout {
    display: grid;
    gap: 20px;
}

.filter-bar {
    grid-template-columns: 1fr 220px auto;
    align-items: end;
    padding: 14px;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    color: #364256;
    font-size: 13px;
    font-weight: 850;
}

.input,
.textarea,
.select {
    width: 100%;
    border: 1px solid rgba(24,33,47,.12);
    border-radius: 16px;
    outline: 0;
    background: rgba(255,255,255,.72);
    color: var(--ink);
    padding: 13px 14px;
    transition: border .18s ease, box-shadow .18s ease;
}

.textarea {
    min-height: 130px;
    resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: rgba(251,79,122,.5);
    box-shadow: 0 0 0 4px rgba(251,79,122,.12);
}

.detail-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
    align-items: start;
}

.detail-media {
    padding: 12px;
}

.template-preview-gallery {
    display: grid;
    gap: 12px;
}

.detail-media-main {
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    background: linear-gradient(135deg, rgba(251,79,122,.92), rgba(18,184,166,.92));
}

.preview-stage {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.58);
}

.preview-stage img,
.detail-media-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-stage img {
    transition: opacity .16s ease, transform .22s ease;
}

.preview-stage img.is-swapping {
    opacity: .72;
    transform: scale(1.012);
}

.preview-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: grid;
    width: 50px;
    height: 64px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.78);
    border-radius: 18px;
    color: #fff;
    background: rgba(24,33,47,.44);
    box-shadow: 0 18px 42px rgba(24,33,47,.18);
    backdrop-filter: blur(18px) saturate(160%);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.preview-arrow:hover {
    background: rgba(24,33,47,.62);
    box-shadow: 0 20px 48px rgba(24,33,47,.24);
    transform: translateY(-50%) scale(1.02);
}

.preview-arrow svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.preview-arrow-prev {
    left: 12px;
}

.preview-arrow-next {
    right: 12px;
}

.preview-thumbs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 78px;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
}

.preview-thumb {
    position: relative;
    overflow: hidden;
    width: 78px;
    height: 78px;
    max-width: 78px;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
    border: 2px solid rgba(255,255,255,.82);
    border-radius: 16px;
    padding: 0;
    background: rgba(255,255,255,.62);
    box-shadow: 0 12px 26px rgba(31,41,55,.10);
    cursor: pointer;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.preview-thumb:hover,
.preview-thumb:focus-visible,
.preview-thumb.is-active {
    border-color: var(--brand);
    box-shadow: 0 16px 34px rgba(251,79,122,.22);
    transform: translateY(-1px);
}

.preview-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-panel {
    padding: 24px;
}

.detail-panel h1 {
    margin: 12px 0;
    font-size: clamp(32px, 6vw, 56px);
    line-height: .98;
}

.notice {
    border-radius: 18px;
    padding: 14px;
    color: #5b3b00;
    background: rgba(255,184,77,.20);
    border: 1px solid rgba(255,184,77,.35);
    font-weight: 750;
    line-height: 1.5;
}

.cart-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
}

.cart-list,
.summary-box,
.checkout-form,
.admin-card,
.panel,
.result-card {
    padding: 20px;
}

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

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

.cart-thumb {
    overflow: hidden;
    width: 110px;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--brand), var(--teal));
}

.checkout-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
}

.order-lines {
    display: grid;
    gap: 12px;
}

.order-line {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: #425069;
}

.total-line {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 22px;
    font-weight: 900;
}

.result-wrap {
    display: grid;
    min-height: 58vh;
    place-items: center;
    padding: 56px 0;
}

.result-card {
    max-width: 620px;
    text-align: center;
}

.result-icon {
    display: grid;
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    place-items: center;
    border-radius: 28px;
    color: #fff;
    font-size: 34px;
    font-weight: 900;
}

.result-icon.success { background: linear-gradient(135deg, #12b8a6, #39d98a); }
.result-icon.pending { background: linear-gradient(135deg, #ffb84d, #ff7a59); }
.result-icon.failed { background: linear-gradient(135deg, #ef4444, #fb4f7a); }

.alert {
    width: min(1120px, calc(100% - 32px));
    margin: 18px auto 0;
    border-radius: 18px;
    padding: 14px 16px;
    font-weight: 750;
}

.alert-success { background: rgba(18,184,166,.16); color: #075e55; }
.alert-error { background: rgba(239,68,68,.14); color: #9f1239; }
.alert-notice { background: rgba(255,184,77,.18); color: #6d3b00; }

.empty-state {
    padding: 42px 20px;
    text-align: center;
    color: var(--muted);
}

.admin-body {
    background:
        radial-gradient(circle at 0 0, rgba(18,184,166,.20), transparent 30rem),
        radial-gradient(circle at 90% 0, rgba(251,79,122,.18), transparent 30rem),
        #f6f8fb;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(24,33,47,.08);
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(18px);
}

.admin-nav {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-links a {
    padding: 9px 12px;
    border-radius: 999px;
    color: #425069;
    font-size: 14px;
    font-weight: 800;
}

.admin-links a:hover {
    background: rgba(24,33,47,.06);
}

.admin-toggle,
.admin-menu-button {
    display: none;
}

.admin-logout {
    margin: 0;
}

.admin-main {
    padding: 28px 0 56px;
}

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

.stat {
    padding: 18px;
}

.stat span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 740px;
}

.table th,
.table td {
    padding: 12px;
    border-bottom: 1px solid rgba(24,33,47,.08);
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

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

.span-2 {
    grid-column: 1 / -1;
}

.footer {
    padding: 34px 0 46px;
    color: #556177;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-top: 1px solid rgba(24,33,47,.10);
    padding-top: 20px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-weight: 750;
}

@media (max-width: 920px) {
    .hero-grid,
    .detail-layout,
    .cart-layout,
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .hero-showcase {
        min-height: auto;
    }

    .floating-board {
        position: relative;
        inset: auto;
        width: 100%;
    }

    .product-grid,
    .category-grid,
    .admin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 24px, 1120px);
    }

    .topbar {
        top: 8px;
        border-radius: 26px;
    }

    .nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        padding: 12px;
    }

    .hamburger-btn {
        display: inline-flex;
        flex-direction: column;
    }

    .nav-links,
    .nav-actions {
        grid-column: 1 / -1;
        display: none;
        width: 100%;
    }

    .nav-toggle:checked ~ .nav-links {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(24,33,47,.08);
    }

    .nav-toggle:checked ~ .nav-actions {
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 8px;
        margin-top: 10px;
    }

    .nav-links a {
        padding: 12px 14px;
        background: rgba(255,255,255,.54);
        border-radius: 16px;
    }

    .nav-actions .btn-primary {
        width: 100%;
        min-width: 0;
        padding-inline: 12px;
        white-space: nowrap;
    }

    .hero {
        padding-top: 34px;
    }

    .hero-search {
        align-items: stretch;
        border-radius: 24px;
        flex-direction: column;
    }

    .hero-search input {
        min-height: 42px;
    }

    .product-grid,
    .category-grid,
    .admin-grid,
    .showcase-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .mini-template:nth-child(n) {
        margin-top: 0;
    }

    .section-head,
    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .cart-item {
        grid-template-columns: 88px minmax(0, 1fr);
    }

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

    .cart-thumb {
        width: 88px;
    }

    .card-actions {
        grid-template-columns: 1fr;
    }

    .detail-media {
        padding: 10px;
    }

    .template-preview-gallery,
    .preview-stage {
        width: 100%;
        max-width: 100%;
    }

    .preview-thumbs {
        grid-auto-columns: 68px;
        align-items: center;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .preview-arrow {
        width: 44px;
        height: 56px;
        border-radius: 16px;
    }

    .preview-arrow-prev {
        left: 8px;
    }

    .preview-arrow-next {
        right: 8px;
    }

    .preview-thumb {
        width: 68px;
        height: 68px;
        max-width: 68px;
        border-radius: 14px;
    }

    .admin-nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        min-height: 68px;
        gap: 10px;
    }

    .admin-nav .brand {
        max-width: 100%;
        font-size: 17px;
        line-height: 1.1;
    }

    .admin-nav .brand span:last-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-menu-button {
        display: inline-flex;
        flex-direction: column;
    }

    .admin-links,
    .admin-logout {
        grid-column: 1 / -1;
        display: none;
        width: 100%;
    }

    .admin-toggle:checked ~ .admin-links {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 10px;
        padding-top: 12px;
        border-top: 1px solid rgba(24,33,47,.08);
    }

    .admin-toggle:checked ~ .admin-logout {
        display: block;
        margin-top: 8px;
    }

    .admin-links a {
        display: block;
        padding: 13px 14px;
        border-radius: 18px;
        background: rgba(255,255,255,.58);
    }

    .admin-logout .btn {
        width: 100%;
    }
}
