/* =====================================================================
   Box builder (spec ch. 9) - BUILDER stream. Mobile-first, RTL.
   ===================================================================== */
.hm-page--builder{--hm-b-line:#EFE7DA;--hm-b-soft:#F7F3EA;--hm-b-focus:0 0 0 3px #fff,0 0 0 6px var(--hm-olive);--hm-b-err:#B3261E;--hm-b-err-soft:#FDECEA;padding-bottom:40px}
.hm-page--builder .hm-builder__hero{margin-bottom:22px}
.hm-page--builder .hm-phero__lead{max-width:70ch}

/* line tabs */
.hm-builder__lines{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 20px}
.hm-builder__line{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-height:64px;padding:10px 16px;background:#fff;border:2px solid var(--hm-b-line);border-radius:16px;font:inherit;color:var(--hm-text);text-align:right;cursor:pointer;transition:border-color .15s,box-shadow .15s,transform .15s}
.hm-builder__line:hover{border-color:var(--hm-olive);transform:translateY(-1px)}
.hm-builder__line:focus-visible{outline:none;box-shadow:var(--hm-b-focus)}
.hm-builder__line[aria-selected="true"]{border-color:var(--hm-olive-dark);background:var(--hm-olive-soft);color:var(--hm-ink)}
.hm-builder__line-name{font-weight:700;font-size:15px;line-height:1.3}
.hm-builder__line-sub{font-size:13px;color:var(--hm-muted)}
.hm-builder__line[aria-selected="true"] .hm-builder__line-sub{color:var(--hm-olive-dark)}

/* "coming soon" line */
.hm-builder__soon{background:#fff;border:1px solid var(--hm-b-line);border-radius:20px;padding:32px 20px;text-align:center;box-shadow:var(--hm-shadow);max-width:640px;margin:0 auto}
.hm-builder__soon-icon{display:inline-flex;width:64px;height:64px;border-radius:50%;background:var(--hm-olive-soft);color:var(--hm-olive-dark);align-items:center;justify-content:center;margin-bottom:12px}
.hm-builder__soon-icon svg{width:30px;height:30px}
.hm-builder__soon h2{font-size:clamp(22px,2.6vw,28px);margin:0 0 8px}
.hm-builder__soon p{margin:0 auto 18px;max-width:52ch;color:var(--hm-text)}
.hm-builder__soon-cta{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}

/* grid */
.hm-builder__grid{display:grid;grid-template-columns:1fr;gap:20px;align-items:start}
.hm-builder__legend{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;font-size:13px;color:var(--hm-muted);margin:0 0 12px}
.hm-builder__legend-note{flex-basis:100%}
.hm-tag{display:inline-flex;align-items:center;gap:4px;padding:2px 9px;border-radius:999px;font-size:12px;font-weight:700;line-height:1.5;white-space:nowrap}
.hm-tag svg{width:12px;height:12px}
.hm-tag--complete{background:var(--hm-olive-soft);color:var(--hm-olive-dark)}
.hm-tag--supp{background:#FFF1E4;color:#A94A15}

/* recipe cards */
.hm-recipes{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:1fr;gap:12px}
.hm-recipe{display:grid;grid-template-columns:84px 1fr;grid-template-areas:"media body" "media ctl";gap:4px 14px;background:#fff;border:2px solid var(--hm-b-line);border-radius:18px;padding:12px;box-shadow:var(--hm-shadow);transition:border-color .2s,box-shadow .2s;position:relative}
.hm-recipe.is-picked{border-color:var(--hm-olive)}
.hm-recipe.is-oos{opacity:.7}
.hm-recipe__media{grid-area:media;position:relative;width:84px;height:84px;border-radius:14px;overflow:hidden;background:var(--hm-b-soft)}
.hm-recipe__media img{width:100%;height:100%;object-fit:cover;display:block}
.hm-recipe__ph{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:var(--hm-olive)}
.hm-recipe__ph svg{width:32px;height:32px}
.hm-recipe__count{position:absolute;top:6px;inset-inline-start:6px;min-width:26px;height:26px;padding:0 7px;border-radius:999px;background:var(--hm-olive-dark);color:#fff;font-weight:800;font-size:14px;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 6px rgba(0,0,0,.18)}
.hm-recipe__count[hidden]{display:none}
.hm-recipe__body{grid-area:body;min-width:0}
.hm-recipe__name{font-size:16px;line-height:1.3;margin:0 0 4px;font-weight:800}
.hm-recipe__name a{color:var(--hm-ink)}
.hm-recipe__name a:hover{color:var(--hm-olive-dark);text-decoration:underline}
.hm-recipe__name a:focus-visible{outline:none;box-shadow:var(--hm-b-focus);border-radius:6px}
.hm-recipe__meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:0 0 4px;font-size:13px;color:var(--hm-muted)}
.hm-recipe__protein{font-weight:600;color:var(--hm-text)}
.hm-recipe__price{margin:0;font-size:15px;color:var(--hm-ink)}
.hm-recipe__price bdi{font-weight:800;color:var(--hm-olive-dark);font-size:17px}
.hm-recipe__price span{font-size:13px;color:var(--hm-muted)}
.hm-recipe__ctl{grid-area:ctl;display:inline-flex;align-items:center;gap:6px;justify-self:start;margin-top:4px}
.hm-recipe__btn{width:44px;height:44px;border-radius:50%;border:2px solid var(--hm-olive);background:#fff;color:var(--hm-olive-dark);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0;transition:background .15s,transform .15s,opacity .15s}
.hm-recipe__btn svg{width:18px;height:18px}
.hm-recipe__btn:hover{background:var(--hm-olive-soft)}
.hm-recipe__btn:active{transform:scale(.94)}
.hm-recipe__btn:focus-visible{outline:none;box-shadow:var(--hm-b-focus)}
.hm-recipe__btn[disabled]{opacity:.35;cursor:not-allowed;transform:none;background:#fff}
.hm-recipe__btn--plus{background:var(--hm-olive-dark);border-color:var(--hm-olive-dark);color:#fff}
.hm-recipe__btn--plus:hover{background:var(--hm-olive)}
.hm-recipe__btn--plus[disabled]{background:var(--hm-olive-dark)}
.hm-recipe__qty{width:52px;height:44px;border:1px solid var(--hm-b-line);border-radius:12px;text-align:center;font:inherit;font-weight:800;font-size:18px;color:var(--hm-ink);background:#fff;-moz-appearance:textfield;appearance:textfield;direction:ltr}
.hm-recipe__qty::-webkit-outer-spin-button,.hm-recipe__qty::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.hm-recipe__qty:focus-visible{outline:none;box-shadow:var(--hm-b-focus);border-color:var(--hm-olive)}
.hm-recipe__oos{display:inline-flex;align-items:center;min-height:44px;padding:0 12px;border-radius:999px;background:var(--hm-b-soft);color:var(--hm-muted);font-size:13px;font-weight:700}
.hm-recipe.is-bump .hm-recipe__count{animation:hm-b-bump .25s ease}
@keyframes hm-b-bump{0%{transform:scale(1)}50%{transform:scale(1.25)}100%{transform:scale(1)}}

/* summary */
.hm-summary{background:#fff;border:1px solid var(--hm-b-line);border-radius:20px;padding:20px;box-shadow:var(--hm-shadow)}
.hm-summary__head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:12px}
.hm-summary__title{font-size:20px;margin:0}
.hm-summary__size{font-size:13px;color:var(--hm-muted);white-space:nowrap}
.hm-summary__count{margin:0 0 8px;font-size:15px;color:var(--hm-text)}
.hm-summary__count strong{font-size:22px;color:var(--hm-ink);font-weight:800}
.hm-summary__track{position:relative;height:12px;border-radius:999px;background:var(--hm-b-soft);overflow:hidden;border:1px solid var(--hm-b-line)}
.hm-summary__fill{position:absolute;inset:0;background:var(--hm-olive);transform-origin:right center;transition:transform .25s ease,background .25s ease}
.hm-summary.is-full .hm-summary__fill{background:var(--hm-olive-dark)}
.hm-summary.is-over .hm-summary__fill{background:var(--hm-b-err)}
.hm-summary__ticks{position:absolute;inset:0;display:flex;justify-content:space-evenly;pointer-events:none}
.hm-summary__ticks i{width:1px;background:rgba(255,255,255,.7)}
.hm-summary__hint{margin:8px 0 0;font-size:13px;color:var(--hm-muted);min-height:38px}
.hm-summary.is-full .hm-summary__hint{color:var(--hm-olive-dark);font-weight:700}
.hm-summary.is-over .hm-summary__hint{color:var(--hm-b-err);font-weight:700}
.hm-summary__list{list-style:none;margin:14px 0 0;padding:12px 0 0;border-top:1px dashed var(--hm-b-line);display:grid;gap:6px}
.hm-summary__list:empty{display:none}
.hm-summary__list li{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:8px;font-size:14px;color:var(--hm-text)}
.hm-summary__list li .n{min-width:24px;height:24px;border-radius:999px;background:var(--hm-olive-soft);color:var(--hm-olive-dark);font-weight:800;font-size:13px;display:inline-flex;align-items:center;justify-content:center;padding:0 6px}
.hm-summary__list li .p{color:var(--hm-ink);font-weight:700;white-space:nowrap}
.hm-summary__list li .t{display:inline-block;margin-inline-start:6px;font-size:11px;color:var(--hm-muted);font-weight:600}
.hm-summary__empty{margin:14px 0 0;padding:12px 0 0;border-top:1px dashed var(--hm-b-line);font-size:14px;color:var(--hm-muted)}
.hm-summary__totals{margin:14px 0 0;padding:12px 0 0;border-top:1px solid var(--hm-b-line);display:grid;gap:6px}
.hm-summary__totals div{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.hm-summary__totals dt{font-size:14px;color:var(--hm-muted);margin:0}
.hm-summary__totals dd{margin:0;font-size:15px;color:var(--hm-ink);font-weight:700}
.hm-summary__total{margin-top:4px;padding-top:8px;border-top:1px solid var(--hm-b-line)}
.hm-summary__total dt{font-size:16px;color:var(--hm-ink);font-weight:800}
.hm-summary__total dd{font-size:26px;font-weight:800;color:var(--hm-olive-dark)}
.hm-summary__msg{margin:12px 0 0;padding:10px 12px;border-radius:12px;font-size:14px;font-weight:600;background:var(--hm-b-err-soft);color:var(--hm-b-err)}
.hm-summary__msg.is-ok{background:var(--hm-olive-soft);color:var(--hm-olive-dark)}
.hm-summary__msg[hidden]{display:none}
.hm-summary__add{width:100%;margin-top:16px}
.hm-summary__add[disabled]{opacity:.5}
.hm-summary__add.is-loading .hm-btn__label{visibility:hidden}
.hm-summary__add.is-loading::after{content:"";position:absolute;width:20px;height:20px;border:3px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:hm-b-spin .7s linear infinite}
.hm-summary__add{position:relative}
@keyframes hm-b-spin{to{transform:rotate(360deg)}}
.hm-summary__help{margin:8px 0 0;font-size:13px;color:var(--hm-muted);text-align:center}
.hm-summary__save{display:grid;grid-template-columns:1fr auto;gap:8px;margin-top:14px;padding-top:14px;border-top:1px dashed var(--hm-b-line)}
.hm-summary__name{min-height:44px;border:1px solid var(--hm-b-line);border-radius:12px;padding:0 12px;font:inherit;font-size:14px;color:var(--hm-ink);background:#fff;min-width:0}
.hm-summary__name:focus-visible{outline:none;box-shadow:var(--hm-b-focus);border-color:var(--hm-olive)}
.hm-summary__save .hm-btn{min-height:44px;padding:0 14px;font-size:14px}
.hm-summary__saved{margin-top:14px;padding-top:12px;border-top:1px dashed var(--hm-b-line)}
.hm-summary__saved-title{margin:0 0 8px;font-size:13px;font-weight:700;color:var(--hm-text)}
.hm-summary__chips{display:flex;flex-wrap:wrap;gap:6px}
.hm-chip{min-height:36px;padding:0 12px;border-radius:999px;border:1px solid var(--hm-olive);background:#fff;color:var(--hm-olive-dark);font:inherit;font-size:13px;font-weight:700;cursor:pointer;transition:background .15s}
.hm-chip:hover{background:var(--hm-olive-soft)}
.hm-chip:focus-visible{outline:none;box-shadow:var(--hm-b-focus)}
.hm-chip.is-active{background:var(--hm-olive-dark);border-color:var(--hm-olive-dark);color:#fff}
.hm-summary__saved-link{display:inline-block;margin-top:8px;font-size:13px;font-weight:700}
.hm-summary__auth{margin-top:14px;padding:14px;border-radius:14px;background:var(--hm-b-soft);border:1px solid var(--hm-b-line)}
.hm-summary__auth[hidden]{display:none}
.hm-summary__auth p{margin:0 0 12px;font-size:14px;color:var(--hm-text);display:flex;gap:8px;align-items:flex-start}
.hm-summary__auth p svg{width:18px;height:18px;flex:none;color:var(--hm-olive-dark);margin-top:3px}
.hm-summary__auth-btns{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.hm-summary__auth-btns .hm-btn{min-height:44px;padding:0 12px;font-size:14px}
.hm-summary__ship{margin:12px 0 0;font-size:12px;color:var(--hm-muted);text-align:center}
.hm-page--builder .hm-btn:focus-visible{outline:none;box-shadow:var(--hm-b-focus)}
.hm-builder__foot{margin:28px 0 0;font-size:15px;color:var(--hm-text)}
.hm-builder__foot a{font-weight:700}

/* mobile sticky bar */
.hm-builder__bar{position:fixed;inset-inline:0;bottom:0;z-index:40;background:#fff;border-top:1px solid var(--hm-b-line);box-shadow:0 -6px 24px rgba(60,50,20,.08);padding:8px var(--hm-gutter) calc(10px + env(safe-area-inset-bottom));transform:translateY(100%);transition:transform .25s ease}
.hm-builder__bar.is-on{transform:translateY(0)}
.hm-builder__bar-track{height:6px;border-radius:999px;background:var(--hm-b-soft);overflow:hidden;margin-bottom:8px}
.hm-builder__bar-fill{height:100%;background:var(--hm-olive);transform-origin:right center;transition:transform .25s ease}
.hm-builder__bar.is-full .hm-builder__bar-fill{background:var(--hm-olive-dark)}
.hm-builder__bar.is-over .hm-builder__bar-fill{background:var(--hm-b-err)}
.hm-builder__bar-row{display:flex;align-items:center;gap:12px}
.hm-builder__bar-count{font-size:14px;color:var(--hm-text)}
.hm-builder__bar-count strong{font-size:18px;color:var(--hm-ink)}
.hm-builder__bar-total{margin-inline-start:auto;font-weight:800;font-size:18px;color:var(--hm-olive-dark)}
.hm-builder__bar-btn{min-height:44px;padding:0 18px;font-size:15px}
.hm-page--builder.has-bar{padding-bottom:110px}

/* saved boxes (account) */
.hm-boxes-page h2{font-size:clamp(22px,2.4vw,28px);margin:0 0 6px}
.hm-boxes-page__intro{color:var(--hm-text);margin:0 0 18px;font-size:15px}
.hm-boxes-list{display:grid;gap:14px}
.hm-boxes-empty{background:#fff;border:1px solid var(--hm-b-line);border-radius:18px;padding:32px 20px;text-align:center;box-shadow:var(--hm-shadow)}
.hm-boxes-empty__icon{display:inline-flex;width:56px;height:56px;border-radius:50%;background:var(--hm-olive-soft);color:var(--hm-olive-dark);align-items:center;justify-content:center;margin-bottom:10px}
.hm-boxes-empty__icon svg{width:26px;height:26px}
.hm-boxes-empty h3{margin:0 0 6px;font-size:20px}
.hm-boxes-empty p{margin:0 auto 16px;max-width:46ch;color:var(--hm-text)}
.hm-saved-box{background:#fff;border:1px solid var(--hm-b-line);border-radius:18px;padding:16px;box-shadow:var(--hm-shadow);transition:opacity .2s}
.hm-saved-box.is-unavailable{background:var(--hm-b-soft)}
.hm-saved-box.is-removing{opacity:.4;pointer-events:none}
.hm-saved-box__head{display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:center;margin-bottom:10px}
.hm-saved-box__icon{width:44px;height:44px;border-radius:12px;background:var(--hm-olive-soft);color:var(--hm-olive-dark);display:inline-flex;align-items:center;justify-content:center}
.hm-saved-box__icon svg{width:22px;height:22px}
.hm-saved-box__name{margin:0;font-size:18px;line-height:1.3;overflow-wrap:anywhere}
.hm-saved-box__sub{margin:0;font-size:13px;color:var(--hm-muted)}
.hm-saved-box__price{font-size:20px;font-weight:800;color:var(--hm-olive-dark);white-space:nowrap}
.hm-saved-box__items{list-style:none;margin:0 0 12px;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:4px 16px;font-size:14px;color:var(--hm-text)}
.hm-saved-box__items li{display:flex;align-items:center;gap:8px}
.hm-saved-box__items em{color:var(--hm-b-err);font-style:normal;font-weight:700}
.hm-saved-box__qty{min-width:24px;height:24px;border-radius:999px;background:var(--hm-olive-soft);color:var(--hm-olive-dark);font-weight:800;font-size:13px;display:inline-flex;align-items:center;justify-content:center;flex:none;padding:0 6px}
.hm-saved-box__warn{margin:0 0 12px;padding:8px 12px;border-radius:10px;background:#FFF6EE;border:1px solid #F1D3B8;color:#8A3E0F;font-size:13px}
.hm-saved-box__actions{display:flex;flex-wrap:wrap;gap:8px}
.hm-saved-box__actions .hm-btn{min-height:44px;padding:0 16px;font-size:14px}
.hm-saved-box__actions .hm-btn.is-loading{opacity:.6;pointer-events:none}
.hm-boxes-page__more{margin:16px 0 0}
.hm-box-msg{margin:12px 0 0;padding:10px 12px;border-radius:12px;background:var(--hm-olive-soft);color:var(--hm-olive-dark);font-size:14px;font-weight:600}
.hm-box-msg.is-error{background:var(--hm-b-err-soft);color:var(--hm-b-err)}
.hm-box-msg[hidden]{display:none}
/* cart page: edit link under the box line */
.woocommerce table.shop_table.hm-cart-table .hm-box-row .variation{display:block;font-size:13px;line-height:1.5;color:var(--hm-muted);margin-top:6px}
.woocommerce table.shop_table.hm-cart-table .hm-box-row .variation dt{font-weight:700;color:var(--hm-text)}
.woocommerce table.shop_table.hm-cart-table .hm-box-row .variation dd,.woocommerce table.shop_table.hm-cart-table .hm-box-row .variation dd p{display:inline;font-size:13px;margin:0;line-height:1.5}
.hm-box-cart-edit{display:inline-block;margin-top:4px;font-size:13px;font-weight:700;color:var(--hm-olive-dark);text-decoration:underline}
.hm-box-cart-edit:hover{color:var(--hm-olive)}
.hm-mini-item__thumb .hm-box-thumb,.product-thumbnail .hm-box-thumb{width:100%;height:100%;object-fit:cover}

/* toast (own, small) */
.hm-box-toast{position:fixed;bottom:calc(20px + env(safe-area-inset-bottom));left:50%;transform:translate(-50%,20px);z-index:130;background:var(--hm-ink);color:#fff;border-radius:999px;padding:12px 20px;font-size:14px;font-weight:600;box-shadow:var(--hm-shadow-hover);opacity:0;transition:opacity .2s,transform .2s;max-width:calc(100vw - 32px);text-align:center;pointer-events:none}
.hm-box-toast.is-on{opacity:1;transform:translate(-50%,0)}
.hm-box-toast.is-error{background:var(--hm-b-err)}

@media (min-width:700px){
  .hm-recipes{grid-template-columns:1fr 1fr}
  .hm-builder__lines{max-width:640px}
}
@media (min-width:1024px){
  .hm-builder__grid{grid-template-columns:minmax(0,1fr) 360px;gap:28px}
  .hm-builder__summary{position:sticky;top:104px}
  .hm-builder__bar{display:none}
  .hm-page--builder.has-bar{padding-bottom:40px}
  .hm-recipe{grid-template-columns:96px 1fr auto;grid-template-areas:"media body ctl";align-items:center}
  .hm-recipe__media{width:96px;height:96px}
  .hm-recipe__ctl{margin-top:0;justify-self:end}
}
@media (min-width:1240px){
  .hm-recipes{grid-template-columns:1fr}
  .hm-builder__grid{grid-template-columns:minmax(0,1fr) 380px}
}
@media (max-width:1023px){
  .hm-builder__summary{order:2}
}
@media (prefers-reduced-motion:reduce){
  .hm-builder *,.hm-boxes-page *{transition:none!important;animation:none!important}
}
