/* Colours, radius and font come from Admin > Settings > Appearance (injected as CSS variables). */
:root{
  --primary:#1e8a4c;--primary-dark:#166a3a;--primary-soft:#e9f5ee;--primary-mid:#b6dcc6;
  --r:14px;--r-sm:9px;
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  --bg:#f6f7f6;--surface:#fff;--text:#1b2320;--muted:#6a746f;--line:#e5e9e6;--danger:#d64545;
  --head-shadow:0 1px 0 var(--line);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html{scroll-behavior:smooth;}
body{margin:0;font-family:var(--font);background:var(--bg);color:var(--text);font-size:15px;line-height:1.4;}
body.modal-open{overflow:hidden;}
button{font-family:inherit;cursor:pointer;}
input,textarea,select{font-family:inherit;font-size:16px;color:var(--text);}
a{color:inherit;}
[hidden]{display:none !important;}
.ic{flex:none;}
:focus-visible{outline:2px solid var(--primary);outline-offset:2px;}

/* ================= Announcement ================= */
.announce{background:var(--primary);color:#fff;text-align:center;font-size:13px;padding:7px 14px;}

/* ================= Sticky header ================= */
.site-head{position:sticky;top:0;z-index:40;background:var(--surface);box-shadow:var(--head-shadow);padding-top:env(safe-area-inset-top,0px);}
.head-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px 6px;max-width:1100px;margin:0 auto;}
.brand{display:flex;align-items:center;gap:10px;min-width:0;}
.brand-logo{width:38px;height:38px;border-radius:var(--r-sm);object-fit:cover;flex:none;}
.brand-mark{width:38px;height:38px;border-radius:var(--r-sm);background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:18px;flex:none;}
.brand-text{display:flex;flex-direction:column;min-width:0;line-height:1.2;}
.brand-name{font-weight:700;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.brand-tagline{font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.head-actions{display:flex;align-items:center;gap:8px;flex:none;}
.lang-switch{display:flex;background:var(--bg);border-radius:99px;padding:3px;border:1px solid var(--line);}
.lang-switch button{border:none;background:none;padding:5px 10px;border-radius:99px;font-size:12.5px;font-weight:600;color:var(--muted);}
.lang-switch button.on{background:var(--primary);color:#fff;}
.cart-btn{position:relative;width:42px;height:42px;border-radius:50%;border:1px solid var(--line);background:var(--surface);color:var(--text);display:flex;align-items:center;justify-content:center;}
.cart-badge{position:absolute;top:-4px;right:-4px;min-width:19px;height:19px;padding:0 5px;border-radius:99px;background:var(--primary);color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;border:2px solid var(--surface);}

.search-row{padding:2px 14px 8px;max-width:1100px;margin:0 auto;}
.search-field{display:flex;align-items:center;gap:8px;background:var(--bg);border:1px solid var(--line);border-radius:var(--r-sm);padding:0 12px;height:42px;color:var(--muted);}
.search-field:focus-within{border-color:var(--primary);background:var(--surface);}
.search-field input{flex:1;min-width:0;border:none;background:none;outline:none;height:100%;}
.search-field input::-webkit-search-cancel-button{display:none;}
.search-clear{border:none;background:none;color:var(--muted);display:flex;padding:4px;}

/* Text tabs: swipe with a finger, no arrows, no scrollbar */
.tabs,.subtabs{display:flex;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;max-width:1100px;margin:0 auto;}
.tabs::-webkit-scrollbar,.subtabs::-webkit-scrollbar{display:none;}
.tabs{padding:0 8px;border-top:1px solid var(--line);}
.tab{flex:none;border:none;background:none;padding:12px 14px 10px;font-size:14.5px;font-weight:600;color:var(--muted);position:relative;white-space:nowrap;}
.tab.active{color:var(--primary-dark);}
.tab.active::after{content:"";position:absolute;left:12px;right:12px;bottom:0;height:3px;border-radius:3px 3px 0 0;background:var(--primary);}
.subtabs{gap:8px;padding:8px 14px;background:var(--bg);border-top:1px solid var(--line);}
.subtab{flex:none;border:1px solid var(--line);background:var(--surface);border-radius:99px;padding:6px 14px;font-size:13px;color:var(--text);white-space:nowrap;}
.subtab.active{background:var(--primary);border-color:var(--primary);color:#fff;font-weight:600;}

/* Photo tabs (Settings > Look & feel > Category tabs = Photo tabs) */
.tabs.photo-tabs{gap:4px;padding:8px 8px 0;}
.tab.has-pic{display:flex;flex-direction:column;align-items:center;gap:6px;padding:6px 10px 10px;min-width:72px;}
.tab-pic{width:54px;height:54px;border-radius:50%;overflow:hidden;background:var(--primary-soft);color:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:20px;border:2px solid transparent;}
.tab-pic img{width:100%;height:100%;object-fit:cover;display:block;}
.tab.has-pic.active .tab-pic{border-color:var(--primary);}
.tab.has-pic .tab-label{font-size:12.5px;max-width:84px;overflow:hidden;text-overflow:ellipsis;}
.tab.has-pic.active::after{left:16px;right:16px;}

/* ================= Product list ================= */
.page{max-width:1100px;margin:0 auto;padding:14px 14px 24px;min-height:60vh;}
.list-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;}
.list-title{font-size:18px;margin:0;font-weight:700;min-width:0;overflow:hidden;text-overflow:ellipsis;}
.list-tools{display:flex;align-items:center;gap:8px;flex:none;}
.sort-select{border:1px solid var(--line);border-radius:var(--r-sm);padding:7px 8px;background:var(--surface);font-size:13px;max-width:132px;}
.view-toggle{display:flex;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-sm);overflow:hidden;}
.view-btn{border:none;background:none;width:36px;height:34px;color:var(--muted);display:flex;align-items:center;justify-content:center;}
.view-btn.active{background:var(--primary-soft);color:var(--primary-dark);}

.product-list{display:grid;gap:10px;grid-template-columns:1fr;}
.state-msg{grid-column:1/-1;text-align:center;color:var(--muted);padding:48px 0;}
.product-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:10px;display:flex;align-items:center;gap:12px;}
.product-img{width:72px;height:72px;border-radius:var(--r-sm);overflow:hidden;flex:none;background:var(--primary-soft);display:flex;align-items:center;justify-content:center;}
.product-img img{width:100%;height:100%;object-fit:cover;display:block;}
.img-initial{font-size:26px;font-weight:700;color:var(--primary);}
.product-info{flex:1;min-width:0;}
.product-name{font-weight:600;font-size:15px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;}
.product-price{margin-top:2px;font-size:13px;color:var(--muted);}
.product-price b{color:var(--text);font-size:15px;}
.product-desc{margin-top:3px;font-size:12px;color:var(--muted);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.product-action{flex:none;}
.add-btn{display:inline-flex;align-items:center;gap:5px;border:1.5px solid var(--primary);background:var(--surface);color:var(--primary-dark);border-radius:var(--r-sm);padding:8px 14px;font-weight:700;font-size:14px;min-width:82px;justify-content:center;}
.add-btn:active{background:var(--primary-soft);}
.add-btn.in-cart{background:var(--primary);color:#fff;}
.oos-tag{font-size:12px;color:var(--danger);background:#fdecec;padding:5px 10px;border-radius:99px;font-weight:600;white-space:nowrap;}
.product-card.is-oos .product-img,.product-card.is-oos .product-info{opacity:.55;}

/* Grid view */
.product-list[data-view="grid"]{grid-template-columns:repeat(2,1fr);}
.product-list[data-view="grid"] .product-card{flex-direction:column;align-items:stretch;padding:0;overflow:hidden;gap:0;}
.product-list[data-view="grid"] .product-img{width:100%;height:auto;aspect-ratio:4/3;border-radius:0;}
.product-list[data-view="grid"] .product-info{padding:10px 10px 6px;}
.product-list[data-view="grid"] .product-desc{display:none;}
.product-list[data-view="grid"] .product-action{padding:0 10px 10px;}
.product-list[data-view="grid"] .add-btn,.product-list[data-view="grid"] .oos-tag{width:100%;justify-content:center;text-align:center;}

@media(min-width:620px){
  .product-list[data-view="list"]{grid-template-columns:repeat(2,1fr);}
  .product-list[data-view="grid"]{grid-template-columns:repeat(3,1fr);}
}
@media(min-width:900px){
  .product-list[data-view="list"]{grid-template-columns:repeat(3,1fr);}
  .product-list[data-view="grid"]{grid-template-columns:repeat(4,1fr);}
}

/* ================= Footer ================= */
.site-foot{max-width:1100px;margin:0 auto;padding:22px 14px 28px;text-align:center;color:var(--muted);font-size:13px;border-top:1px solid var(--line);}
.foot-contact{display:flex;flex-direction:column;gap:3px;margin-bottom:12px;}
.foot-contact strong{color:var(--text);}
.foot-contact a{color:var(--primary-dark);font-weight:600;text-decoration:none;}
.foot-text{margin-bottom:10px;}
.foot-credit{font-size:12px;opacity:.85;}
body.has-cart-bar .site-foot{padding-bottom:90px;}

/* ================= Floating cart bar ================= */
.floating-cart-bar{position:fixed;left:0;right:0;bottom:0;z-index:45;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));pointer-events:none;}
.fcb-inner{pointer-events:auto;display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;max-width:560px;margin:0 auto;background:var(--primary);color:#fff;border:none;border-radius:var(--r);padding:13px 16px;box-shadow:0 8px 24px rgba(0,0,0,.18);font-size:14px;}
.fcb-left,.fcb-right{display:flex;align-items:center;gap:7px;}
.fcb-right b{font-weight:700;}

/* ================= Popups (bottom sheet on phones, centred on desktop) ================= */
.modal{position:fixed;inset:0;z-index:100;display:none;align-items:flex-end;justify-content:center;}
.modal.open{display:flex;}
.modal-backdrop{position:absolute;inset:0;background:rgba(14,22,18,.5);}
.modal-card{position:relative;background:var(--surface);width:100%;max-width:480px;max-height:92vh;max-height:92dvh;border-radius:var(--r) var(--r) 0 0;display:flex;flex-direction:column;animation:sheetUp .22s ease-out;}
@keyframes sheetUp{from{transform:translateY(40px);opacity:.4;}to{transform:none;opacity:1;}}
@media(min-width:640px){
  .modal{align-items:center;padding:20px;}
  .modal-card{border-radius:var(--r);max-height:88vh;}
}
.modal-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 16px;border-bottom:1px solid var(--line);}
.modal-head h2{margin:0;font-size:17px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.modal-body{padding:14px 16px;overflow-y:auto;-webkit-overflow-scrolling:touch;flex:1;}
.modal-foot{padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--line);display:flex;flex-direction:column;gap:10px;}
.modal-foot:empty{display:none;}
.modal-form{display:flex;flex-direction:column;min-height:0;flex:1;}
.icon-btn{border:none;background:var(--bg);width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--text);flex:none;}
.icon-btn.sm{width:34px;height:34px;}
.icon-btn.danger{color:var(--danger);}

.btn-primary{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;border:none;background:var(--primary);color:#fff;border-radius:var(--r-sm);padding:14px 16px;font-size:15px;font-weight:700;text-decoration:none;}
.btn-primary:disabled{background:#c6cdc9;cursor:not-allowed;}
.btn-primary.wa{background:#1fa855;margin-bottom:8px;}
.btn-ghost{display:flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:var(--r-sm);padding:12px 16px;font-size:14px;font-weight:600;width:100%;}
.btn-ghost.danger{color:var(--danger);}
#wmFoot{flex-direction:row;}
#wmFoot .btn-ghost{width:auto;flex:none;}
#wmFoot .grow{flex:1;}

/* Weight popup */
.wm-head{display:flex;align-items:center;gap:14px;margin-bottom:14px;}
.wm-img{width:64px;height:64px;border-radius:var(--r-sm);object-fit:cover;}
.wm-price{font-size:14px;color:var(--muted);}
.wm-price b{font-size:20px;color:var(--text);}
.wm-price small{display:block;font-size:12px;margin-top:2px;}
.wm-label{font-size:13px;font-weight:600;color:var(--muted);margin:14px 0 8px;}
.wm-chips{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;}
.wm-chip{display:flex;flex-direction:column;align-items:center;gap:2px;padding:10px 4px;border:1.5px solid var(--line);background:var(--surface);border-radius:var(--r-sm);}
.wm-chip b{font-size:15px;}
.wm-chip small{font-size:12px;color:var(--muted);}
.wm-chip.active{border-color:var(--primary);background:var(--primary-soft);}
.wm-chip.active b{color:var(--primary-dark);}
.wm-custom{display:flex;gap:8px;}
.wm-custom input{flex:1;min-width:0;border:1.5px solid var(--line);border-radius:var(--r-sm);padding:11px 12px;outline:none;}
.wm-custom input:focus{border-color:var(--primary);}
.seg{display:flex;border:1.5px solid var(--line);border-radius:var(--r-sm);overflow:hidden;}
.seg button{border:none;background:var(--surface);padding:0 16px;font-weight:600;color:var(--muted);}
.seg button.on{background:var(--primary);color:#fff;}

/* Cart popup */
.cart-empty{display:flex;flex-direction:column;align-items:center;gap:6px;padding:36px 0;color:var(--muted);text-align:center;}
.cart-empty b{color:var(--text);margin-top:6px;}
.cart-line{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--line);}
.cart-line:last-child{border-bottom:none;}
.cl-thumb{width:48px;height:48px;border-radius:var(--r-sm);background:var(--primary-soft);color:var(--primary);font-weight:700;display:flex;align-items:center;justify-content:center;overflow:hidden;flex:none;}
.cl-thumb img{width:100%;height:100%;object-fit:cover;}
.cl-body{flex:1;min-width:0;}
.cl-name{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.cl-meta{font-size:13px;color:var(--muted);margin-top:1px;}
.cl-actions{display:flex;gap:6px;}
.totals{display:flex;flex-direction:column;gap:6px;font-size:14px;}
.totals>div,.co-summary>div{display:flex;justify-content:space-between;}
.totals .grand,.co-summary .grand{font-weight:700;font-size:17px;border-top:1px dashed var(--line);padding-top:8px;margin-top:2px;}
.hint{font-size:12.5px;color:var(--primary-dark);background:var(--primary-soft);padding:8px 10px;border-radius:var(--r-sm);}
.hint.warn{color:#9a5b00;background:#fff4de;}

/* Forms */
.field{display:block;margin-bottom:12px;}
.field span{display:block;font-size:13px;font-weight:600;color:var(--muted);margin-bottom:5px;}
.field input,.field textarea{width:100%;border:1.5px solid var(--line);border-radius:var(--r-sm);padding:11px 12px;outline:none;background:var(--surface);resize:vertical;}
.field input:focus,.field textarea:focus{border-color:var(--primary);}
.hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0;}
.form-error{background:#fdecec;color:var(--danger);border-radius:var(--r-sm);padding:9px 12px;font-size:13.5px;margin-top:8px;}
.co-summary{margin-top:14px;padding:12px;background:var(--bg);border-radius:var(--r-sm);display:flex;flex-direction:column;gap:6px;font-size:14px;}

/* Order success */
.success-body{text-align:center;padding:28px 20px 20px;}
.success-icon{width:64px;height:64px;border-radius:50%;background:var(--primary-soft);color:var(--primary);display:flex;align-items:center;justify-content:center;margin:0 auto 12px;}
.success-body h2{margin:0 0 10px;font-size:20px;}
.order-no{display:inline-flex;flex-direction:column;gap:2px;background:var(--bg);border-radius:var(--r-sm);padding:8px 18px;margin-bottom:10px;}
.order-no span{font-size:12px;color:var(--muted);}
.order-no b{font-size:17px;letter-spacing:.3px;}
.success-body p{color:var(--muted);margin:0 0 18px;font-size:14px;}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto;}
  .modal-card{animation:none;}
}
