/* קופה — עיצוב משותף לעמדת המכירה ולניהול */

:root {
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1c2430;
  --muted: #667085;
  --line: #e4e0d7;
  --line-strong: #cdc6b8;

  --brand: #16324f;
  --primary: #13784a;
  --primary-hover: #0f633d;
  --primary-soft: #e2f2e9;
  --warn: #9a5b00;
  --warn-soft: #fff1d1;
  --danger: #b42318;
  --danger-soft: #fde7e5;
  --info-soft: #e6eef7;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(28, 36, 48, .06), 0 2px 10px rgba(28, 36, 48, .05);
  --shadow-lg: 0 16px 48px rgba(16, 24, 40, .22);
  --topbar-h: 62px;
  --font: "Segoe UI", "Rubik", "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.num { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.mono-inline { direction: ltr; unicode-bidi: isolate; text-align: right; }
.boot { display: grid; place-items: center; min-height: 70vh; padding: 24px; color: var(--muted); text-align: center; }
.logo { display: inline-grid; }
.logo svg { width: 100%; height: 100%; display: block; }

:focus-visible { outline: 3px solid #5b9bd5; outline-offset: 2px; }

/* ---------- כפתורים ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .06s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-2); border-color: #b9b1a1; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(28, 36, 48, .05); }
.btn.danger-text { color: var(--danger); }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 13.5px; }
.btn.big { min-height: 54px; font-size: 17px; padding: 0 22px; border-radius: 11px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; border: 0; background: transparent; border-radius: 50%;
  cursor: pointer; font-size: 17px; color: var(--muted); display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { background: rgba(28, 36, 48, .07); color: var(--ink); }

/* ---------- טפסים ---------- */

input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #5b9bd5; box-shadow: 0 0 0 3px rgba(91, 155, 213, .25); }
input::placeholder { color: #9aa1ad; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field > span { font-weight: 650; font-size: 14px; }
.field small { color: var(--muted); font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.check input { width: 19px; height: 19px; accent-color: var(--primary); margin: 0; }
.check.big { min-height: 44px; margin-top: 25px; font-weight: 650; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- סרגל עליון ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  min-height: var(--topbar-h); padding-block: 9px; padding-inline: 16px;
  background: var(--brand); color: #fff;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; white-space: nowrap; }
.brand .logo { width: 30px; height: 30px; }
.brand-sub { font-weight: 500; opacity: .65; font-size: 15px; }
.spacer { flex: 1; }

.tabs { display: flex; gap: 3px; background: rgba(255, 255, 255, .09); padding: 4px; border-radius: 11px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 15px;
  border: 0; border-radius: 8px; background: transparent; color: rgba(255, 255, 255, .82);
  font-weight: 650; cursor: pointer; text-decoration: none;
}
.tab:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.tab.active { background: #fff; color: var(--brand); }
.tab-count { background: rgba(22, 50, 79, .12); border-radius: 999px; padding: 0 7px; font-size: 12px; min-width: 22px; text-align: center; }
.tab:not(.active) .tab-count { background: rgba(255, 255, 255, .16); }

.sale-switch {
  display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: 280px;
  border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06); color: #fff;
  border-radius: 9px; padding: 3px 12px 4px; cursor: pointer; line-height: 1.25; text-align: right;
}
.sale-switch:hover { background: rgba(255, 255, 255, .12); }
.sale-switch small { opacity: .65; font-size: 11px; }
.sale-switch strong { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale-switch strong::after { content: " ▾"; opacity: .6; font-weight: 400; }

.user-btn {
  border: 0; background: rgba(255, 255, 255, .1); color: #fff; border-radius: 999px;
  padding: 0 14px; min-height: 36px; cursor: pointer; font-weight: 650;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-btn:hover { background: rgba(255, 255, 255, .18); }
.topbar .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }
.topbar .btn.ghost:hover { background: rgba(255, 255, 255, .1); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px;
  border: 0; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff;
  font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa5b1; flex: none; }
.pill.ok .dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .22); }
.pill.warn .dot { background: #fbbf24; }
.pill.warn { background: rgba(251, 191, 36, .16); }
.pill.off .dot, .pill.err .dot { background: #f87171; }
.pill.off, .pill.err { background: rgba(248, 113, 113, .2); }
.pill.spinning .dot { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- כניסה ---------- */

.login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding-block: 24px; padding-inline: 16px;
  background: radial-gradient(120% 70% at 50% 0%, #24507a 0%, var(--brand) 62%);
}
.card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 30px 26px 26px; }
.login-card { width: 100%; max-width: 390px; }
.login-mark { display: grid; place-items: center; }
.login-mark .logo { width: 60px; height: 60px; }
.login-card h1 { margin: 12px 0 4px; font-size: 27px; text-align: center; }
.login-sub { text-align: center; margin: 0 0 22px; }
.login-card .note { margin: 0 0 16px; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; font-weight: 600; }

/* ---------- מסך מכירה ---------- */

.sell { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; padding: 16px; align-items: start; }
.catalog { min-width: 0; }
.catalog-bar { position: sticky; top: var(--topbar-h); z-index: 5; background: var(--bg); padding: 0 0 12px; margin-top: -4px; padding-top: 4px; }
.search {
  min-height: 50px !important; font-size: 16px; padding-right: 44px !important;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='m14 14 4 4'/%3E%3C/svg%3E") no-repeat right 14px center !important;
  border-radius: 12px !important;
}

.catalog-bar .search-row, .catalog-bar { display: flex; gap: 10px; align-items: center; }
.catalog-bar .search { flex: 1 1 auto; min-width: 0; }
.size-ctl {
  display: flex; align-items: center; flex: none; height: 50px; overflow: hidden;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 12px;
}
.size-btn { width: 46px; height: 100%; border: 0; background: transparent; color: var(--ink); font-size: 24px; font-weight: 700; line-height: 1; cursor: pointer; }
.size-btn:hover:not(:disabled) { background: var(--surface-2); }
.size-btn:disabled { color: #c9c2b4; cursor: default; }
.size-label { font-size: 13px; font-weight: 650; color: var(--muted); padding: 0 2px; user-select: none; }

.grid { --tile-min: 158px; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr)); gap: 12px; }
.grid.size-sm { --tile-min: 118px; gap: 8px; }
.grid.size-lg { --tile-min: 230px; gap: 14px; }
.grid.size-xl { --tile-min: 320px; gap: 16px; }
.grid.size-sm .tile-body { padding: 6px 8px 8px; gap: 3px; }
.grid.size-sm .tile-name { font-size: 13.5px; }
.grid.size-sm .tile-price { font-size: 14px; }
.grid.size-sm .tile-sku { font-size: 11px; }
.grid.size-lg .tile-name { font-size: 18px; }
.grid.size-lg .tile-price { font-size: 20px; }
.grid.size-lg .tile-sku { font-size: 14px; }
.grid.size-xl .tile-body { padding: 12px 14px 14px; }
.grid.size-xl .tile-name { font-size: 22px; }
.grid.size-xl .tile-price { font-size: 26px; }
.grid.size-xl .tile-sku { font-size: 16px; }
.grid.size-lg .tile-badge, .grid.size-xl .tile-badge { min-width: 44px; height: 44px; font-size: 21px; }
.grid.size-lg .tile-minus, .grid.size-xl .tile-minus { width: 44px; height: 44px; font-size: 28px; }

.tile-img { position: relative; }
.tile-pre {
  position: absolute; bottom: 6px; right: 6px; padding: 2px 8px; border-radius: 999px;
  background: #6d3fc0; color: #fff; font-size: 11.5px; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.tile.is-preorder:not(.in-cart) { border-color: #d9ccf2; }
.tile.is-unsynced .tile-img::after {
  content: "ממתין לשליחה"; position: absolute; top: 6px; right: 50%; transform: translateX(50%);
  background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
}
.tile-edit {
  position: absolute; bottom: 6px; left: 6px; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .96); box-shadow: 0 1px 6px rgba(0, 0, 0, .25); font-size: 16px; cursor: pointer;
  display: grid; place-items: center;
}
.tile-edit:hover { background: #fff; }
.add-product-btn { height: 50px; flex: none; }
.sale-card.new-sale {
  justify-content: center; align-items: center; text-align: center; min-height: 92px;
  border: 2px dashed var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: none;
}
.sale-card.new-sale strong { font-size: 18px; }
.tile {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 2px solid transparent; border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; overflow: hidden; user-select: none;
  -webkit-tap-highlight-color: transparent; transition: transform .08s, border-color .15s, box-shadow .15s;
}
.tile:hover { box-shadow: 0 4px 18px rgba(28, 36, 48, .12); }
.tile:active { transform: scale(.97); }
.tile.in-cart { border-color: var(--primary); }
.tile.bump { animation: bump .22s ease-out; }
@keyframes bump { 45% { transform: scale(.95); } }
.tile-img { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.tile-img img { width: 100%; height: 100%; object-fit: contain; }
.tile-ph { font-size: 46px; font-weight: 800; color: #cfc7b7; }
.tile-body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.tile-name { font-weight: 700; font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-top: auto; }
.tile-sku { font-size: 12px; color: var(--muted); direction: ltr; unicode-bidi: isolate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tile-price { font-weight: 800; font-size: 16px; color: var(--primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile-badge {
  position: absolute; top: 8px; right: 8px; min-width: 36px; height: 36px; padding: 0 9px;
  border-radius: 999px; background: var(--primary); color: #fff; font-weight: 800; font-size: 17px;
  display: none; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
}
.tile-minus {
  position: absolute; top: 8px; left: 8px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .96); color: var(--ink); font-size: 24px; font-weight: 700; line-height: 1;
  display: none; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.tile.in-cart .tile-badge, .tile.in-cart .tile-minus { display: grid; }

/* ---------- סל ---------- */

.cart {
  position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: calc(100vh - var(--topbar-h) - 32px); max-height: calc(100dvh - var(--topbar-h) - 32px);
}
.cart-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.cart-head h2 { margin: 0; font-size: 19px; flex: 1; }
.editing-banner { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--warn-soft); color: #6b4200; padding: 8px 16px; font-size: 13.5px; }
.cart-lines { overflow-y: auto; flex: 1 1 auto; min-height: 110px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto 78px; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.line-name { font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.line-sub { font-size: 12.5px; color: var(--muted); }
.line-total { text-align: left; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qty { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: #fff; }
.qty button { width: 38px; height: 40px; border: 0; background: var(--surface-2); font-size: 21px; font-weight: 700; cursor: pointer; line-height: 1; }
.qty button:hover { background: #efe9dd; }
.qty input {
  width: 50px !important; min-height: 40px !important; border: 0 !important; border-radius: 0 !important;
  padding: 0 !important; text-align: center; font-weight: 750; box-shadow: none !important; -moz-appearance: textfield;
}
.qty input::-webkit-inner-spin-button, .qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cart-empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.cart-empty-icon { font-size: 34px; opacity: .45; margin-bottom: 6px; }
.cart-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.cart-sum { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.cart-total { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cart-bar, .cart-overlay, .mobile-only { display: none; }

/* ---------- בחירת מכירה ---------- */

.picker { max-width: 780px; margin: 0 auto; padding-block: 36px; padding-inline: 16px; }
.picker h1 { font-size: 26px; margin: 0 0 18px; }
.sale-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.sale-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-align: right;
  padding: 18px; border: 2px solid transparent; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
}
.sale-card strong { font-size: 18px; }
.sale-card:hover { border-color: var(--primary); }
.sale-card.current { border-color: var(--primary); background: var(--primary-soft); }
.modal .sale-cards { grid-template-columns: 1fr; }
.modal .sale-card { box-shadow: none; border-color: var(--line); }

.empty-state { text-align: center; padding: 42px 20px; color: var(--muted); background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--line-strong); grid-column: 1 / -1; }
.empty-state p { margin: 0 0 12px; }
.empty-state p:first-child { color: var(--ink); font-size: 17px; font-weight: 650; }
.empty-inline { padding: 26px 16px; text-align: center; color: var(--muted); }
.empty-inline.big { padding: 44px 16px; }
.empty-inline p { margin: 0 0 12px; color: var(--ink); font-weight: 650; }

/* ---------- קבלה ---------- */

.receipt { display: flex; flex-direction: column; gap: 12px; }
.receipt-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.receipt-lines { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.receipt-lines th { text-align: right; font-size: 12px; color: var(--muted); font-weight: 650; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.receipt-lines th.num { text-align: left; }
.receipt-lines td { padding: 8px 6px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.r-name { font-weight: 600; }
.r-qty { font-weight: 750; }
.receipt-total { display: flex; justify-content: space-between; align-items: baseline; }
.receipt-total strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.receipt.is-cancelled .receipt-lines td, .receipt.is-cancelled .receipt-total strong { text-decoration: line-through; color: var(--muted); }
.saved-mark { display: flex; align-items: center; gap: 12px; background: var(--primary-soft); color: var(--primary); font-weight: 750; font-size: 18px; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.saved-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 21px; flex: none; }

.note { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; margin: 12px 0 0; }
.note.warn { background: var(--warn-soft); color: #6b4200; }
.note.error { background: var(--danger-soft); color: var(--danger); }
.note.info { background: var(--info-soft); color: var(--brand); }

.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #ebe8e1; color: #505866; white-space: nowrap; vertical-align: middle; }
.chip + .chip { margin-inline-start: 4px; }
.chip.open { background: var(--primary-soft); color: var(--primary); }
.chip.closed { background: #ebe8e1; color: #6b7280; }
.chip.cancel { background: var(--danger-soft); color: var(--danger); }
.chip.pending { background: var(--warn-soft); color: var(--warn); }
.chip.error { background: var(--danger); color: #fff; }
.chip.admin { background: var(--info-soft); color: var(--brand); }

/* ---------- קניות בעמדה ---------- */

.pv { max-width: 1040px; margin: 0 auto; padding: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 15px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi strong { font-size: 23px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi.warn strong { color: var(--warn); }
.pv-tools { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.plist { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.plist .more { border-radius: 0; min-height: 50px; }
.prow {
  display: grid; grid-template-columns: 54px 58px minmax(0, 1fr) 120px 96px auto; align-items: center; gap: 12px;
  padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: right; cursor: pointer; width: 100%;
}
.prow:hover { background: var(--surface-2); }
.prow-seq { font-weight: 800; color: var(--muted); }
.prow-time { font-weight: 750; font-variant-numeric: tabular-nums; }
.prow-items { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-seller { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-total { font-weight: 800; text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prow-flags { display: flex; gap: 4px; justify-content: flex-end; }
.prow.is-cancelled .prow-items, .prow.is-cancelled .prow-total { text-decoration: line-through; color: var(--muted); }

.info { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0 0 16px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; font-weight: 650; }

/* ---------- חלונות ---------- */

dialog.modal {
  border: 0; padding: 0; border-radius: 18px; width: min(500px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
  box-shadow: var(--shadow-lg); color: var(--ink); background: var(--surface); overflow: hidden;
}
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(15, 23, 32, .5); }
.modal-head { display: flex; align-items: center; gap: 8px; padding-block: 12px 10px; padding-inline: 20px 10px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 19px; flex: 1; }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1 1 auto; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-actions .push { margin-inline-start: auto; }
.confirm-text { margin: 0; font-size: 16px; }

.toasts {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 650; text-align: center; animation: toast-in .2s ease; }
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- ניהול ---------- */

.page { max-width: 1200px; margin: 0 auto; padding-block: 20px 64px; padding-inline: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 27px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .count { font-size: 18px; font-weight: 500; }
.page-sub { margin: 4px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-actions input[type=search] { width: 250px; }
.crumbs { font-size: 14px; margin-bottom: 8px; }
.crumbs a { text-decoration: none; font-weight: 650; }
.loading { padding: 44px; text-align: center; color: var(--muted); grid-column: 1 / -1; }

.section { margin-top: 26px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2 { margin: 0; font-size: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input { width: 250px; }
.filters select { width: auto; min-width: 140px; }

.table-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.table-wrap.flat { box-shadow: none; border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: right; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.num { text-align: left; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #fbfaf6; }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); border-top: 2px solid var(--line-strong); border-bottom: 0; }
.tbl tr.is-inactive td { color: var(--muted); }
.tbl tr.is-inactive .thumb { opacity: .5; }
.tbl tr.is-cancelled td { color: var(--muted); }
.tbl tr.is-cancelled .items-cell, .tbl tr.is-cancelled .total-cell { text-decoration: line-through; }
.thumb { width: 46px; height: 46px; border-radius: 9px; object-fit: contain; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; }
.thumb-ph { font-weight: 800; color: #bdb4a3; }
.thumb-cell { width: 64px; }
.items-cell { min-width: 220px; max-width: 420px; }
.more-row { padding: 12px; text-align: center; border-top: 1px solid var(--line); }

.sale-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.scard {
  display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none;
  border-top: 4px solid #d5cebf; transition: box-shadow .15s, transform .15s;
}
.scard:hover { box-shadow: 0 6px 22px rgba(28, 36, 48, .13); transform: translateY(-1px); }
.scard.is-open { border-top-color: var(--primary); }
.scard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.scard-name { font-size: 18px; }
.scard-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.subtabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 2px 0 18px; overflow-x: auto; }
.subtab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; margin-bottom: -2px;
  border-bottom: 3px solid transparent; color: var(--muted); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.subtab:hover { color: var(--ink); }
.subtab.active { color: var(--brand); border-bottom-color: var(--primary); }
.subtab-count { background: #ebe8e1; color: #505866; border-radius: 999px; padding: 0 8px; font-size: 12px; }
.subtab.active .subtab-count { background: var(--primary-soft); color: var(--primary); }
.subtabs + div > .section:first-child { margin-top: 0; }
.section-note { margin: -4px 0 10px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 8px; }
.pick-list { border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 46vh; overflow-y: auto; margin-bottom: 10px; }
.pick-row {
  display: grid; grid-template-columns: auto 46px 52px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 7px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input { width: 19px; height: 19px; accent-color: var(--primary); margin: 0; }
.pick-sku { font-weight: 700; }
.access-box { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); margin-bottom: 12px; }
.access-title { font-weight: 750; }
.access-list { max-height: 34vh; margin: 0; background: #fff; }
.access-list.is-disabled { opacity: .45; }
.access-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.access-row.is-inactive { color: var(--muted); }
.access-cell { max-width: 320px; }
.pick-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard-nums div { display: flex; flex-direction: column; }
.scard-nums b { font-size: 23px; font-variant-numeric: tabular-nums; }

.product-form { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; }
.img-drop { aspect-ratio: 1 / 1; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; overflow: hidden; }
.img-drop:hover, .img-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.img-preview { width: 100%; height: 100%; display: grid; place-items: center; }
.img-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.img-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; padding: 12px; text-align: center; }
.img-empty-icon { font-size: 34px; }
.pf-image-actions { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.edit-lines { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 10px 0 12px; overflow: hidden; }
.edit-lines .line:last-child { border-bottom: 0; }
.edit-sum { margin: 14px 0 0; }

/* ---------- מסכים צרים ---------- */

@media (max-width: 900px) {
  .sell { grid-template-columns: 1fr; padding-block: 12px 96px; padding-inline: 12px; }
  .grid { --tile-min: 112px; gap: 10px; }
  .grid.size-sm { --tile-min: 92px; gap: 6px; }
  .grid.size-lg { --tile-min: 160px; }
  .grid.size-xl { --tile-min: 260px; }
  .size-ctl { height: 50px; }
  .size-label { display: none; }
  .size-btn { width: 42px; }

  .cart {
    position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: 40;
    max-height: 90vh; max-height: 90dvh; border-radius: 20px 20px 0 0;
    transform: translateY(105%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  body.cart-open .cart { transform: none; }
  body.cart-open { overflow: hidden; }
  body.cart-open .cart-overlay { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 32, .45); }
  .cart-foot { border-radius: 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .mobile-only { display: inline-grid; }

  .cart-bar {
    display: flex; position: fixed; right: 12px; left: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 25;
    align-items: center; gap: 10px; min-height: 60px; padding: 0 16px; border: 0; border-radius: 15px;
    background: #3b4552; color: #fff; font-weight: 750; font-size: 16px; box-shadow: var(--shadow-lg); cursor: pointer;
  }
  .cart-bar.has-items { background: var(--primary); }
  .cart-bar-label { flex: 1; text-align: right; }
  .cart-bar strong { font-size: 19px; font-variant-numeric: tabular-nums; }
  .cart-bar-count { background: rgba(255, 255, 255, .22); border-radius: 999px; min-width: 32px; height: 32px; display: grid; place-items: center; padding: 0 8px; }
}

@media (max-width: 700px) {
  .topbar { position: static; gap: 8px; }
  .catalog-bar { top: 0; }
  .topbar .tabs { order: 10; width: 100%; }
  .topbar .tabs .tab { flex: 1; justify-content: center; }
  .pos .spacer { display: none; }
  .pos .brand-name { display: none; }
  .pos .sale-switch { flex: 1; max-width: none; }
  .pill-text { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .user-btn { max-width: 110px; }

  .page-head h1 { font-size: 23px; }
  .page-actions, .filters { width: 100%; }
  .page-actions input[type=search], .filters input { width: 100%; }
  .filters select { flex: 1; }

  .prow { grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "seq time flags total" "items items items items" "seller seller seller seller"; gap: 3px 10px; }
  .prow-seq { grid-area: seq; }
  .prow-time { grid-area: time; }
  .prow-total { grid-area: total; }
  .prow-flags { grid-area: flags; }
  .prow-items { grid-area: items; white-space: normal; }
  .prow-seller { grid-area: seller; font-size: 13px; }

  .product-form { grid-template-columns: 1fr; }
  .img-drop { max-width: 220px; margin: 0 auto; }
}

@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  .check.big { margin-top: 0; }
  dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 94dvh; }
  .modal-actions { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal-actions .btn { flex: 1 1 auto; }
  .modal-actions .push { margin-inline-start: 0; }
  .line { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info total" "qty qty"; }
  .line-info { grid-area: info; }
  .line-total { grid-area: total; }
  .line .qty { grid-area: qty; justify-self: start; }
  .receipt-total strong { font-size: 24px; }
  .kpi strong { font-size: 20px; }
}

/* ---------- הזמנות מראש ---------- */

.chip.preorder { background: #efe8fb; color: #5b2fb0; margin-inline-start: 6px; }
.chip.pickup { background: var(--warn-soft); color: var(--warn); }
.chip.picked { background: var(--primary-soft); color: var(--primary); }
.note.ok { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.block { display: block; }

.customer-box { background: #f6f2fd; border: 1px solid #e0d5f5; border-radius: var(--radius-sm); padding: 12px 14px 0; margin-bottom: 14px; }
.customer-title { font-weight: 750; margin-bottom: 8px; color: #4b2596; }
.customer-box input { background: #fff; }
.cart-pre-note { font-size: 13px; color: #5b2fb0; background: #efe8fb; border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
.option-box { align-items: flex-start; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.option-box input { margin-top: 2px; }
a.phone { color: var(--brand); font-weight: 650; text-decoration: none; unicode-bidi: isolate; white-space: nowrap; }
a.phone:hover { text-decoration: underline; }

.seg-group { display: inline-flex; background: #ebe8e1; border-radius: 10px; padding: 3px; gap: 2px; }
.seg { border: 0; background: transparent; padding: 0 14px; min-height: 36px; border-radius: 8px; font-weight: 650; color: #505866; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg-count { background: var(--warn); color: #fff; border-radius: 999px; font-size: 11.5px; padding: 0 7px; min-width: 20px; text-align: center; }
.pv-search { flex: 1 1 220px; width: auto !important; min-width: 180px; }
.pv-tools { justify-content: flex-start; }
.prow-customer { color: var(--ink); }
.subtab-count.warn { background: var(--warn-soft); color: var(--warn); }

.pick-head input[type=search] { flex: 1; width: auto; min-width: 140px; min-height: 38px; }
.add-box { position: relative; margin-bottom: 4px; }
.add-results { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 6px; overflow: hidden; }
.add-results:empty { display: none; }
.add-result { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: right; cursor: pointer; }
.add-result:last-child { border-bottom: 0; }
.add-result:hover, .add-result:focus-visible { background: var(--primary-soft); }
.add-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-empty { padding: 10px 12px; }

.pre-table .pickup-cell { white-space: nowrap; }
.tbl tr.is-picked td { color: var(--muted); }
.big-num { font-size: 18px; font-weight: 800; }

.print-only { display: none; }
.print-box { width: 18px; height: 18px; border: 1.5px solid #333; border-radius: 3px; vertical-align: middle; }

@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .topbar, .modal-actions, .cart-bar, .crumbs, .subtabs, .page-actions, .no-print, .toasts, dialog { display: none !important; }
  .print-only { display: block !important; }
  .print-box.print-only { display: inline-block !important; }
  .print-title { font-size: 13px; color: #444; margin-bottom: 8px; }
  .page { max-width: none; padding: 0; }
  .page-head { margin-bottom: 6px; }
  .page-head h1 { font-size: 20px; }
  .kpis { grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
  .kpi { box-shadow: none; border: 1px solid #ccc; padding: 6px 8px; }
  .kpi strong { font-size: 16px; }
  .table-wrap { box-shadow: none; border: 1px solid #bbb; overflow: visible; }
  .tbl { font-size: 11.5px; }
  .tbl th, .tbl td { padding: 5px 7px; }
  .tbl tr { break-inside: avoid; }
  .section { margin-top: 12px; }
  .section-head { margin-bottom: 4px; }
  .section-head h2 { font-size: 15px; }
  .chip { border: 1px solid #999; background: none !important; color: #000 !important; }
  a.phone { color: #000; }
}
