:root {
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --soft: #f3f4f6;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --price: #ef4444;
    --green: #10b981;
    --green-soft: #ecfdf5;
    --radius: 18px;
    --shadow: 0 4px 18px rgba(17, 24, 39, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
body.locked { overflow: hidden; }

/* Header: same logo as kagfe.com */
.header { background: rgba(245, 247, 250, .85); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(0, 0, 0, .08); position: sticky; top: 0; z-index: 50; }
.header-inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; height: 64px; display: flex; align-items: center; }
.logo { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.logo__text { background: linear-gradient(135deg, #111827 0%, #4f46e5 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.logo__dot { font-weight: 400; color: #4b5563; opacity: .5; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* Hero */
.hero { text-align: center; padding: 16px 0 4px; }
.hero h1 { font-size: clamp(24px, 3.6vw, 36px); font-weight: 800; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #4f46e5, #2563eb); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Quick filter bar */
.filters { position: sticky; top: 64px; z-index: 40; background: var(--bg); padding: 12px 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 14px; font-weight: 600; color: var(--text); transition: .15s; }
.chip .dot { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }
.chip .count { font-size: 12px; color: var(--muted); font-weight: 500; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.active .count { color: rgba(255,255,255,.8); }
.toolbar { display: flex; gap: 10px; margin-top: 10px; }
.search { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); font: inherit; font-size: 14px; background: #fff; }
.sort { padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); font: inherit; font-size: 14px; background: #fff; }

/* Product grid: square cards */
.section-title { font-size: 20px; font-weight: 700; margin: 18px 0 14px; display: flex; align-items: baseline; gap: 10px; }
.section-title small { font-size: 13px; color: var(--muted); font-weight: 500; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; padding-bottom: 40px; }
.card { background: linear-gradient(var(--tint, transparent), var(--tint, transparent)), var(--card); border: 1px solid var(--tint-border, var(--border)); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; cursor: pointer; }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(17,24,39,.1); }
.thumb { aspect-ratio: 1 / 1; position: relative; display: grid; place-items: center; overflow: hidden; }
/* Show the whole product image inside its square, whatever its shape */
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb .brand { font-size: 46px; font-weight: 800; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.15); text-align: center; line-height: 1.05; padding: 10px; }
.thumb .brand small { display: block; font-size: 14px; font-weight: 600; opacity: .9; margin-top: 6px; letter-spacing: .04em; }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.92); color: var(--text); font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.badge.sale { background: #fee2e2; color: #b91c1c; }
.price-tag { position: absolute; bottom: 10px; right: 10px; background: var(--price); color: #fff; font-weight: 800; font-size: 15px; padding: 6px 12px; border-radius: 999px; box-shadow: 0 4px 12px rgba(239,68,68,.35); }
.price-tag s { opacity: .75; font-weight: 500; font-size: 12px; margin-right: 4px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.meta .ok { color: var(--green); font-weight: 600; }
.buy { margin-top: auto; border: 0; background: linear-gradient(90deg, #4f46e5, #2563eb); color: #fff; font-weight: 700; font-size: 14px; padding: 10px; border-radius: 10px; }
.buy:hover { filter: brightness(1.08); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 50px 0; }

/* ---------- Product popup ---------- */
.overlay { position: fixed; inset: 0; background: rgba(17,24,39,.55); display: none; z-index: 100; }
.overlay.open { display: flex; }
.x-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--soft); font-size: 16px; flex: 0 0 auto; }
.x-btn:hover { background: #e5e7eb; }
.p-title { font-size: 22px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.ca-titlebox { display: grid; gap: 8px; }
.stock-line { display: inline-flex; width: fit-content; align-items: center; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; margin-top: 6px; }
.stock-line.ok { background: #d1fae5; color: #047857; }
.stock-line.low { background: #ffedd5; color: #c2410c; }
.stock-line.out { background: #fee2e2; color: #b91c1c; }
.p-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.p-price b { font-size: 32px; font-weight: 800; color: var(--text); }
.p-price s { color: var(--muted); font-size: 16px; }
.save { font-size: 12px; font-weight: 700; color: #b91c1c; background: #fee2e2; padding: 3px 8px; border-radius: 6px; }

.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spec { background: var(--soft); border-radius: 12px; padding: 10px 12px; }
.spec span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.spec b { font-size: 14px; font-weight: 600; }
.features { list-style: none; display: grid; gap: 8px; }
.features li { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; }
.features li::before { content: '✓'; flex: 0 0 20px; height: 20px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.rich { font-size: 14px; line-height: 1.65; color: #374151; }
.rich p + p, .rich ul, .rich ol { margin-top: 8px; }
.rich ul, .rich ol { padding-left: 20px; }
.rich img { max-width: 100%; height: auto; border-radius: 10px; }
.rich a { color: var(--primary); text-decoration: underline; }
.steps-list { counter-reset: s; list-style: none; display: grid; gap: 10px; }
.steps-list li { counter-increment: s; display: flex; gap: 12px; font-size: 14px; line-height: 1.5; }
.steps-list li::before { content: counter(s); flex: 0 0 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq summary { font-weight: 600; font-size: 14px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.faq summary::after { content: '+'; color: var(--muted); font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: '–'; }
.faq p { font-size: 14px; color: #4b5563; margin-top: 8px; line-height: 1.55; }

.tabs { display: flex; gap: 4px; background: var(--soft); padding: 4px; border-radius: 12px; }
.tab { flex: 1; border: 0; background: transparent; padding: 9px 8px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tab-panel { display: none; padding-top: 16px; }
.tab-panel.active { display: block; }

label.lbl { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }
.input { width: 100%; padding: 12px 13px; border-radius: 11px; border: 1px solid var(--border); font: inherit; font-size: 14px; background: #fff; }
.input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.err { font-size: 12px; color: #b91c1c; margin-top: 6px; display: none; }
.err.show { display: block; }

.methods { display: grid; gap: 10px; }
.method { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--border); border-radius: 14px; padding: 13px 14px; background: #fff; text-align: left; width: 100%; }
.method .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #d1d5db; flex: 0 0 auto; position: relative; }
.method.active { border-color: var(--primary); background: var(--primary-soft); }
.method.active .radio { border-color: var(--primary); }
.method.active .radio::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary); }
.method .m-text { flex: 1; }
.method .m-text b { display: block; font-size: 14px; }
.method .m-text small { font-size: 12px; color: var(--muted); }
.method .m-icon { font-size: 22px; line-height: 1; }

/* Checkout box: each section has its own soft color */
.co-sec { border-radius: 16px; padding: 14px 16px; }
.co-price { background: linear-gradient(135deg, #eef2ff, #fae8ff); border: 1px solid #e0e7ff; }
.co-price .p-price b { color: #4338ca; }
.co-email { background: #eff6ff; border: 1px solid #dbeafe; }
.co-email .lbl { color: #1e40af; }
.co-pay { background: #f5f3ff; border: 1px solid #ede9fe; }
.co-pay .lbl { color: #5b21b6; }
.co-pay .method { border-color: #ddd6fe; }
.co-pay .method.active { background: #fff; border-color: #7c3aed; box-shadow: 0 4px 14px rgba(124,58,237,.15); }
.co-pay .method.active .radio { border-color: #7c3aed; }
.co-pay .method.active .radio::after { background: #7c3aed; }
.co-sum { background: #fffbeb; border: 1px solid #fde68a; }
.co-sum .total { border-top-color: #fcd34d; }

.summary { display: grid; gap: 8px; font-size: 14px; }
.summary div { display: flex; justify-content: space-between; gap: 10px; color: #4b5563; }
.summary .total { border-top: 1px dashed var(--border); padding-top: 10px; color: var(--text); font-weight: 800; font-size: 16px; }
.pay-btn { width: 100%; border: 0; background: linear-gradient(90deg, #4f46e5, #2563eb); color: #fff; font-weight: 800; font-size: 16px; padding: 15px; border-radius: 13px; box-shadow: 0 8px 20px rgba(79,70,229,.3); }
.pay-btn:hover { filter: brightness(1.07); }
.pay-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* Layout: product details on the left, sticky checkout on the right */
.ca-wrap { margin: auto; width: min(1080px, calc(100% - 32px)); max-height: calc(100vh - 40px); background: #fff; border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; }
.ca-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.ca-crumb { font-size: 13px; color: var(--muted); }
.ca-crumb b { color: var(--text); font-weight: 600; }
.ca-body { overflow-y: auto; display: grid; grid-template-columns: 1fr 380px; }
.ca-left { padding: 24px; display: grid; gap: 22px; align-content: start; border-right: 1px solid var(--border); }
.ca-hero { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.ca-hero .thumb { border-radius: 16px; }
.ca-hero .thumb .brand { font-size: 30px; }
.ca-head { display: grid; gap: 10px; }
.ca-right { padding: 24px; background: #fafbfc; }
.ca-box { position: sticky; top: 0; display: grid; gap: 16px; }
/* Product name above the checkout box, only on small screens where the box comes first */
.ca-mtitle { display: none; gap: 12px; align-items: center; }
.ca-mtitle .thumb { width: 64px; flex: 0 0 64px; border-radius: 12px; }
.ca-mtitle .thumb .brand { font-size: 13px; padding: 4px; }
.ca-mtitle .thumb .brand small { display: none; }

@media (max-width: 900px) {
    .ca-body { grid-template-columns: 1fr; }
    .ca-left { border-right: 0; }
    .ca-right { order: -1; border-bottom: 1px solid var(--border); }
    .ca-mtitle { display: flex; }
    .ca-hero > .thumb, .ca-head .ca-titlebox { display: none; }
    .ca-hero { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .thumb .brand { font-size: 30px; }
    .card-title { font-size: 13.5px; }
    .meta .extra { display: none; }
    .ca-wrap { width: 100%; max-height: 100%; height: 100%; border-radius: 0; margin: 0; }
    .ca-left, .ca-right { padding: 18px 16px; }
    .p-title { font-size: 19px; }
}
