/* מעקב לידים — uses the design tokens from style.css (:root). */
tr.lead-row { cursor: pointer; transition: background-color 150ms ease; }
tr.lead-row:hover { background: var(--hover-tint); }
tr.lead-row td:nth-child(2), tr.lead-row td:nth-child(4), tr.lead-row td:nth-child(6) { white-space: nowrap; }

/* One color per lead status — shared by the badge and the status buttons. */
.lead-st.st-booked { background: #e5eef9; color: #2f6fb5; }
.lead-st.st-interested { background: #dff3f0; color: #13867a; }
.lead-st.st-hesitant { background: #fcf3de; color: #a8740f; }
.lead-st.st-followup { background: #fde9dc; color: #c8561a; }
.lead-st.st-closed { background: #e6f5ec; color: #2f9160; }
.lead-st.st-irrelevant { background: #eceff1; color: #5f6b72; }
.lead-st.st-canceled { background: #fceae7; color: #d9483a; }
.lead-st.st-other { background: #efe8fa; color: #7c4dbe; }

/* Who's responsible: קארין pink, שירי purple, מאיה teal. */
.lead-caller.cl-karin { --caller: #ed1667; --caller-bg: #fce3ee; }
.lead-caller.cl-shiri { --caller: #7c4dbe; --caller-bg: #efe8fa; }
.lead-caller.cl-maya { --caller: #0f8a8a; --caller-bg: #ddf2f2; }
.badge.lead-caller { background: var(--caller-bg); color: var(--caller); font-size: 0.85rem; padding: 3px 12px; }

.lead-caller-row { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.lead-caller-row label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.lead-caller-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.lead-caller-btn {
  flex: 1; min-width: 100px; padding: 12px 18px; border-radius: var(--radius-sm);
  border: 2px solid var(--caller-bg); background: var(--card); color: var(--caller);
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.lead-caller-btn:hover { background: var(--caller-bg); transform: translateY(-1px); }
.lead-caller-btn.active { background: var(--caller); border-color: var(--caller); color: white; box-shadow: var(--shadow-sm); }
.lead-caller-btn.active::before { content: '✓ '; }

/* Call date: past purple, within a week gold, later light blue. */
.lead-call { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.lead-call small { font-weight: 700; margin-inline-start: 4px; }
.lead-call-past { background: #efe8fa; color: #7c4dbe; }
.lead-call-soon { background: #fbf0d2; color: #9a6a00; }
.lead-call-later { background: #e2f2fb; color: #2b7fae; }
label .lead-call { font-size: 0.75rem; padding: 1px 8px; margin-inline-start: 6px; }

.lead-status-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.lead-st-btn {
  border: 2px solid transparent; border-radius: 999px; padding: 8px 18px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; opacity: 0.75;
  transition: opacity 150ms ease, transform 150ms ease, border-color 150ms ease;
}
.lead-st-btn:hover { opacity: 1; transform: translateY(-1px); }
.lead-st-btn.active { opacity: 1; border-color: currentColor; box-shadow: var(--shadow-sm); }
.lead-st-btn.active::before { content: '✓ '; }

.lead-updates-count { font-size: 0.75rem; color: var(--text-muted); font-weight: normal; white-space: nowrap; }

input[type="number"], input[type="datetime-local"], input[type="date"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
}
input[type="number"]:focus, input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-grid .lead-field-wide { grid-column: 1 / -1; }
.lead-readonly { padding: 9px 0; font-size: 0.9rem; }
.lead-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.lead-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.field-grid label.lead-check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text); padding: 9px 0; cursor: pointer; }

.lead-final-price {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; padding: 14px 18px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
}
.lead-final-price span { font-weight: 600; }
.lead-final-price strong { font-size: 1.6rem; font-weight: 800; color: var(--accent); }

.lead-add-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lead-add-box { display: flex; flex-direction: column; margin-bottom: 0; }
.lead-add-box input[type="date"] { width: 100%; }
.lead-add-followup { border-top: 3px solid var(--accent); }
.lead-add-box:not(.lead-add-followup) { border-top: 3px solid var(--good); }
.lead-add-title { font-weight: 700; margin-bottom: 10px; }
.lead-add-actions { display: flex; gap: 10px; align-items: center; margin-top: auto; padding-top: 12px; }
#lead-timeline { margin-top: 16px; }

.lead-entry {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 10px;
  border-inline-start: 4px solid;
}
.lead-entry-followup { background: var(--accent-soft); border-color: var(--accent); }
.lead-entry-update { background: var(--good-bg); border-color: var(--good); }
.lead-entry-kind { font-weight: 700; color: var(--text); }
.lead-entry-followup .lead-entry-kind { color: var(--accent); }
.lead-entry-update .lead-entry-kind { color: var(--good); }
.lead-update-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.lead-update-body { white-space: pre-wrap; font-size: 0.92rem; line-height: 1.55; }
.lead-update-delete { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 0.8rem; padding: 2px 6px; border-radius: 4px; }
.lead-update-delete:hover { color: var(--risk); background: var(--risk-bg); }

@media (max-width: 640px) {
  .field-grid, .lead-add-boxes { grid-template-columns: 1fr; }
}

/* The leads dashboard cards double as filters. */
.stat-card[data-view] { cursor: pointer; border: 2px solid transparent; }
.stat-card[data-view].active { border-color: var(--accent); background: var(--accent-soft); }

/* Leads with no one available at the call time. */
.badge.lead-unassigned { background: var(--risk-bg); color: var(--risk); white-space: nowrap; }
.badge.lead-caller, .badge.lead-st { white-space: nowrap; }
.lead-unassigned-banner { background: var(--risk-bg); color: var(--risk); font-weight: 600; cursor: pointer; box-shadow: none; }
.lead-caller-btn[disabled] { cursor: default; transform: none; }
.lead-caller-btn[disabled]:not(.active) { opacity: 0.45; }
.lead-caller-btn[disabled]:hover { background: var(--card); }
.lead-caller-btn.active[disabled]:hover { background: var(--caller); }

/* Leads tab: switch between the leads table and the availability calendar. */
.leads-views { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 16px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow-sm); }
.leads-view-btn {
  border: none; background: none; padding: 8px 18px; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 0.92rem; font-weight: 600; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.leads-view-btn.active { background: var(--text); color: white; }

/* Availability calendar */
.avail-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.avail-toolbar .lead-hint { max-width: 560px; margin-top: 6px; font-size: 0.8rem; }
.avail-nav { display: flex; gap: 8px; }
.avail-nav .btn[disabled] { opacity: 0.4; cursor: default; transform: none; }
.avail-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.avail-legend span { display: inline-flex; align-items: center; gap: 6px; }
.avail-legend i { width: 16px; height: 12px; border-radius: 3px; border: 1px solid var(--border); display: inline-block; }
.avail-scroll { overflow-x: auto; }
table.avail-grid { border-collapse: separate; border-spacing: 2px; width: 100%; min-width: 620px; box-shadow: none; background: none; user-select: none; }
.avail-grid th, .avail-grid td { padding: 0; border: none; font-size: 0.75rem; }
.avail-grid th.avail-day { background: var(--text); color: white; padding: 6px 2px; border-radius: 6px; font-weight: 700; font-size: 0.82rem; }
.avail-grid th.avail-day small { display: block; font-weight: 400; opacity: 0.8; font-size: 0.72rem; }
.avail-grid th.avail-day-off { background: #c9cdd0; color: #6b7378; }
.avail-grid th.avail-today { background: var(--accent); }
.avail-grid th.avail-day-toggle { cursor: pointer; }
.avail-grid th.avail-day-toggle:hover { opacity: 0.85; }
.avail-grid th.avail-time { background: none; width: 46px; }
.avail-grid td.avail-time { color: var(--text-muted); text-align: center; vertical-align: top; font-size: 0.72rem; background: none; transform: translateY(-7px); }
.avail-cell { height: 22px; border-radius: 4px; }
.avail-free { background: #ffffff; outline: 1px solid var(--border); outline-offset: -1px; }
.avail-busy {
  background: repeating-linear-gradient(135deg, #f6c9cf 0 6px, #fbe2e5 6px 12px);
  outline: 1px solid #eba4ad; outline-offset: -1px;
}
.avail-off { background: #e3e5e7; }
.avail-call { background: #7c4dbe; color: white; font-weight: 600; font-size: 0.7rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; cursor: pointer; padding: 0 4px; }
.avail-past { opacity: 0.45; }
.avail-editable { cursor: pointer; }
.avail-editable.avail-free:hover { background: var(--hover-tint); }

/* Invite sent, nobody has accepted yet. */
.badge.lead-awaiting { background: var(--warn-bg); color: var(--warn); white-space: nowrap; }

/* "Can you make the new time?" prompt */
.lead-reconfirm-box { max-width: 460px; }
.lead-reconfirm-text { font-size: 1.05rem; line-height: 1.7; margin: 0 0 8px; }

/* מנטורית מומלצת: רעות orange, גל blue, שירי purple. */
.mt-reut { --caller: #c8561a; --caller-bg: #fde9dc; }
.mt-gal { --caller: #2f6fb5; --caller-bg: #e5eef9; }
.mt-shiri { --caller: #7c4dbe; --caller-bg: #efe8fa; }
.mentor-btn small { font-weight: 500; opacity: 0.8; font-size: 0.8rem; }
.mentor-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.badge.mentor-chip { background: var(--caller-bg); color: var(--caller); font-size: 0.85rem; }

.leads-summaries { display: flex; gap: 10px 28px; flex-wrap: wrap; margin-bottom: 14px; }
.leads-summaries .mentor-summary { margin-bottom: 0; }

/* Updates the system wrote itself (booking page, invites, routing). */
.lead-entry-system { background: #f0f1f2; border-color: #a7adb2; }
.lead-entry-system .lead-entry-kind { color: #6b7378; }
.lead-entry-system .lead-update-body { color: #4f575c; }

/* Busy in her own Google Calendar (read-only in the availability calendar). */
.avail-gcal { background: repeating-linear-gradient(135deg, #c9d9ee 0 6px, #dfe9f6 6px 12px); outline: 1px solid #a9c1e2; outline-offset: -1px; }
.gcal-status { font-size: 0.78rem; margin-top: 4px; font-weight: 600; }
.gcal-ok { color: var(--good); }
.gcal-error { color: var(--risk); }
.gcal-none { color: var(--text-muted); font-weight: 400; }

/* Deleting a lead (Dar / Karin): a quiet button, then an inline confirmation. */
.lead-delete-zone { display: flex; justify-content: flex-end; margin-top: 8px; }
.lead-delete-btn { color: var(--risk); border-color: var(--risk-bg); }
.lead-delete-confirm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--risk-bg); color: var(--risk); padding: 10px 14px; border-radius: var(--radius-sm); }
.lead-delete-confirm span { flex: 1; min-width: 200px; font-size: 0.9rem; }
.lead-delete-yes { background: var(--risk); color: #fff; border-color: var(--risk); }

/* סקירה — admin dashboard over all leads */
.ov-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ov-stats .stat-card { margin: 0; min-width: 0; }
.ov-stats .stat-card .num { font-size: 1.55rem; }
@media (max-width: 640px) { .ov-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.ov-grid > .card { min-width: 0; margin-bottom: 0; }
.ov-grid + .card, .card + .ov-grid { margin-top: 16px; }
.ov-bars { display: grid; gap: 8px; }
.ov-bar-row { display: grid; grid-template-columns: 96px 1fr 32px; gap: 10px; align-items: center; font-size: 0.88rem; }
.ov-bar-track { height: 14px; background: var(--hover-tint); border-radius: 4px; overflow: hidden; }
.ov-bar-track .ov-bar.lead-st { display: block; height: 100%; border-radius: 0 4px 4px 0; background: currentColor; }
.ov-bar-num { font-variant-numeric: tabular-nums; text-align: start; color: var(--text); }
.ov-days { display: grid; grid-template-columns: repeat(21, 1fr); gap: 3px; height: 130px; align-items: end; border-bottom: 1px solid var(--border); }
.ov-day { position: relative; height: 100%; display: flex; align-items: flex-end; outline: none; cursor: default; }
.ov-day-bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; }
.ov-day-bar.is-zero { background: var(--border); }
.ov-tip {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--text); color: #fff; font-size: 0.75rem; padding: 3px 8px; border-radius: 6px; pointer-events: none; opacity: 0; z-index: 2;
}
.ov-day:hover .ov-tip, .ov-day:focus .ov-tip { opacity: 1; }
.ov-day:hover .ov-day-bar { filter: brightness(0.9); }
.ov-days-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.ov-table-wrap { overflow-x: auto; }
.ov-table { width: 100%; box-shadow: none; }
.ov-table td, .ov-table th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ov-kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.ov-kv:last-child { border-bottom: none; }
.ov-kv strong { font-variant-numeric: tabular-nums; }

/* "לווטסאפ" on the lead page — opens a WhatsApp chat with her (wa.me). */
.lead-whatsapp {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  background: #1f9d55; color: #fff; text-decoration: none; font-size: 0.92rem; font-weight: 600; white-space: nowrap;
}
.lead-whatsapp:hover { background: #18864a; }
.lead-call-unset { background: #fde4ec; color: #b3124f; }

/* "היי 🙂 הנה לידים נוספים שצוותו אלייך" — the login popup (showNewLeadsPopup). */
.new-leads-popup .modal-box { max-width: 420px; display: grid; gap: 10px; }
.new-leads-popup h2 { margin: 0; }
.new-leads-popup .nl-text { margin: 0; }
.nl-list { list-style: none; margin: 4px 0 6px; padding: 0; display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.nl-lead {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: inherit; font: inherit; cursor: pointer; text-align: start;
}
.nl-lead:hover { border-color: var(--accent); }
.nl-lead span { color: var(--text-muted); font-size: 0.9rem; }
