:root {
  --bg: #fdf7ee;
  --card: #ffffff;
  --ink: #23201c;
  --muted: #7a7166;
  --line: #efe5d6;
  --brand: #f39200;
  --brand-dark: #d97e00;
  --brand-soft: #fff0d9;
  --teal: #179c93;
  --teal-soft: #ddf3f1;
  --night: #23201c;
  --ok: #15803d;
  --ok-soft: #e2f5e8;
  --warn: #b45309;
  --warn-soft: #fff1d6;
  --bad: #c62828;
  --bad-soft: #fde7e7;
  --blue: #0b5cad;
  --blue-soft: #e3f1ff;
  --radius: 16px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Heebo', 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
a { color: var(--teal); }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.logo { font-weight: 800; letter-spacing: .5px; }
.logo span:nth-child(5n+1) { color: #f39200; } .logo span:nth-child(5n+2) { color: #179c93; } .logo span:nth-child(5n+3) { color: #e5007e; }
.logo span:nth-child(5n+4) { color: #2f6fd1; } .logo span:nth-child(5n) { color: #8cc63f; }

/* ---------- כניסה ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #fff3df 0%, #e3f6f3 100%); }
.login-card { background: var(--card); border-radius: 24px; padding: 32px 26px; width: 100%; max-width: 360px; text-align: center; box-shadow: 0 18px 50px rgba(80,60,20,.15); }
.login h1 { margin: 4px 0 0; font-size: 34px; }
.login-error { color: var(--bad); background: var(--bad-soft); padding: 10px; border-radius: 10px; font-size: 14px; margin: 14px 0 0; }
.name-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 50vh; overflow-y: auto; }
.name-btn { padding: 14px 8px; border-radius: 12px; border: 1px solid var(--line); background: #fffaf2; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.link-btn { background: none; border: 0; color: var(--teal); font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand); }
.pin-dots span.on { background: var(--brand); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; direction: ltr; }
.pin-pad button { height: 58px; border-radius: 14px; border: 0; background: #fbf1e2; font: inherit; font-size: 24px; font-weight: 600; cursor: pointer; color: var(--ink); }

/* ---------- מבנה ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 10px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: var(--brand-soft); color: var(--ink); border: 0; border-radius: 10px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; }
.user-chip { font-size: 12px; background: var(--teal-soft); color: var(--teal); padding: 4px 10px; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.env-banner { background: #fff3c4; color: #6b5200; text-align: center; font-size: 12px; padding: 4px 8px; }
.view { padding: 14px 14px calc(var(--nav-h) + 24px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
.nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 10; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); height: calc(var(--nav-h) + var(--safe-b)); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500; }
.nav a .ico { font-size: 21px; filter: grayscale(.7); }
.nav a.active { color: var(--brand-dark); font-weight: 700; }
.nav a.active .ico { filter: none; }

/* ---------- כרטיסים ורשימות ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(80,60,20,.06); border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: inherit; }
.item .grow { flex: 1; min-width: 0; }
.item b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-box { width: 50px; flex-shrink: 0; text-align: center; background: var(--brand-soft); border-radius: 12px; padding: 6px 2px; }
.date-box b { display: block; font-size: 15px; color: var(--brand-dark); }
.date-box span { font-size: 11px; color: var(--muted); }
.date-box.none { background: #f3eee6; }
.empty { color: var(--muted); text-align: center; padding: 14px 0; margin: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #f1ebe1; color: var(--ink); white-space: nowrap; }
.badge.new { background: #ffe0f0; color: #b0005f; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.closing { background: var(--blue-soft); color: var(--blue); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 22px; color: var(--brand-dark); }
.stat span { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs a { white-space: nowrap; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; flex: 1; }
details.fold > summary::after { content: '⌄'; color: var(--muted); font-size: 18px; }
details.fold[open] > summary { margin-bottom: 10px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; font-weight: 500; white-space: pre-wrap; word-break: break-word; }
.note-box { background: #fffaf2; border: 1px solid var(--line); border-radius: 12px; padding: 10px; white-space: pre-wrap; font-size: 14px; max-height: 260px; overflow-y: auto; }
.hist { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.hist:last-child { border-bottom: 0; }

/* ---------- טפסים וכפתורים ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 11px 12px; border-radius: 12px; border: 1px solid #e2d6c4; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 11px 16px; font: inherit; font-weight: 700; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none; }
.btn:active { background: var(--brand-dark); }
.btn.secondary { background: var(--teal); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.wa { background: #25d366; }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--teal); color: #fff; border-color: var(--teal); }
.q-item { display: grid; grid-template-columns: 52px 1fr 92px 32px; gap: 6px; align-items: center; margin-bottom: 6px; }
.q-item input { padding: 9px 8px; }
.q-total { text-align: left; font-size: 14px; margin-top: 8px; }
.q-total b { font-size: 17px; }

/* ---------- טעינה והודעות ---------- */
.busy { position: fixed; inset: 0; z-index: 50; background: rgba(253,247,238,.82); display: grid; place-content: center; text-align: center; gap: 10px; }
.spinner { width: 34px; height: 34px; margin: 18px auto; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 60; bottom: calc(var(--nav-h) + 16px + var(--safe-b)); inset-inline: 16px; margin: auto; max-width: 480px; background: var(--night); color: #fff; padding: 12px 16px; border-radius: 14px; text-align: center; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }

/* ---------- דפים ציבוריים (טופס פנייה, פרטים מהלקוח) ---------- */
.pub { min-height: 100vh; background: linear-gradient(160deg, #fff3df 0%, #e3f6f3 100%); padding: 24px 14px 40px; }
.pub-card { background: #fff; border-radius: 24px; padding: 24px 20px; max-width: 520px; margin: 0 auto; box-shadow: 0 18px 50px rgba(80,60,20,.12); }
.pub-head { text-align: center; margin-bottom: 8px; }
.pub-head .logo { font-size: 34px; }
.pub-head p { margin: 4px 0 0; color: var(--muted); }
.req::after { content: ' *'; color: var(--bad); }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.done { text-align: center; padding: 20px 0; }
.done .big { font-size: 52px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- בחירת שירים (לקוח) ---------- */
.songs-page { padding-bottom: 110px; }
.songs-page .pub-card { max-width: 640px; }
.sp-cat { border: 1px solid var(--line); border-radius: 14px; margin-top: 10px; background: #fffdf9; }
.sp-cat > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; }
.sp-cat > summary::-webkit-details-marker { display: none; }
.sp-cat[open] > summary { border-bottom: 1px solid var(--line); }
.sp-picked { color: var(--brand-dark); }
.sp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; }
@media (max-width: 420px) { .sp-grid { grid-template-columns: 1fr; } }
.sp-song { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 500; font-size: 14px; cursor: pointer; }
.sp-song input { width: auto; margin: 0; accent-color: var(--brand); }
.sp-song.on { background: var(--brand-soft); border-color: var(--brand); }
.sp-bar { position: fixed; bottom: 0; inset-inline: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(80,60,20,.08); z-index: 5; }
.sp-bar .btn { min-width: 120px; }
