:root {
  --bg: #f5f3ee; --panel: #fff; --ink: #1f2a2e; --muted: #6a767b; --line: #e3dfd6;
  --accent: #1f6f5c; --accent-ink: #fff; --soft: #e8f2ef; --warn: #c9861a; --bad: #b8443a;
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink); font: 15px/1.5 "Segoe UI", "Heebo", Arial, sans-serif; min-height: 100vh;
  /* כתמי צבע רכים ברקע, כדי שאפקט הזכוכית של הסרגל העליון ייראה */
  background:
    radial-gradient(600px 300px at 88% -60px, rgba(31, 111, 92, .22), transparent 70%),
    radial-gradient(520px 280px at 8% -80px, rgba(31, 45, 71, .16), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--accent); background: var(--panel); color: var(--accent); border-radius: 8px; padding: 6px 14px; }
button:hover { background: var(--soft); }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.primary:disabled { opacity: .4; cursor: not-allowed; }
button.ghost { border-color: var(--line); color: var(--muted); }
button.danger { border-color: var(--bad); color: var(--bad); }
button.danger:hover { background: #fbe9e6; }
button.primary.danger { background: var(--bad); color: #fff; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tag.bad { background: #fbe9e6; color: var(--bad); margin: 0; }
.note { margin: 0; padding: 10px 12px; background: #fdf1d8; color: #6b4700; border-radius: 8px; font-size: 14px; }
select, input[type=search] { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); }
/* חץ משלנו לתיבת הבחירה, במרחק קבוע מהקצה */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-inline: 12px 36px;
  background: var(--panel) no-repeat left 12px center / 12px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%236a767b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.500 5 5 5-5'/%3E%3C/svg%3E");
}
small { display: block; color: var(--muted); font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.empty, .hint { color: var(--muted); }
.empty { padding: 24px; text-align: center; }
.tag { font-style: normal; font-size: 12px; background: #fdf1d8; color: #8a5a00; border-radius: 99px; padding: 1px 8px; margin-inline-start: 8px; }

/* סרגל עליון צף בסגנון זכוכית: שקוף למחצה, מטשטש את מה שנגלל מתחתיו */
.top {
  position: sticky; top: 10px; z-index: 5; margin: 10px 16px 0; padding: 10px 20px; border-radius: 18px;
  display: flex; flex-wrap: wrap; gap: 10px 12px; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .42));
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 10px 30px -12px rgba(31, 45, 71, .28), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.brand { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.logo { height: 46px; width: auto; display: block; }
.demo { font-style: normal; font-size: 12px; background: #fdf1d8; color: #8a5a00; border-radius: 99px; padding: 2px 10px; }
.top-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.user { color: var(--muted); font-size: 13px; }
body.demo-mode .live-only, body:not(.demo-mode) .demo-only { display: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; padding: 18px 24px 6px; max-width: 1200px; margin: 0 auto; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.stats b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 4px; padding: 12px 24px 0; max-width: 1200px; margin: 0 auto; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 14px; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; }
.tabs button svg { width: 17px; height: 17px; flex: none; pointer-events: none; }
.act.mini { padding: 5px 10px; font-size: 13px; gap: 5px; }
.act.mini svg { width: 15px; height: 15px; }

main { max-width: 1200px; margin: 0 auto; padding: 18px 24px 60px; }
#q, .tab-search { width: 100%; font-size: 17px; padding: 12px 14px; }
.tab-search { margin-bottom: 14px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.card header { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 16px; background: #faf8f4; border-bottom: 1px solid var(--line); }
.card header span { color: var(--muted); }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.row + .row { border-top: 1px solid var(--line); }
.row span { display: block; color: var(--muted); font-size: 14px; }
.qty { text-align: center; font-size: 20px; font-weight: 700; min-width: 54px; line-height: 1.1; }
.qty small { font-weight: 400; font-size: 11px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
#tours h3 { margin: 16px 0 6px; font-size: 14px; color: var(--muted); }
#tours h3:first-child { margin-top: 0; }
.tour { display: flex; width: 100%; align-items: center; gap: 12px; text-align: start; border-color: var(--line); color: var(--ink); margin-bottom: 6px; padding: 8px 12px; }
.tour.on { border-color: var(--accent); background: var(--soft); }
.time { font-weight: 700; font-variant-numeric: tabular-nums; }
.cap { position: relative; width: 92px; height: 22px; background: #eeeae2; border-radius: 6px; overflow: hidden; flex: none; }
.cap i { position: absolute; inset-block: 0; inset-inline-start: 0; background: #bfdcd3; }
.cap.warn i { background: #f0d49b; } .cap.full i { background: #e9b3ad; }
.cap em { position: relative; display: block; text-align: center; font-style: normal; font-size: 12px; line-height: 22px; font-variant-numeric: tabular-nums; }

#roster { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; position: sticky; top: 96px; max-height: calc(100vh - 108px); overflow: auto; }
.roster-head { display: flex; flex-direction: column; }
.roster-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.act { display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; border: 0; color: #fff; font-weight: 600; padding: 9px 8px; }
.act svg { width: 18px; height: 18px; flex: none; pointer-events: none; }
.act.wa { background: #1fa855; } .act.wa:hover { background: #178a45; }
.act.xl { background: #1d6f42; } .act.xl:hover { background: #165633; }
.act.pr { background: #3f5661; } .act.pr:hover { background: #31444d; }
.act.rf { background: #2b6cb0; padding-inline: 14px; } .act.rf:hover { background: #22578f; }
.act.lo { background: #5b6770; padding-inline: 14px; } .act.lo:hover { background: #48525a; }
.act.mv { background: var(--accent); padding-inline: 14px; } .act.mv:hover { background: #17574a; }
.act.cx { background: var(--bad); padding-inline: 14px; } .act.cx:hover { background: #99362e; }
.roster-head h2 { margin: 0; font-size: 18px; } .roster-head p { margin: 2px 0; color: var(--muted); }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
/* יישור לימין גם לתאים בכיוון שמאל-לימין, כמו מספרי טלפון */
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
#log { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; overflow-x: auto; }

.overlay { position: fixed; inset: 0; background: rgba(20, 30, 30, .45); display: grid; place-items: center; padding: 16px; z-index: 10; }
.overlay[hidden], .toast[hidden], .login[hidden] { display: none; }
.modal { background: var(--panel); border-radius: 14px; padding: 20px; width: min(620px, 100%); max-height: 92vh; display: flex; flex-direction: column; gap: 12px; }
.modal h2 { margin: 0; font-size: 19px; } .modal .from { margin: 0; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.check { display: flex; gap: 6px; align-items: center; }
#m-search { width: 100%; }
.options { overflow: auto; border: 1px solid var(--line); border-radius: 10px; min-height: 120px; }
.opt { display: flex; gap: 10px; align-items: center; padding: 9px 12px; cursor: pointer; }
.opt + .opt { border-top: 1px solid var(--line); }
.opt.on { background: var(--soft); } .opt.off { opacity: .45; cursor: not-allowed; }
.opt em { font-style: normal; font-size: 13px; color: var(--accent); white-space: nowrap; } .opt.off em { color: var(--bad); }
.modal footer { display: flex; justify-content: flex-start; flex-direction: row-reverse; gap: 8px; }

.login { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; padding: 16px; z-index: 30; }
.login-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { margin: 0; font-size: 20px; color: var(--accent); }
.login-box p { margin: 0; color: var(--muted); }
.login-box input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 16px; }
.login-box button { padding: 10px 14px; }
.login-msg { min-height: 1.5em; color: var(--ink) !important; }

/* כפתור שנראה כמו קישור, וקלט מספרי בחלון */
button.link, button.link:hover { border: 0; background: none; box-shadow: none; padding: 0 6px; color: var(--accent); text-decoration: underline; font-size: 13px; transform: none; }
.modal input[type=number] { width: 120px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; background: var(--panel); font-size: 18px; text-align: center; }

/* הרשאות */
body.role-moked .admin-only { display: none; }
.staff-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.staff-form input { flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--panel); font-size: 16px; }
#staff { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; overflow-x: auto; }
#staff td, #roster td { vertical-align: middle; }

.credit {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; width: fit-content; max-width: calc(100% - 32px);
  margin: 12px auto 64px; padding: 9px 22px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 13px;
  animation: credit-float 5s ease-in-out infinite; text-decoration: none; cursor: pointer; transition: box-shadow .15s, border-color .15s;
}
.credit:hover { border-color: #6fcf3c; box-shadow: 0 10px 24px -12px rgba(60, 140, 40, .7); }
.credit:focus-visible { outline: 3px solid rgba(111, 207, 60, .6); outline-offset: 3px; }
/* תנועה עדינה בסרגל הקרדיט: ריחוף, פס אור שחולף, כוכב מסתובב ושם בגרדיאנט נע */
.credit::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-130%);
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .9) 50%, transparent 65%);
  animation: credit-sweep 4.500s ease-in-out infinite;
}
.credit b {
  font-weight: 700; color: transparent; background: linear-gradient(90deg, #1c4a1f, #6fcf3c, #1c4a1f, #6fcf3c, #1c4a1f) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; animation: credit-shift 4s linear infinite;
}
.spark { display: inline-block; color: #6fcf3c; font-size: 15px; line-height: 1; animation: credit-spin 7s linear infinite, credit-pulse 2.200s ease-in-out infinite; }
@keyframes credit-float { 50% { translate: 0 -4px; } }
@keyframes credit-sweep { 0%, 55% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
@keyframes credit-shift { to { background-position: -200% 0; } }
@keyframes credit-spin { to { rotate: 360deg; } }
@keyframes credit-pulse { 50% { scale: 1.350; } }
@media (prefers-reduced-motion: reduce) { .credit, .credit::after, .credit b, .spark { animation: none; } }
main { padding-bottom: 32px; }

.toast { position: fixed; bottom: 20px; inset-inline: 0; margin: 0 auto; width: fit-content; max-width: calc(100% - 32px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 20; }

@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
  #roster { position: static; max-height: none; }
  .stats, .tabs, main { padding-inline: 16px; }
  .top { margin-inline: 10px; padding-inline: 14px; }
  .logo { height: 38px; }
}
@media print {
  .top, .stats, .tabs, #tours, .tab-search, .roster-actions, .credit, .toast, .no-print { display: none !important; }
  body { background: #fff; } main { padding: 0; } .split { display: block; }
  #roster { border: 0; position: static; max-height: none; overflow: visible; }
}
