/* ══════════════════════════════════════════════════════════════
   Kliner Labs — B2B partner portal
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg: #F5F1EA;
  --bg-warm: #ECE7DD;
  --surface: #FFFFFF;
  --text: #1E1C18;
  --text-mid: #5C5750;
  --text-muted: #9A9489;
  --text-light: #B8B2A6;
  --matcha: #6B8C3F;
  --matcha-light: #8BAF5A;
  --matcha-dark: #4A6B28;
  --matcha-bg: #E8EFDD;
  --hojicha: #8B5E3C;
  --sencha: #5A8A6A;
  --herbal: #8E6B87;
  --ube: #7A5C9E;
  --border: #E2DDD4;
  --whatsapp: #25D366;
  --whatsapp-dark: #128C7E;
  --danger: #B4453C;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow: 0 8px 40px rgba(30, 28, 24, .12);
  --t: .25s cubic-bezier(.4, 0, .2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}
body.has-bar { padding-bottom: 120px; }
body.locked { overflow: hidden; }

button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--matcha); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── loading ─────────────────────────────────────────────────── */
#loading {
  position: fixed; inset: 0; z-index: 999; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity .45s ease; padding: 24px; text-align: center;
}
#loading[hidden] { display: none; }
.spinner {
  width: 46px; height: 46px; border: 4px solid var(--border);
  border-top-color: var(--matcha); border-radius: 50%;
  animation: spin 1s linear infinite; margin-bottom: 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--font-display); font-size: 19px; font-weight: 700;
  color: var(--matcha-dark); max-width: 380px; line-height: 1.5;
}

/* ── nav ─────────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(245, 241, 234, .9); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; max-width: 1240px; margin: 0 auto;
}
.nav-logo { display: flex; align-items: center; text-decoration: none; }
.nav-logo img { height: 42px; width: auto; object-fit: contain; }
.nav-cart {
  display: flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-radius: 100px; border: none; background: var(--matcha); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: var(--t);
}
.nav-cart:hover { background: var(--matcha-dark); }
.nav-cart svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; }
.cart-badge {
  background: #fff; color: var(--matcha); min-width: 20px; height: 20px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.cart-badge:empty { display: none; }

/* ── hero ────────────────────────────────────────────────────── */
.hero { padding: 130px 24px 64px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: 0; opacity: .5;
  background:
    radial-gradient(ellipse at 25% 20%, var(--matcha-bg) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 70%, #F0E6DA 0%, transparent 55%);
}
.hero-inner { position: relative; z-index: 1; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px;
  background: rgba(107, 140, 63, .08); border: 1px solid rgba(107, 140, 63, .18);
  padding: 8px 22px; border-radius: 100px; font-size: 13px;
  color: var(--matcha); font-weight: 600;
}
.hero h1 {
  font-family: var(--font-display); font-size: clamp(38px, 5.5vw, 64px);
  line-height: 1.06; font-weight: 900; margin-bottom: 18px; letter-spacing: -.5px;
}
.hero-sub {
  font-size: 17px; color: var(--text-mid); max-width: 540px;
  margin: 0 auto 34px; font-weight: 300; line-height: 1.75;
}
.hero-stats { display: flex; justify-content: center; gap: 48px; flex-wrap: wrap; }
.stat-num { font-family: var(--font-display); font-size: 34px; font-weight: 900; color: var(--matcha); }
.stat-lbl {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1.8px; font-weight: 600;
}
.stat-num:empty + .stat-lbl, .stat-lbl:empty { display: none; }

/* ── filters ─────────────────────────────────────────────────── */
.filters {
  position: sticky; top: 66px; z-index: 90; padding: 14px 0;
  background: rgba(245, 241, 234, .94); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.filters-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 0 24px;
  max-width: 1240px; margin: 0 auto; scrollbar-width: none;
}
.filters-row::-webkit-scrollbar { display: none; }
.fbtn {
  flex-shrink: 0; padding: 9px 20px; border-radius: 100px;
  border: 1.5px solid var(--border); background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: var(--t); white-space: nowrap;
}
.fbtn:hover { border-color: var(--matcha); color: var(--matcha); }
.fbtn.on { background: var(--matcha); color: #fff; border-color: var(--matcha); }

/* ── layout ──────────────────────────────────────────────────── */
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.products { padding: 44px 0 72px; }
.sec-label {
  font-size: 11px; letter-spacing: 2.6px; color: var(--text-light);
  font-weight: 600; margin-bottom: 6px; text-transform: uppercase;
}
.sec-title { font-family: var(--font-display); font-size: 34px; font-weight: 900; margin-bottom: 32px; }

.cgroup { margin-bottom: 56px; }
.cgroup:last-child { margin-bottom: 0; }
.cgroup.hidden { display: none; }
.cgroup-head {
  display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.cgroup-head h2 { font-family: var(--font-display); font-size: 25px; font-weight: 700; line-height: 1; }
.cgroup-head span { font-size: 12.5px; color: var(--text-light); font-weight: 600; }
#grid.solo .cgroup-head { display: none; }

.pgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px; align-items: start;
}

/* ── product card ────────────────────────────────────────────── */
.pcard {
  background: var(--surface); border-radius: var(--r-xl);
  border: 1.5px solid var(--border); transition: var(--t);
  display: flex; flex-direction: column; position: relative;
}
.pcard > *:last-child { border-bottom-left-radius: 26px; border-bottom-right-radius: 26px; }
.pcard:hover { box-shadow: var(--shadow); border-color: transparent; }
.pcard.in-cart { border-color: var(--matcha); }
.pcard.sampled { box-shadow: inset 0 0 0 1.5px var(--matcha); }

.pcard-img {
  position: relative; aspect-ratio: 1 / 1; background: #fff;
  border-bottom: 1px solid var(--border); overflow: hidden;
  border-radius: 26px 26px 0 0;
}
.pcard-img img { width: 100%; height: 100%; object-fit: contain; padding: 14px; display: block; }
.pcard-img.no-img { aspect-ratio: auto; height: 56px; background: transparent; border-bottom: none; }
.pcard-badge {
  position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 5px;
  font-family: var(--font-display); font-weight: 900; font-size: 13px;
  background: rgba(255, 255, 255, .94); border-radius: 100px; padding: 5px 13px;
}
.pcard-img.no-img .pcard-badge { top: 16px; background: var(--bg); }
.pcard-badge b { font-size: 19px; line-height: 1; }
.pcard-dot { position: absolute; top: 16px; right: 16px; width: 11px; height: 11px; border-radius: 50%; background: var(--text-light); }
.pcard-dot[data-cat="matcha"] { background: var(--matcha); }
.pcard-dot[data-cat="Japanese Teas"] { background: var(--hojicha); }
.pcard-dot[data-cat="herbal"] { background: var(--herbal); }
.pcard-dot[data-cat="ube"] { background: var(--ube); }

.pcard-body { padding: 22px 24px 0; }
.pcard-name { font-family: var(--font-display); font-size: 23px; font-weight: 700; line-height: 1.2; margin-bottom: 10px; }
.pcard-desc { font-size: 15px; line-height: 1.6; color: var(--text-mid); margin-bottom: 16px; }

.pcard-meta {
  display: flex; flex-direction: column; gap: 7px;
  padding: 14px 0; border-top: 1px solid var(--border); margin-bottom: 14px;
}
.meta-row { display: flex; gap: 12px; align-items: baseline; font-size: 13.5px; }
.meta-k { color: var(--text-light); font-weight: 600; min-width: 62px; flex-shrink: 0; }
.meta-v { color: var(--text); font-weight: 500; }

.pcard-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 4px 11px; border-radius: 100px; background: var(--bg); color: var(--text-mid); font-weight: 500; }
.tag.organic { background: var(--matcha-bg); color: var(--matcha-dark); }

.pcard-price { padding: 0 24px; margin-top: 16px; display: flex; align-items: baseline; gap: 8px; }
.pcard-price b { font-family: var(--font-display); font-size: 27px; font-weight: 900; color: var(--matcha-dark); }
.pcard-price span { font-size: 13px; color: var(--text-muted); }

/* ── serving calculator ──────────────────────────────────────── */
.calc { margin: 14px 24px 0; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--r-md); }
.calc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.calc-label { font-size: 13px; color: var(--text-mid); font-weight: 500; }
.calc-cost { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.calc-slider { position: relative; height: 24px; display: flex; align-items: center; }
.calc-track { width: 100%; height: 6px; border-radius: 3px; background: var(--bg-warm); display: block; }
.calc-fill { display: block; height: 100%; border-radius: 3px; background: var(--matcha); transition: width .12s ease; }
.calc-slider input[type=range] {
  position: absolute; inset: 0; width: 100%; margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.calc-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--matcha); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18); cursor: pointer;
}
.calc-slider input[type=range]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%; background: var(--matcha);
  border: 3px solid #fff; cursor: pointer;
}
.calc-presets { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.preset {
  font-size: 11.5px; padding: 3px 10px; border-radius: 100px;
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  cursor: pointer; font-weight: 500; transition: var(--t);
}
.preset:hover, .preset.on { background: var(--matcha-bg); border-color: var(--matcha); color: var(--matcha-dark); }

/* ── sample row ──────────────────────────────────────────────── */
.samplerow {
  margin: 12px 24px 0; width: calc(100% - 48px); display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: transparent; cursor: pointer; transition: var(--t); text-align: left;
}
.samplerow:hover { border-color: var(--matcha); }
.samplerow.on { border-color: var(--matcha); background: var(--matcha-bg); }
.tick {
  width: 21px; height: 21px; border-radius: 6px; border: 1.5px solid var(--text-light);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: #fff; transition: var(--t);
}
.samplerow.on .tick { background: var(--matcha); border-color: var(--matcha); }
.tick svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3.5; fill: none; opacity: 0; }
.samplerow.on .tick svg { opacity: 1; }
.samplerow-txt { font-size: 13.5px; font-weight: 600; color: var(--text-mid); flex: 1; }
.samplerow.on .samplerow-txt { color: var(--matcha-dark); }
.samplerow-amt { font-size: 13.5px; font-weight: 700; }

/* ── quantity stepper ────────────────────────────────────────── */
.pcard-foot {
  padding: 16px 24px; margin-top: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.qty {
  position: relative; flex: 1; display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: var(--r-sm); background: #fff;
}
.qty-step {
  width: 38px; height: 40px; border: none; background: transparent;
  font-size: 17px; color: var(--text-mid); cursor: pointer; border-radius: var(--r-sm);
}
.qty-step:hover:not(:disabled) { background: var(--bg); color: var(--matcha-dark); }
.qty-step:disabled { opacity: .28; cursor: default; }
.qty-val {
  flex: 1; height: 40px; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 14px; font-weight: 600; color: var(--text);
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}
.qty-val svg { width: 11px; height: 11px; stroke: var(--text-muted); stroke-width: 2.5; fill: none; }
.qty-val:hover { background: var(--bg); }

.qty-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow); overflow: hidden;
}
.qty-menu-h {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 14px 8px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
.qty-menu-h span { text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.qty-menu-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); }
.qty-opt {
  border: none; background: #fff; padding: 11px 6px; font-size: 13px;
  font-weight: 500; color: var(--text-mid); cursor: pointer;
}
.qty-opt:hover { background: var(--bg); }
.qty-opt.on { background: var(--matcha-bg); color: var(--matcha-dark); font-weight: 700; }

.add {
  padding: 11px 22px; border-radius: var(--r-sm); border: none;
  background: var(--text); color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: var(--t); white-space: nowrap;
}
.add:hover { background: var(--matcha-dark); }
.pcard.in-cart .add { background: var(--matcha); }

/* ── flavour card button ─────────────────────────────────────── */
.flavour {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 13px; border: none; border-top: 1px solid var(--border);
  background: transparent; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: var(--t);
}
.flavour:hover:not(:disabled) { color: var(--matcha-dark); background: var(--matcha-bg); }
.flavour:disabled { opacity: .6; cursor: wait; }
.flavour svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ── terms & footer ──────────────────────────────────────────── */
.terms { padding: 72px 0; border-top: 1px solid var(--border); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 22px; }
.tcard { padding: 26px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.tcard-icon { font-size: 22px; margin-bottom: 10px; }
.tcard-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.tcard-text { font-size: 14px; color: var(--text-mid); line-height: 1.7; }

footer { padding: 44px 24px 30px; border-top: 1px solid var(--border); text-align: center; color: var(--text-muted); font-size: 14px; }
footer a { color: var(--matcha); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.foot-links { margin-top: 14px; opacity: .55; }

/* ── sample bar ──────────────────────────────────────────────── */
.samplebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  background: var(--text); color: #fff;
  transform: translateY(110%); transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}
.samplebar.open { transform: translateY(0); }
.samplebar-inner {
  max-width: 1240px; margin: 0 auto; padding: 15px 24px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.sb-count { font-size: 15px; font-weight: 600; }
.sb-count em { font-style: normal; opacity: .55; font-weight: 400; }
.sb-note { font-size: 12.5px; opacity: .6; line-height: 1.45; max-width: 560px; }
.sb-right { margin-left: auto; text-align: right; }
.sb-total { font-family: var(--font-display); font-size: 25px; font-weight: 900; line-height: 1.1; }
.sb-unit { font-size: 11.5px; opacity: .55; }
.sb-send {
  padding: 13px 24px; border-radius: var(--r-sm); border: none;
  background: var(--whatsapp); color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 9px;
}
.sb-send:hover { background: var(--whatsapp-dark); }
.sb-send svg { width: 19px; height: 19px; fill: currentColor; }
.sb-clear { background: none; border: none; color: #fff; opacity: .5; font-size: 13px; font-weight: 600; cursor: pointer; }
.sb-clear:hover { opacity: 1; }

/* ── drawer ──────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(30, 28, 24, .4);
  backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: var(--t);
}
.overlay.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 201;
  width: 430px; max-width: 92vw; background: var(--bg);
  transform: translateX(100%); transition: transform .4s cubic-bezier(.4, 0, .2, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 22px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-head h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.drawer-x {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--bg-warm); cursor: pointer; font-size: 17px;
}
.drawer-x:hover { background: var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 24px; }
.drawer-empty { text-align: center; padding: 64px 20px; color: var(--text-muted); }
.drawer-empty p { font-size: 16px; font-weight: 600; color: var(--text-mid); }
.drawer-empty-sub { font-size: 14px !important; font-weight: 400 !important; margin-top: 6px; color: var(--text-muted) !important; }

.citem { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.citem-main { flex: 1; min-width: 0; }
.citem-name { font-weight: 600; font-size: 15px; }
.citem-name span { opacity: .4; }
.citem-price { font-size: 13px; color: var(--text-muted); }
.citem-qty { display: flex; align-items: center; gap: 6px; }
.citem-step {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 15px;
}
.citem-step:hover { border-color: var(--matcha); color: var(--matcha); }
.citem-val { font-weight: 700; font-size: 13.5px; min-width: 52px; text-align: center; }
.citem-x { border: none; background: none; cursor: pointer; color: var(--text-light); font-size: 18px; padding: 4px; }
.citem-x:hover { color: var(--danger); }

.drawer-foot { padding: 18px 24px; border-top: 1px solid var(--border); }
.drawer-note {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); font-family: var(--font-body);
  font-size: 14px; resize: vertical; min-height: 56px; margin-bottom: 14px; background: #fff;
}
.drawer-note:focus { outline: none; border-color: var(--matcha); }
.wa-send {
  width: 100%; padding: 15px; border: none; border-radius: var(--r-md);
  background: var(--whatsapp); color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.wa-send:hover { background: var(--whatsapp-dark); }
.wa-send svg { width: 20px; height: 20px; fill: currentColor; }

/* ── contact modal ───────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; z-index: 400; background: rgba(30, 28, 24, .5);
  backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: var(--t); padding: 20px;
}
.modal-bg.open { opacity: 1; visibility: visible; }
.modal { background: #fff; border-radius: var(--r-lg); padding: 30px; width: 340px; max-width: 100%; text-align: center; }
.modal h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.modal p { font-size: 14px; color: var(--text-mid); margin-bottom: 18px; }
.wa-contact {
  width: 100%; padding: 14px; border-radius: var(--r-sm); border: 1.5px solid var(--border);
  background: #fff; font-size: 15px; font-weight: 700; cursor: pointer; margin-bottom: 10px;
}
.wa-contact:hover { border-color: var(--whatsapp); color: var(--whatsapp-dark); }
.modal-cancel { font-size: 13px; color: var(--text-light); margin-top: 6px; cursor: pointer; border: none; background: none; font-weight: 600; }
.modal-cancel:hover { color: var(--text); }

/* ── mobile ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding: 116px 20px 48px; }
  .hero-stats { gap: 26px; }
  .pgrid { grid-template-columns: 1fr; gap: 16px; }
  .sec-title { font-size: 28px; }
  .samplebar-inner { padding: 13px 18px; gap: 12px; }
  .sb-note { display: none; }
  .sb-send { flex: 1; justify-content: center; }
  .qty-menu-list { grid-template-columns: repeat(4, 1fr); }
}
