/* מסך ההמרה */
body { min-height: 100vh; display: flex; flex-direction: column; }
.small { font-size: 14px; }
.center { text-align: center; }
.error { color: #A3243F; font-weight: 700; min-height: 1.6em; }
.btn-sm { min-height: 44px; font-size: 16px; padding: 0 16px; border-radius: 10px; }
.btn-ghost { background: #fff; color: var(--ink); border: 2px dashed var(--line-strong); }
.btn-ghost.danger { color: #A3243F; border-color: #E5B3BE; }
.soon-pill { background: var(--ink); color: #fff; font-size: 12px; padding: 2px 8px; }

.app-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 18px; font-size: 15px; font-weight: 600; color: var(--soft); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); display: flex; align-items: center; justify-content: center; font-size: 13px; }
.steps li.current { color: var(--accent); }
.steps li.current .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps li.complete { color: var(--ok); }
.steps li.complete .dot { background: var(--ok-soft); border-color: var(--ok-soft); }
.file-name { font-size: 15px; color: var(--muted); }

.stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.upload-box { background: #fff; border: 2px dashed var(--line-strong); border-radius: 24px; padding: 56px 40px; max-width: 640px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.upload-box.drag { border-color: var(--accent); background: var(--accent-soft); }
.upload-box h1 { font-size: 34px; }
.spinner { width: 48px; height: 48px; border: 5px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.review { flex: 1; display: flex; flex-wrap: wrap; min-height: 0; }
.panel { flex: 1 1 320px; max-width: 380px; background: #fff; border-left: 1px solid var(--line); padding: 26px; display: flex; flex-direction: column; gap: 24px; }
.panel-title { font-size: 26px; }
.field { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.field legend, .field > label { font-weight: 700; font-size: 16px; padding: 0; margin-bottom: 4px; }
.field input, .field select, .edit-dialog input { font: 16px var(--body); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; min-height: 44px; background: #fff; color: var(--ink); width: 100%; }
.format-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.format-btn { font-family: inherit; min-height: 62px; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.format-btn strong { font-size: 17px; }
.format-btn span { font-size: 13px; }
.format-btn[aria-pressed="true"] { border: 2px solid var(--accent); background: #EEEAFF; color: var(--accent-dark); }
.warn-box { background: var(--warn-soft); color: var(--gold-ink); border-radius: 12px; padding: 12px 14px; font-size: 15px; }

.workspace { flex: 999 1 560px; min-width: 0; padding: 24px 32px; display: flex; flex-direction: column; gap: 16px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.tab { font: 700 16px var(--body); background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px; cursor: pointer; color: var(--muted); min-height: 44px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; font-weight: 700; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.sheet-viewport { display: flex; justify-content: center; overflow: hidden; }
.sheet-scale { transform-origin: top center; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: 14px; border: 1px solid var(--line); }
table.guests { border-collapse: collapse; width: 100%; font-size: 15px; }
.guests th { background: var(--bg); text-align: right; padding: 10px 8px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.guests td { border-top: 1px solid var(--line); padding: 4px; }
.guests td input { font: 15px var(--body); border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; width: 100%; min-width: 80px; background: transparent; }
.guests td input:focus { border-color: var(--accent); background: #fff; outline: none; }
.guests tr.missing { background: var(--warn-soft); }

.actionbar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; background: #fff; border-top: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.edit-dialog { border: 0; border-radius: 20px; padding: 28px; width: min(480px, 92vw); }
.edit-dialog::backdrop { background: rgba(28,26,43,.45); }
.edit-dialog form { display: flex; flex-direction: column; gap: 12px; }
.edit-dialog label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 15px; }
.edit-dialog .two { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.edit-dialog h2 { font-size: 26px; }

.field-title { font-weight: 700; font-size: 16px; }

/* סימן מים בשוליים התחתונים של דף המדבקות — מחוץ למדבקות */
.watermark { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 1.5mm; font-size: 7pt; color: #4E4B63; opacity: .55; pointer-events: none; }
.watermark img { height: min(4.2mm, 60%); width: auto; }

/* פתיח וסיום במסך ההעלאה */
#stage-upload { flex-direction: column; gap: 20px; }
.pre-titles { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 24px 26px; max-width: 640px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.pre-titles h2 { font-size: 22px; }
.pre-titles .type-grid { grid-template-columns: 90px minmax(0, 1.3fr) minmax(0, 1fr); }

/* התאמת מידות לדף של המשתמש */
.measure { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; margin-top: 4px; }
.measure[open] { padding-bottom: 14px; }
.measure summary { cursor: pointer; font-weight: 700; font-size: 15px; color: var(--accent); min-height: 40px; display: flex; align-items: center; }
.measure > * + * { margin-top: 10px; }
.measure-svg { width: 100%; max-width: 280px; display: block; margin-inline: auto; }
.measure-grid { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 8px 10px; align-items: center; font-size: 14px; line-height: 1.35; }
.measure-grid input { font: 15px var(--body); padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; min-height: 38px; width: 100%; }
.mk { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 12px; align-items: center; justify-content: center; margin-inline-end: 4px; }
.mk.a { background: #B45309; } .mk.c { background: var(--ok); } .mk.d { background: var(--accent); }
.measure-bottom.bad { color: #A3243F; font-weight: 700; }
.measure .tip { font-size: 13.5px; background: var(--gold-soft); color: var(--gold-ink); border-radius: 8px; padding: 8px 10px; margin-bottom: 0; line-height: 1.45; }

/* ---- אנימציית סיום: כוסות שמפניה → כוכבים → V ---- */
.celebrate { width: 220px; height: 165px; overflow: visible; }
.celebrate .glass-bowl { fill: rgba(255,255,255,.35); stroke: #8A6D1E; stroke-width: 2; stroke-linejoin: round; }
.celebrate .glass-liquid { fill: var(--gold); }
.celebrate .glass-bubble { fill: #fff; opacity: .9; }
.celebrate .glass-stem { stroke: #8A6D1E; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.celebrate .glass { transform-box: fill-box; transform-origin: 50% 100%; }
.celebrate .glass-l { transform: translateX(-20px) rotate(-10deg); }
.celebrate .glass-r { transform: translateX(20px) rotate(10deg); }
.celebrate .spark { fill: var(--accent); opacity: 0; transform-box: fill-box; transform-origin: center; }
.celebrate .gold { fill: var(--gold); }
.celebrate .check-ring { fill: none; stroke: var(--ok); stroke-width: 6; stroke-dasharray: 252; stroke-dashoffset: 252; transform: rotate(-90deg); transform-origin: 100px 78px; }
.celebrate .check-mark { fill: none; stroke: var(--ok); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 62; stroke-dashoffset: 62; }
.celebrate .check { transform-origin: 100px 78px; }
.celebrate .twinkle { fill: var(--accent); opacity: 0; transform-box: fill-box; transform-origin: center; }

.celebrate.play .glass-l { animation: cel-clink-l 2.4s cubic-bezier(.3,.7,.4,1) both; }
.celebrate.play .glass-r { animation: cel-clink-r 2.4s cubic-bezier(.3,.7,.4,1) both; }
.celebrate.play .glass-bubble { animation: cel-bubble 1s ease-in .2s 2 both; }
.celebrate.play .glass-bubble.b2 { animation-delay: .5s; }
.celebrate.play .spark { animation: cel-spark 1s ease-out calc(.75s + var(--d)) both; }
.celebrate.play .check-ring { animation: cel-draw .6s ease-out 1.55s both; }
.celebrate.play .check-mark { animation: cel-draw .4s ease-out 2s both; }
.celebrate.play .check { animation: cel-pop .45s cubic-bezier(.3,1.6,.5,1) 2.3s both; }
.celebrate.play .twinkle { animation: cel-twinkle 2.2s ease-in-out var(--d) infinite; }

@keyframes cel-clink-l {
  0%   { transform: translateX(-20px) rotate(-10deg); opacity: 1; }
  30%  { transform: translateX(2px) rotate(16deg); }
  36%  { transform: translateX(-3px) rotate(12deg); }
  55%  { transform: translateX(-1px) rotate(14deg); opacity: 1; }
  68%  { transform: translateX(10px) translateY(-6px) rotate(20deg) scale(.6); opacity: 0; }
  100% { transform: translateX(10px) rotate(20deg) scale(.6); opacity: 0; }
}
@keyframes cel-clink-r {
  0%   { transform: translateX(20px) rotate(10deg); opacity: 1; }
  30%  { transform: translateX(-2px) rotate(-16deg); }
  36%  { transform: translateX(3px) rotate(-12deg); }
  55%  { transform: translateX(1px) rotate(-14deg); opacity: 1; }
  68%  { transform: translateX(-10px) translateY(-6px) rotate(-20deg) scale(.6); opacity: 0; }
  100% { transform: translateX(-10px) rotate(-20deg) scale(.6); opacity: 0; }
}
@keyframes cel-bubble { from { transform: translateY(0); opacity: .9; } to { transform: translateY(-14px); opacity: 0; } }
@keyframes cel-spark {
  0%   { transform: translate(0,0) scale(.2) rotate(0deg); opacity: 0; }
  15%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.9) rotate(90deg); opacity: 0; }
}
@keyframes cel-draw { to { stroke-dashoffset: 0; } }
@keyframes cel-pop { 0% { transform: scale(1); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes cel-twinkle { 0%, 100% { transform: scale(.3) rotate(0deg); opacity: 0; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }

/* מי שביקש פחות תנועה — רואה מיד את ה-V, בלי כוסות וכוכבים מעופפים */
@media (prefers-reduced-motion: reduce) {
  .celebrate .glasses, .celebrate .burst, .celebrate .twinkles { display: none; }
  .celebrate .check-ring, .celebrate .check-mark { stroke-dashoffset: 0; animation: none !important; }
  .celebrate.play .check { animation: none; }
}
.kavod-note { margin: 0; font-size: 14px; background: var(--accent-soft); color: var(--accent-dark); border-radius: 8px; padding: 8px 10px; line-height: 1.45; }
.stage-updates { display: flex; justify-content: center; padding: 0 16px 48px; }
.stage-updates .updates-form { margin-top: 0; width: 100%; max-width: 640px; border: 1px solid var(--line); }
#stage-done { flex: 0 0 auto; }

/* הבהרה שמדבקות ניתנות לעריכה */
.edit-hint { display: flex; gap: 12px; align-items: flex-start; background: var(--accent-soft); color: var(--accent-dark); border-radius: 12px; padding: 12px 16px; font-size: 16px; line-height: 1.5; }
.edit-hint .icon { margin-top: 2px; }
/* (מיקום המדבקה: absolute — מוגדר ב-.label; משמש גם כבסיס לתגית "לחצו לעריכה") */
.sheet-viewport .label::after { content: 'לחצו לעריכה'; position: absolute; top: 2mm; left: 2mm; background: var(--accent); color: #fff; font: 700 9pt var(--body); padding: 1mm 3mm; border-radius: 999px; opacity: 0; transition: opacity .15s; pointer-events: none; }
.sheet-viewport .label:hover::after, .sheet-viewport .label:focus-visible::after { opacity: 1; }
.sheet-viewport .label:focus-visible { outline: 2px solid var(--accent); }

/* חלון עריכה */
.edit-dialog .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.edit-preview { border: 2px dashed var(--line-strong); border-radius: 12px; padding: 14px 18px; display: flex; flex-direction: column; line-height: 1.45; font-size: 16px; background: #fff; min-height: 84px; justify-content: center; }
.edit-preview .l1 { font-weight: 700; }
.edit-preview.ltr { direction: ltr; text-align: left; }
.edit-preview.center { text-align: center; align-items: center; }
.chip-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.chip-pick button { font: 600 14px var(--body); background: #fff; border: 1px solid #D6D3E3; border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; color: var(--ink); }
.chip-pick button:hover { border-color: var(--accent); color: var(--accent-dark); }
.chip-pick button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.edit-dialog { max-height: 92vh; overflow-y: auto; }
.type-grid { display: grid; grid-template-columns: 74px minmax(0, 1.3fr) minmax(0, 1fr); gap: 6px; align-items: center; }
.type-grid .th { font-size: 13px; font-weight: 700; color: var(--muted); }
.type-grid .tname { font-size: 15px; font-weight: 700; line-height: 1.2; }
.type-grid .tname small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.type-grid input { font: 15px var(--body); padding: 8px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 400 !important; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.guests td select, .edit-dialog select { font: 15px var(--body); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px; background: #fff; min-height: 40px; }
.align-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.align-grid .format-btn { min-height: 84px; gap: 2px; padding: 8px; text-align: center; line-height: 1.25; }
.sheet .label.center { align-items: center; text-align: center; } /* גובר גם על .label.ltr */
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.file-list li { display: flex; justify-content: space-between; gap: 8px; background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.file-list li.failed { background: #FBE9EC; color: #A3243F; }
.file-list .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guests tr.dup { background: #FDE8D7; }
.guests td.src { font-size: 13px; color: var(--muted); white-space: nowrap; padding: 4px 8px; }
.dup-badge { display: inline-block; font-size: 12px; font-weight: 700; background: #C2410C; color: #fff; border-radius: 999px; padding: 1px 8px; margin-inline-start: 6px; }

/* ---- דפי מדבקות בגודל אמיתי ---- */
/* מוסתר במסך בלי ליצור גלילה אופקית (left שלילי בעמוד RTL יצר רוחב עמוד של 11,000px) */
.print-area { position: fixed; top: 0; left: 0; width: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
.sheet { position: relative; width: 210mm; height: 296.5mm; background: #fff; overflow: hidden; direction: rtl; font-family: var(--body); color: #000; }
.sheet + .sheet { page-break-before: always; break-before: page; }
.label { position: absolute; box-sizing: border-box; padding: 2mm 4mm; display: flex; flex-direction: column; justify-content: center; line-height: 1.35; overflow: hidden; font-size: 10.5pt; cursor: pointer; }
.label .l1 { font-weight: 700; }
.label.ltr { direction: ltr; text-align: left; }
.sheet-viewport .label { outline: 1px dashed #D6D3E3; outline-offset: -1mm; }
.sheet-viewport .label:hover { background: #F5F2FF; }
.sheet-viewport .label.missing { background: var(--warn-soft); outline: 1.5px solid var(--warn-line); }
.sheet-viewport .label.dup { background: #FDE8D7; outline: 1.5px solid #C2410C; }
.sheet-viewport .label.unclear { background: #F1ECFF; outline: 1.5px dashed #6D4FD8; }
.guests tr.unclear { background: #F1ECFF; }

/* מקרא צבעים מעל הדף */
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .lg-missing { background: var(--warn-soft); border: 1.5px solid var(--warn-line); }
.legend .lg-dup { background: #FDE8D7; border: 1.5px solid #C2410C; }
.legend .lg-unclear { background: #F1ECFF; border: 1.5px dashed #6D4FD8; }
.sheet-viewport .sheet { box-shadow: 0 20px 40px -20px rgba(28,26,43,.35); }

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; display: block; }
  .no-print, dialog { display: none !important; }
  .print-area { position: static; width: auto; height: auto; overflow: visible; visibility: visible; }
  .label { outline: none !important; background: none !important; }
}
@media (max-width: 760px) {
  .panel { max-width: none; border-left: 0; border-bottom: 1px solid var(--line); }
  .workspace { padding: 16px; }
}

/* כל התיבה לחיצה — פותחת את חלון בחירת הקבצים */
#dropZone { cursor: pointer; }
