:root{--green:#075a32;--bg:#f5f7f6;--text:#17211b;--muted:#66736b;--line:#dfe6e1}
*{box-sizing:border-box}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--text);padding-bottom:90px}
button,input,textarea{font:inherit}.hidden{display:none!important}
.topbar{height:66px;background:#fff;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 18px;position:sticky;top:0;z-index:10}
.topbar strong{display:block;color:var(--green);font-size:20px}.topbar small{color:var(--muted)}
.page{max-width:960px;margin:auto;padding:22px 14px}.card{max-width:520px;margin:40px auto;background:#fff;border:1px solid var(--line);border-radius:18px;padding:24px}
h1{font-size:30px;margin:0 0 8px}h2{margin:0}.eyebrow{font-size:12px;font-weight:800;color:#c81e1e;letter-spacing:.08em;margin-bottom:8px}
p{color:var(--muted);line-height:1.5}
input,textarea{width:100%;border:1px solid var(--line);border-radius:12px;padding:13px;outline:none;background:#fff}
.primary-btn,.secondary-btn,.link-btn,.icon-btn{border-radius:12px;font-weight:800;cursor:pointer}
.primary-btn{border:0;background:var(--green);color:#fff;padding:13px 18px}.secondary-btn{border:1px solid var(--green);background:#fff;color:var(--green);padding:12px 16px}
.link-btn,.icon-btn{border:0;background:transparent;color:var(--green)}.card .primary-btn{width:100%;margin-top:12px}
.welcome{margin-bottom:18px}.toolbar{display:grid;grid-template-columns:1fr auto;gap:10px;margin-bottom:16px}
.product-list{display:grid;gap:10px}
.product-card{background:#fff;border:1px solid var(--line);border-radius:15px;padding:10px 12px;display:grid;grid-template-columns:48px minmax(0,1fr);gap:10px;align-items:center;min-height:104px}
.product-image{width:48px;height:48px;border-radius:12px;background:#e9f1ec;object-fit:cover;display:grid;place-items:center;color:var(--green);font-weight:800}
.product-info{min-width:0}
.product-alias{font-weight:800;color:var(--green);font-size:17px;line-height:1.2}
.product-name{font-size:13px;color:var(--muted);margin-top:3px;line-height:1.25}
.product-actions{margin-top:8px;display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:7px!important;flex-wrap:nowrap!important;width:100%!important}
.delete-product-btn{width:38px!important;height:38px!important;min-width:38px!important;flex:0 0 38px!important;padding:0!important;border:1px solid var(--line)!important;border-radius:10px!important;background:#fff!important;color:#d71920!important;font-size:18px!important;display:grid!important;place-items:center!important}
.qty{width:122px!important;min-width:122px!important;max-width:122px!important;flex:0 0 122px!important;display:grid!important;grid-template-columns:36px 50px 36px!important;border:1px solid var(--line)!important;border-radius:10px!important;overflow:hidden!important}
.qty button{width:36px!important;height:38px!important;padding:0!important;border:0!important;background:#f1f5f2!important;color:var(--green)!important;font-size:20px!important}
.qty input{width:50px!important;min-width:50px!important;max-width:50px!important;height:38px!important;padding:0!important;margin:0!important;border:0!important;border-left:1px solid var(--line)!important;border-right:1px solid var(--line)!important;border-radius:0!important;text-align:center!important;font-weight:800!important;background:#fff!important}
.qty-unit{white-space:nowrap;font-size:14px;color:var(--text)}
.cart-bar{position:fixed;left:50%;bottom:14px;transform:translateX(-50%);width:min(720px,calc(100% - 24px));background:#15251b;color:#fff;padding:12px 14px;border-radius:17px;display:flex;justify-content:space-between;align-items:center;z-index:20}
.cart-bar span{display:block;color:#cbd4ce;font-size:13px}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.42);display:grid;place-items:center;padding:14px;z-index:30}
.modal-card{width:min(600px,100%);max-height:90vh;overflow:auto;background:#fff;border-radius:18px;padding:20px}
.modal-head,.review-total{display:flex;justify-content:space-between;align-items:center}
.review-item{display:flex;justify-content:space-between;gap:12px;background:#f4f6f5;border-radius:10px;padding:11px;margin:8px 0}.review-item small{display:block;color:var(--muted)}
.actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}.review-total{padding:16px 0}.success-card{text-align:center}.success-icon{width:60px;height:60px;border-radius:50%;background:#dff5e7;color:var(--green);display:grid;place-items:center;font-size:32px;font-weight:800;margin:0 auto 14px}
.message{padding:12px;border-radius:10px;margin-bottom:14px;font-weight:700}.message.error{background:#feecec;color:#9f1d1d}.empty{text-align:center;color:var(--muted);padding:24px}

/* Product picker */
.picker-card{width:min(640px,100%);padding:18px;overflow:hidden}
.picker-search-wrap{margin:12px 0}
.picker-results{display:grid;gap:8px;max-height:58vh;overflow:auto;padding-right:2px}
.picker-item{display:grid;grid-template-columns:48px minmax(0,1fr);gap:10px;align-items:center;padding:10px;border:1px solid var(--line);border-radius:12px;background:#fff;cursor:pointer}
.picker-title{font-weight:800;color:var(--green);font-size:16px;line-height:1.25}
.picker-meta{font-size:13px;color:var(--muted);margin-top:3px}

@media(max-width:650px){
  .toolbar{grid-template-columns:1fr}.actions{grid-template-columns:1fr}
  .product-card{grid-template-columns:44px minmax(0,1fr);padding:9px 10px;gap:9px;min-height:98px}
  .product-image{width:44px;height:44px}.product-alias{font-size:16px}
  .product-actions{gap:6px!important}
  .delete-product-btn{width:36px!important;height:36px!important;min-width:36px!important;flex-basis:36px!important}
  .qty{width:116px!important;min-width:116px!important;max-width:116px!important;flex-basis:116px!important;grid-template-columns:34px 48px 34px!important}
  .qty button{width:34px!important;height:36px!important}.qty input{width:48px!important;min-width:48px!important;max-width:48px!important;height:36px!important}
  .qty-unit{font-size:14px}
  .modal{align-items:end;padding:0}
  .picker-card{width:100%;max-height:78vh;border-radius:18px 18px 0 0;padding:16px}
  .picker-results{max-height:56vh}
}


/* V4: remove DF placeholders and stabilize picker */
.product-card{
  grid-template-columns:minmax(0,1fr) !important;
}
.product-card.has-image{
  grid-template-columns:48px minmax(0,1fr) !important;
}
.picker-item{
  grid-template-columns:minmax(0,1fr) !important;
}
.picker-item.has-image{
  grid-template-columns:48px minmax(0,1fr) !important;
}
body.modal-open{
  overflow:hidden !important;
}
#productPickerModal{
  height:100dvh !important;
  min-height:100dvh !important;
}
#productPickerModal .picker-card{
  height:78dvh !important;
  max-height:78dvh !important;
  display:flex !important;
  flex-direction:column !important;
}
#productPickerModal .picker-results{
  flex:1 1 auto !important;
  min-height:0 !important;
  max-height:none !important;
  overflow-y:auto !important;
  overscroll-behavior:contain !important;
}
@media(max-width:650px){
  .product-card.has-image{
    grid-template-columns:44px minmax(0,1fr) !important;
  }
  #productPickerModal .picker-card{
    height:76dvh !important;
    max-height:76dvh !important;
  }
}


/* V5: prevent a single picker result from stretching vertically */
#productPickerModal .picker-results{
  display:grid !important;
  grid-auto-rows:max-content !important;
  align-content:start !important;
  align-items:start !important;
}
#productPickerModal .picker-item{
  height:auto !important;
  min-height:72px !important;
  max-height:none !important;
  align-self:start !important;
  padding:10px 12px !important;
}
#productPickerModal .picker-item > div{
  min-width:0 !important;
}


/* Promotion V1 */
.promotion-summary{margin:0 0 12px;padding:11px 13px;border:1px solid #f0c36b;border-radius:12px;background:#fff8e8;color:#7a4b00;font-size:14px;font-weight:700}
.promotion-summary>div+div{margin-top:5px}
.product-promotion-slot:empty{display:none}
.product-promotion{margin-top:7px;padding:6px 8px;border-radius:8px;background:#fff5da;color:#9a5a00;font-size:12px;font-weight:700;line-height:1.3}
.product-promotion.is-qualified{background:#e7f7ed;color:#075a32}
.review-promotions{margin:12px 0;padding:12px;border-radius:12px;background:#fff8e8;border:1px solid #f0c36b}
.review-promotion-title{font-weight:800;color:#9a5a00;margin-bottom:8px}
.review-gift{display:flex;justify-content:space-between;gap:12px;padding:5px 0}


/* Promotion attention ticker V1 */
.promotion-ticker{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:9px;
  margin:0 0 12px;
  min-height:46px;
  border:1px solid #f3c761;
  border-radius:13px;
  background:linear-gradient(90deg,#fff8df,#fffdf4,#fff8df);
  box-shadow:0 5px 16px rgba(154,90,0,.09);
  overflow:hidden;
}
.promotion-ticker-label{
  align-self:stretch;
  display:flex;
  align-items:center;
  padding:0 10px;
  background:#f3b91f;
  color:#5f3900;
  font-size:11px;
  font-weight:1000;
  letter-spacing:.08em;
}
.promotion-ticker-window{
  min-width:0;
  overflow:hidden;
  mask-image:linear-gradient(90deg,transparent,#000 4%,#000 96%,transparent);
  -webkit-mask-image:linear-gradient(90deg,transparent,#000 4%,#000 96%,transparent);
}
.promotion-ticker-track{
  display:flex;
  width:max-content;
  align-items:center;
  animation:promotionTickerMove 28s linear infinite;
}
.promotion-ticker.is-static .promotion-ticker-track{
  animation:promotionTickerPulse 2.6s ease-in-out infinite;
  width:100%;
}
.promotion-ticker-item{
  flex:0 0 auto;
  border:0;
  background:transparent;
  color:#744700;
  padding:10px 20px 10px 4px;
  font-size:13px;
  font-weight:850;
  white-space:nowrap;
  text-align:left;
}
.promotion-ticker-item span{
  color:#087443;
  font-weight:1000;
}
.promotion-ticker:hover .promotion-ticker-track,
.promotion-ticker:active .promotion-ticker-track{
  animation-play-state:paused;
}
.product-card.promotion-focus{
  outline:3px solid rgba(243,185,31,.55);
  box-shadow:0 0 0 6px rgba(243,185,31,.14),0 10px 24px rgba(15,23,42,.1);
  transition:outline .2s,box-shadow .2s;
}
@keyframes promotionTickerMove{
  from{transform:translateX(0)}
  to{transform:translateX(-50%)}
}
@keyframes promotionTickerPulse{
  0%,100%{opacity:.78;transform:translateX(0)}
  50%{opacity:1;transform:translateX(3px)}
}
@media (prefers-reduced-motion:reduce){
  .promotion-ticker-track{animation:none!important}
}
