/* =====================================================================
   חוויית ההזמנה: חלונות (מנה · סל · פרטים · אישור)
   כל הערכים מ-tokens.css. מובייל קודם: פעולה ראשית בתחתית קבועה.
   ===================================================================== */

/* ===================== שכבה (bottom sheet / dialog) ===================== */
.layer { position: fixed; inset: 0; z-index: var(--z-layer); display: flex; align-items: flex-end; justify-content: center; }
.layer__backdrop { position: absolute; inset: 0; background: rgba(28, 23, 20, .62); opacity: 0; transition: opacity var(--dur) ease; }
.layer.open .layer__backdrop { opacity: 1; }
.layer__panel {
  position: relative; width: 100%; min-width: 0; max-height: calc(100% - var(--safe-t) - 24px);
  background: var(--surface-page); color: var(--text);
  border-radius: var(--r-xl) var(--r-xl) 0 0; overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform var(--dur-slow) var(--ease);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .3);
}
.layer.open .layer__panel { transform: none; }
.layer--full .layer__panel { height: calc(100% - var(--safe-t) - 12px); max-height: none; }
.layer__grab { position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: rgba(60, 35, 20, .25); z-index: 4; }
.layer__scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }
.layer__foot {
  flex: none; padding: 12px var(--pad-sheet) calc(12px + var(--safe-b));
  background: var(--surface); box-shadow: 0 -1px 0 var(--border), 0 -12px 24px -16px rgba(60, 35, 20, .3);
  display: flex; gap: 12px; align-items: center;
}
.layer__head { display: flex; align-items: center; gap: 12px; padding: 8px var(--pad-sheet) 4px; }
.layer__title { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; flex: 1; }
.layer__title:focus, .cartv__title:focus, .pd__name:focus, #done-title:focus { outline: none; }
.icon-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; display: grid; place-items: center; flex: none;
  background: var(--surface-sunk); color: var(--text); -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast);
}
.icon-btn:hover { background: var(--border); }
.icon-btn .ic { width: 20px; height: 20px; }

@media (min-width: 760px) {
  .layer { align-items: center; padding: 24px; }
  .layer__panel { max-width: var(--sheet-max); border-radius: var(--r-xl); max-height: min(90vh, 900px); transform: translateY(24px) scale(.98); opacity: 0; transition: transform var(--dur) var(--ease), opacity var(--dur); }
  .layer.open .layer__panel { opacity: 1; }
  .layer--full .layer__panel { height: min(92vh, 940px); }
  .layer__grab { display: none; }
}

/* ---- סרגל עליון בחלון: התקדמות (+ סגירה בחלון מנה). נשאר גלוי בגלילה ---- */
.sheet-bar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 12px;
  padding: 16px var(--pad-sheet) 10px; background: var(--surface-page);
  box-shadow: 0 1px 0 var(--border);
}
.sheet-bar--plain { position: static; box-shadow: none; padding-bottom: 2px; }
.steps { flex: 1; min-width: 0; display: grid; gap: 6px; }
.steps__bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.steps__bar i { height: 4px; border-radius: 2px; background: var(--border); }
.steps__bar i.is-done { background: var(--text-2); }
.steps__bar i.is-cur { background: var(--accent); }
.steps__t { font-size: var(--fs-xs); color: var(--text-2); }
.steps__t b { color: var(--text); font-weight: 800; }

/* ===================== חלון מנה ===================== */
.pd__media { position: relative; height: 140px; display: grid; place-items: center; overflow: hidden; flex: none; }
.pd__media--photo { height: auto; aspect-ratio: 4 / 3; max-height: 46vh; max-height: 46svh; width: 100%; background: var(--coal-2); }
.pd__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pd__media > .ic { position: relative; z-index: 1; width: 64px; height: 64px; stroke-width: 1.2; margin-bottom: 14px; }
.pd__intro { padding: 20px var(--pad-sheet) 8px; display: grid; gap: 8px; }
.pd__name { font-family: var(--f-display); font-weight: 400; font-size: 2rem; line-height: 1.1; }
.pd__desc { color: var(--text-2); line-height: 1.55; }
.pd__base { font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* קבוצת בחירה: fieldset + legend אמיתיים */
.og { border: 0; margin: 0; padding: 22px var(--pad-sheet) 6px; min-width: 0; }
.og + .og { border-top: 1px solid var(--border); }
/* legend "צף" כדי שיתנהג כבלוק רגיל בתוך הקבוצה (ולא יישב על הגבול העליון) */
.og__legend { padding: 0; margin: 0 0 12px; width: 100%; float: right; }
.og .opts { clear: both; }
.og__title { display: block; font-weight: 800; font-size: var(--fs-l); line-height: var(--lh-tight); }
.og__rule { display: block; margin-top: 2px; font-size: var(--fs-s); color: var(--text-2); }
.og--upsell { background: rgba(217, 130, 43, .12); }
.og.missing .opts { box-shadow: 0 0 0 2px var(--danger); }
.og__err { display: flex; gap: 4px; margin-top: 10px; color: var(--danger-text); font-weight: 700; font-size: var(--fs-s); }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* אפשרויות כשורות מלאות: סימן · שם · מחיר */
.opts { display: grid; border: 1px solid var(--border); border-radius: var(--r-l); background: var(--surface); overflow: hidden; }
.opt { position: relative; }
.opt + .opt { border-top: 1px solid var(--border); }
.opt__in { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.opt__row {
  display: flex; align-items: center; gap: 12px; min-height: var(--control-h); padding: 10px 16px;
  cursor: pointer; user-select: none; transition: background-color var(--dur-fast);
}
.opt__row:hover { background: var(--surface-page); }
.opt__mark {
  flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; transition: background-color var(--dur-fast), border-color var(--dur-fast);
}
.opt--multi .opt__mark { border-radius: 6px; }
.opt__label { flex: 1; min-width: 0; font-weight: 500; }
.opt__price { flex: none; font-size: var(--fs-s); font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.opt__in:checked + .opt__row { background: var(--surface-page); }
.opt__in:checked + .opt__row .opt__label { font-weight: 800; }
.opt__in:checked + .opt__row .opt__mark { border-color: var(--selected); background: var(--selected); }
.opt__in:checked + .opt__row .opt__mark::after { content: ""; width: 10px; height: 6px; border: 2.5px solid var(--on-selected); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.opt__in:focus-visible + .opt__row { box-shadow: inset var(--focus-ring); }
.opt__in:disabled + .opt__row { color: var(--disabled-text); background: var(--disabled-bg); cursor: not-allowed; }

.pd__notes { padding: 22px var(--pad-sheet) 28px; border-top: 1px solid var(--border); }

/* ===================== שדות ===================== */
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .lbl { font-weight: 700; font-size: var(--fs-s); }
.field .req { color: var(--accent); }
.opt-tag { font-weight: 500; color: var(--text-2); font-size: var(--fs-xs); }
.input, .textarea, .select {
  width: 100%; min-height: var(--control-h); padding: 12px 14px; border-radius: var(--r-m);
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 1rem;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.input--ltr { text-align: right; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(217, 130, 43, .45); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { box-shadow: var(--focus-ring); }
.input[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.ferr { display: flex; gap: 4px; color: var(--danger-text); font-size: var(--fs-s); font-weight: 700; }
.fhint { color: var(--text-2); font-size: var(--fs-xs); }
.fhint a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--text); font-weight: 700; text-underline-offset: 3px; }

/* ===================== כמות + כפתור ראשי ===================== */
.qty { display: inline-flex; align-items: center; border-radius: var(--r-pill); background: var(--surface-sunk); flex: none; }
.qty button { width: var(--tap); height: var(--tap-l); border: 0; background: transparent; display: grid; place-items: center; color: var(--text); border-radius: var(--r-pill); }
.qty button:hover:not(:disabled) { background: var(--border); }
.qty button:disabled { color: var(--text-3); cursor: not-allowed; }
.qty button .ic { width: 18px; height: 18px; }
.qty output { min-width: 28px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.qty--s button { height: var(--tap); }

.cta-add { flex: 1; min-width: 0; min-height: var(--tap-l); border-radius: var(--r-l); justify-content: space-between; padding: 0 20px; font-size: var(--fs-m); white-space: normal; text-align: start; gap: 12px; }
.cta-add > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.cta-add__price { font-variant-numeric: tabular-nums; padding-inline-start: 12px; border-inline-start: 1px solid currentColor; }
.cta-add.shake { animation: shake .4s; }
.btn.is-blocked, .cta-add.is-blocked { background: var(--disabled-bg); color: var(--disabled-text); box-shadow: none; }
.btn.is-blocked .cta-add__price { border-color: var(--border-strong); }
@media (max-width: 360px) {
  .cta-add { padding: 0 12px; font-size: var(--fs-s); }
  .layer__foot .qty button { width: 40px; }
}

/* ===================== סל ===================== */
.cartv { display: flex; flex-direction: column; min-height: 100%; }
.cartv__head { display: flex; align-items: center; gap: 10px; padding: 8px var(--pad-sheet) 6px; }
.cart-aside .cartv__head { padding-top: 18px; }
.cartv__title { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; flex: 1; }
.cartv__list { list-style: none; margin: 0; padding: 0 var(--pad-sheet); }
.ci { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.ci__name { font-weight: 800; font-size: var(--fs-l); line-height: var(--lh-tight); }
.ci__price { font-weight: 800; font-variant-numeric: tabular-nums; text-align: left; }
.ci__opts { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; color: var(--text-2); font-size: var(--fs-s); line-height: 1.5; }
.ci__opts b { font-weight: 700; color: var(--text); }
.ci__note { grid-column: 1 / -1; font-size: var(--fs-s); color: var(--text-2); }
.ci__row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; }
.ci__row .spacer { flex: 1; }
.ci.is-out .ci__name, .ci.is-out .ci__opts { text-decoration: line-through; text-decoration-color: var(--text-2); }
.ci__out { grid-column: 1 / -1; display: flex; gap: 4px; color: var(--danger-text); font-weight: 700; font-size: var(--fs-s); }
.ci__out::before { content: "⚠"; }
.link-btn {
  border: 0; background: transparent; color: var(--text); font-weight: 700; font-size: var(--fs-s);
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-s);
  text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 4px;
}
.link-btn:hover { background: var(--surface-sunk); }
.link-btn .ic { width: 18px; height: 18px; }
.link-btn--danger { color: var(--danger-text); }

.upsell { padding: 16px var(--pad-sheet) 4px; display: grid; gap: 8px; }
.upsell__title { font-weight: 800; font-size: var(--fs-s); color: var(--text-2); }
.upsell__row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.upsell__row::-webkit-scrollbar { display: none; }
.upchip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 16px 0 12px;
  border-radius: var(--r-pill); border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 700; font-size: var(--fs-s);
}
.upchip:hover { background: var(--surface-sunk); }
.upchip .ic { width: 18px; height: 18px; color: var(--accent); }

.cartv__note { padding: 16px var(--pad-sheet) 4px; }
.totals { padding: 16px var(--pad-sheet); display: grid; gap: 8px; font-variant-numeric: tabular-nums; margin: 0; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals dt, .totals dd { margin: 0; }
.totals .muted { color: var(--text-2); }
.totals .grand { font-weight: 800; font-size: var(--fs-l); padding-top: 10px; border-top: 1.5px solid var(--text); margin-top: 4px; }
.price-note { margin: 0 var(--pad-sheet) 12px; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface-sunk); color: var(--text-2); font-size: var(--fs-s); display: flex; gap: 8px; align-items: flex-start; }
.price-note .ic { width: 18px; height: 18px; color: var(--text-2); margin-top: 2px; flex: none; }
.cartv__cta { padding: 12px var(--pad-sheet) var(--pad-sheet); margin-top: auto; }
.cartv__closed { margin: 0 var(--pad-sheet) 12px; }
/* עמודת הסל בדסקטופ: הכפתור דבוק לתחתית העמודה */
.cart-aside .cartv__cta { position: sticky; bottom: 0; background: var(--surface); box-shadow: 0 -1px 0 var(--border); }

.empty { text-align: center; padding: 40px 24px; display: grid; justify-items: center; gap: 10px; }
.empty__art { width: 76px; height: 76px; border-radius: 50%; background: var(--surface-sunk); display: grid; place-items: center; color: var(--text-2); }
.empty__art .ic { width: 36px; height: 36px; }
.empty h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.empty p { color: var(--text-2); max-width: 28ch; }

/* ===================== פרטים ואישור ===================== */
.co-view { display: flex; flex-direction: column; }
.co { padding: 8px var(--pad-sheet) 28px; display: grid; gap: 28px; }
.co__sec { display: grid; gap: 14px; }
.co__fs { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 12px; }
.co__h { font-weight: 800; font-size: var(--fs-l); line-height: var(--lh-tight); padding: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg__opt { position: relative; }
.seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg__opt label {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap-l); border-radius: var(--r-m);
  border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 800; cursor: pointer; text-align: center; padding: 6px 10px;
}
.seg__opt label .ic { width: 22px; height: 22px; flex: none; }
.seg__opt input:checked + label { border-color: var(--selected); background: var(--selected); color: var(--on-selected); }
.seg__opt input:focus-visible + label { box-shadow: var(--focus-ring); }
.seg__opt input:disabled + label { background: var(--disabled-bg); color: var(--disabled-text); border-color: var(--disabled-bg); cursor: not-allowed; }
.grid2, .grid3, .grid-addr { display: grid; gap: 12px; }
.grid2 { grid-template-columns: 1fr; }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-addr { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid2 > *, .grid3 > *, .grid-addr > * { min-width: 0; }

/* פרטים מקופלים (לא חובה) */
.more { border: 1px solid var(--border); border-radius: var(--r-m); background: var(--surface); }
.more > summary {
  list-style: none; cursor: pointer; min-height: var(--tap-l); display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 700; border-radius: var(--r-m);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+"; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunk); font-weight: 800; flex: none; }
.more[open] > summary::before { content: "−"; }
.more > summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.more__body { display: grid; gap: 12px; padding: 4px 16px 16px; }

.pay { display: grid; gap: 10px; }
.pay__opt { position: relative; }
.pay__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pay__opt label {
  display: grid; grid-template-columns: 22px 24px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px;
  border-radius: var(--r-m); border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer;
}
.pay__mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; }
.pay__opt input:checked + label { border-color: var(--selected); box-shadow: inset 0 0 0 1px var(--selected); }
.pay__opt input:checked + label .pay__mark { border-color: var(--selected); }
.pay__opt input:checked + label .pay__mark::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--selected); }
.pay__opt label b { display: block; }
.pay__opt label small { color: var(--text-2); display: block; font-size: var(--fs-xs); }
.pay__opt input:focus-visible + label { box-shadow: var(--focus-ring); }
.pay__opt input:disabled + label { background: var(--disabled-bg); color: var(--disabled-text); border-color: var(--disabled-bg); cursor: not-allowed; }
.pay__opt input:disabled + label small { color: var(--disabled-text); }
.soon { font-size: var(--fs-2xs); font-weight: 800; background: var(--surface); color: var(--text); padding: 3px 8px; border-radius: var(--r-pill); }

.notice { padding: 12px 14px; border-radius: var(--r-m); background: var(--surface-sunk); color: var(--text); font-size: var(--fs-s); display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
.notice .ic { width: 20px; height: 20px; color: var(--text-2); flex: none; margin-top: 1px; }
.notice--warn { background: var(--warn-soft); color: var(--danger-text); }
.notice--warn .ic { color: var(--danger-text); }
.notice--ok { background: var(--ok-soft); color: var(--ok-text); }
.notice--ok .ic { color: var(--ok-text); }
.notice b { color: inherit; }
.co__status { display: grid; gap: 10px; }
.consent { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-m); border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 700; font-size: var(--fs-s); }
.consent input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--sumac); }
.consent.is-err { border: 2px solid var(--danger); }
.form-err { padding: 12px 14px; border-radius: var(--r-m); background: var(--warn-soft); color: var(--danger-text); font-weight: 700; font-size: var(--fs-s); border-inline-start: 4px solid var(--danger); }

/* סיכום לפני שליחה */
.rv { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l); padding: 16px 0 4px; gap: 4px; }
.rv__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px; }
.rv .totals { padding: 12px 16px 16px; }
.rv-items { list-style: none; margin: 0; padding: 0 16px; }
.rv-items li { padding: 12px 0; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.rv-items__top { display: flex; justify-content: space-between; gap: 12px; }
.rv-items__name { font-weight: 800; }
.rv-items__price { font-weight: 800; font-variant-numeric: tabular-nums; }
.rv-items__opts { color: var(--text-2); font-size: var(--fs-s); line-height: 1.5; }
.rv-dl { margin: 0; padding: 4px 16px 16px; display: grid; gap: 10px; }
.rv-dl div { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 12px; }
.rv-dl dt { color: var(--text-2); font-size: var(--fs-s); }
.rv-dl dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.rv + .fhint { margin-top: -18px; }

/* מסך "ההזמנה התקבלה" */
.done { position: relative; padding: 36px var(--pad-sheet) 24px; display: grid; gap: 16px; justify-items: center; text-align: center; }
.done__close { position: absolute; top: 14px; left: 14px; }
.done__ic { width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; animation: pop .5s var(--ease); }
.done__ic .ic { width: 36px; height: 36px; stroke-width: 2.4; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.done h3 { font-family: var(--f-display); font-weight: 400; font-size: 2rem; line-height: 1.1; }
.done p { color: var(--text-2); max-width: 36ch; }
.done .num { font-weight: 800; color: var(--text); }

/* תמונה מוגדלת (תעודת כשרות / המקום) */
.layer--photo .layer__panel { background: var(--coal); max-width: 900px; }
.lightbox { margin: 0; position: relative; display: grid; gap: 8px; padding: 0 0 14px; color: var(--cream); }
.lightbox img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; background: var(--coal); }
.lightbox figcaption { padding: 0 var(--gutter); font-size: var(--fs-s); }
.lightbox__close { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(251, 247, 240, .94); }

/* מסכים נמוכים / טקסט מוגדל: הסרגל העליון לא נדבק, כדי להשאיר מקום לתוכן */
@media (max-height: 560px) {
  .sheet-bar { position: static; }
  .pd__media--photo { max-height: 60vh; }
}

/* v14 — סיכום מקופל בסיום ההזמנה + "לזכור פרטים" */
.co-sum > summary { justify-content: flex-start; }
.co-sum > summary > span:first-child { flex: 1; }
.co-sum__total { font-weight: 800; color: var(--price); font-variant-numeric: tabular-nums; }
.consent--soft { border: 1px solid var(--border); background: var(--surface-sunk); font-weight: 600; }
.cta-add__price { opacity: .95; }
