:root {
  --bg: #f4f6f8; --surface: #ffffff; --surface-2: #f8fafb; --line: #e3e8ec; --line-2: #cfd8de;
  --ink: #17232b; --ink-2: #4a5a64; --ink-3: #7a8a94;
  --brand: #0f766e; --brand-2: #0d9488; --brand-ink: #ffffff; --brand-soft: #e6f4f2;
  --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2; --ok: #15803d; --ok-soft: #dcfce7;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --radius: 10px; --radius-s: 7px; --shadow: 0 1px 2px rgba(16,24,32,.06), 0 4px 14px rgba(16,24,32,.06);
  --nav-w: 220px; --head-h: 56px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 21px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: var(--head-h) 1fr; grid-template-areas: "nav head" "nav main"; min-height: 100vh; }
.head { grid-area: head; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.head .who { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; }
.nav { grid-area: nav; background: #0d2f2c; color: #d6ebe8; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav .logo { font-weight: 700; font-size: 17px; color: #fff; padding: 6px 10px 16px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-s); color: #cfe5e1; margin-bottom: 2px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.on { background: var(--brand-2); color: #fff; }
.nav a { position: relative; }
.nav .badge { margin-inline-start: auto; background: #f59e0b; color: #1f1300; border-radius: 99px; font-size: 12px; padding: 0 7px; font-weight: 700; }
.main { grid-area: main; min-width: 0; padding: 20px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "head" "main"; padding-bottom: 64px; }
  .nav { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: 60px; display: flex; padding: 4px; z-index: 30; overflow-x: auto; overflow-y: hidden; }
  .nav .logo { display: none; }
  .nav a { flex: 1 0 auto; flex-direction: column; gap: 0; font-size: 11px; padding: 6px 8px; margin: 0; justify-content: center; }
  .nav a .ico { font-size: 18px; }
  .nav .badge { position: absolute; margin: 0; top: 2px; inset-inline-end: 6px; font-size: 10px; }
  .main { padding: 14px 12px; }
  .head { padding: 0 12px; }
  .head .who .role { display: none; }
}

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: var(--radius-s); padding: 8px 14px; font: inherit; font-weight: 500; cursor: pointer; min-height: 38px; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--bad); border-color: #f1b4b4; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.new { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.open { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.pill.win { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.closed { background: #eef0f2; color: var(--ink-3); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

label.f { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 8px 10px; min-height: 38px; width: 100%; }
select option { color: var(--ink); background: #fff; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; border-color: var(--brand-2); }
input[type=tel], input[type=email], input.ltr-in { direction: ltr; text-align: right; }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--brand); }
.form { display: grid; gap: 12px; }
.form.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .form.cols-2 { grid-template-columns: 1fr; } }
.form .full { grid-column: 1 / -1; }
.err { color: var(--bad); font-size: 13px; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: start; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap table.t td, .table-wrap table.t th { white-space: nowrap; }
.num { text-align: center; font-variant-numeric: tabular-nums; }

.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); cursor: pointer; }
.item:hover { border-color: var(--line-2); }
.item .t1 { font-weight: 600; }
.item .t2 { color: var(--ink-3); font-size: 13px; }
.empty { color: var(--ink-3); padding: 18px; text-align: center; font-size: 14px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; font: inherit; padding: 9px 14px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.col { background: #eaeef1; border-radius: var(--radius); padding: 8px; min-height: 200px; scroll-snap-align: start; display: flex; flex-direction: column; }
.col.drop { outline: 2px dashed var(--brand-2); outline-offset: -3px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; font-weight: 600; font-size: 14px; }
.col-body { display: grid; gap: 7px; align-content: start; flex: 1; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 9px 10px; cursor: grab; font-size: 13.5px; }
.kcard:hover { border-color: var(--line-2); }
.kcard .n { font-weight: 600; font-size: 14px; }
.kcard.overdue { border-inline-start: 3px solid var(--warn); }

/* ---------- modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(13, 30, 40, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal .mb { padding: 16px 18px; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-start; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* ---------- candidate ---------- */
.cand-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stages button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.stages button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.stages button.closed.on { background: var(--ink-3); border-color: var(--ink-3); }
.timeline { display: grid; gap: 10px; }
.ev { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: 14px; }
.ev .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); margin-top: 6px; }
.ev.note .dot { background: var(--brand-2); }
.ev.stage_change .dot { background: var(--info); }
.ev.repeat_inquiry .dot { background: var(--warn); }
.ev .meta { color: var(--ink-3); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--ink-3); font-size: 13px; }
.bar { height: 8px; background: #e9eef1; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--brand-2); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #0d2f2c, #0f766e); }
.auth .box { background: var(--surface); width: min(400px, 100%); border-radius: 16px; padding: 26px 24px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.auth h1 { margin-bottom: 4px; }
.auth .sub { color: var(--ink-3); margin-bottom: 18px; font-size: 14px; }
.qr { display: grid; place-items: center; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; }
.qr img { width: 190px; height: 190px; }
.code { font-family: ui-monospace, Consolas, monospace; direction: ltr; unicode-bidi: isolate; word-break: break-all; font-size: 12.5px; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; }
input.otp { letter-spacing: 8px; text-align: center; font-size: 22px; direction: ltr; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 16px; left: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: #17232b; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; max-width: 360px; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
@media (max-width: 860px) { #toasts { bottom: 72px; left: 12px; right: 12px; } }

/* ---------- nav groups (סגנון ה-CRM הקיים: קבוצת לידים עם תתי-תצוגות) ---------- */
.nav { width: var(--nav-w); }
.nav a.group { background: var(--brand); color: #fff; font-weight: 700; margin-top: 6px; }
.nav a.group .badge { background: rgba(0,0,0,.22); color: #fff; }
.nav .subnav { display: grid; gap: 5px; margin: 6px 0 10px; }
.nav a.sub { background: var(--brand-2); color: #fff; font-weight: 600; font-size: 14px; padding: 8px 14px; margin: 0; border-radius: 10px; }
.nav a.sub:hover { filter: brightness(1.08); }
.nav a.sub.on { background: #fff; color: var(--brand); }
.nav a.sub.closed { background: #2b4b48; color: #cfe5e1; }
.nav a.sub.closed.on { background: #fff; color: #2b4b48; }
.nav a.sub .badge { background: rgba(0,0,0,.2); color: #fff; }
.nav a.sub.on .badge { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 860px) {
  .nav .subnav { display: none; }
  .nav { width: auto; }
  .nav a.group { margin-top: 0; }
}

/* ---------- dashboard ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 14px 0; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.kpi.hl { border-color: var(--brand-2); box-shadow: 0 0 0 1px var(--brand-2), var(--shadow); }
.kpi .l { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.kpi .v { font-size: 30px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.kpi .s.ok { color: var(--ok); font-weight: 600; }
.kpi .s.warn { color: var(--warn); font-weight: 600; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.spark .b { flex: 1; background: var(--brand-2); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.spark .b:hover { background: var(--brand); }
.spark-x { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 11.5px; margin-top: 6px; direction: ltr; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 180px) 1fr 44px; gap: 10px; align-items: center; font-size: 14px; }
.hbar .bar { height: 10px; }
.hbar a { color: inherit; }
.taskrow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.taskrow.done .tt { text-decoration: line-through; color: var(--ink-3); }
.taskrow.late { border-inline-start: 3px solid var(--bad); }

.nav .stages-nav { margin: 0 14px 0 0; padding-inline-start: 0; border-inline-start: 2px solid rgba(255,255,255,.18); padding-inline-start: 8px; }
.nav .stages-nav a.sub { font-size: 13.5px; padding: 6px 12px; }
.stage-sel { min-height: 32px; padding: 4px 8px; font-size: 13.5px; width: auto; max-width: 160px; }
.loading { color: var(--ink-3); padding: 18px; text-align: center; font-size: 14px; }

/* ---------- bell ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; width: 38px; height: 36px; cursor: pointer; font-size: 17px; }
.bell-count { position: absolute; top: -6px; inset-inline-start: -6px; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px; padding: 0 4px; text-align: center; }
.bell-panel { position: absolute; top: 44px; inset-inline-end: 0; width: min(340px, 92vw); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.18); z-index: 40; padding: 8px; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 10px; }
.bell-item { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; }
.bell-item:hover { background: var(--surface-2); }
.bell-item a { flex: 1; color: inherit; text-decoration: none; }
.bell-item.late { border-inline-start: 3px solid var(--bad); }
.bell-item .tt { font-weight: 600; }

/* ---------- checklists ---------- */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; max-height: 240px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); }

/* ---------- job status ---------- */
.stage-sel.status-open { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 600; }
.stage-sel.status-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 600; }
.stage-sel.status-win { background: var(--ok-soft); color: var(--ok); border-color: transparent; font-weight: 600; }
.job-group + .job-group { margin-top: 14px; }

/* ---------- כרטיס ליד צבעוני ---------- */
.cand-page > div:first-child > .card { background: linear-gradient(135deg, #0f766e 0%, #0d9488 55%, #14b8a6 100%); color: #fff; border: 0; box-shadow: 0 8px 24px rgba(15,118,110,.25); }
.cand-page > div:first-child > .card h1, .cand-page > div:first-child > .card a:not(.btn) { color: #fff; }
.cand-page > div:first-child > .card .muted { color: rgba(255,255,255,.85); }
.cand-page > div:first-child > .card .btn { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.35); color: #fff; }
.cand-page > div:first-child > .card .btn.primary { background: #fff; color: var(--brand); border-color: #fff; }
.cand-page > div:first-child > .card .stages button { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.cand-page > div:first-child > .card .stages button.on { background: #fff; color: var(--brand); border-color: #fff; font-weight: 700; }
.cand-page > div:first-child > .card .stages button.closed { background: rgba(0,0,0,.12); }
.cand-page > div:first-child > .card .stages button.closed.on { background: #334155; color: #fff; border-color: #334155; }
.cand-page .grid > div > .card { border-top: 4px solid var(--brand-2); }
.cand-page .grid > div:first-child > .card:nth-child(1) { border-top-color: #2563eb; }
.cand-page .grid > div:first-child > .card:nth-child(2) { border-top-color: #7c3aed; }
.cand-page .grid > div:last-child > .card:nth-child(1) { border-top-color: #f59e0b; }
.cand-page .grid > div:last-child > .card:nth-child(2) { border-top-color: #0d9488; }
.cand-page .card h2 { display: flex; align-items: center; gap: 8px; }
.cand-page label.f { color: #334155; }
.cand-page input, .cand-page select, .cand-page textarea { background: #fbfdff; }
.cand-page .kv dt { color: #64748b; font-weight: 500; }

/* ---------- חיבורי פייסבוק ---------- */
.btn.gold { background: #a16207; border-color: #a16207; color: #fff; font-weight: 700; }
.btn.gold:hover { background: #854d0e; }
.tip { background: var(--surface-2, #f4f6f8); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.6; margin: 6px 0; }
.tip.bad { background: var(--bad-soft); color: var(--bad); }
.tok-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 6px 0; font-size: 13.5px; }
.tok-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; margin-top: 10px; }
.sw { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw .sl { position: absolute; inset: 0; background: #cfd6dd; border-radius: 24px; cursor: pointer; transition: background .15s; }
.sw .sl::before { content: ''; position: absolute; width: 18px; height: 18px; top: 3px; inset-inline-start: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked + .sl { background: #a16207; }
.sw input:checked + .sl::before { transform: translateX(-18px); }
.sw input:disabled + .sl { opacity: .5; cursor: default; }
.fcards { display: grid; gap: 12px; }
.fcard { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #fff; }
.fcard.off { opacity: .72; background: #fafbfc; }
.fhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fhead .t1 { font-size: 15px; }
.fhead .pill { margin-inline-start: 4px; }
.fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fpick { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; min-width: 0; }
.fpick select, .fpick input { width: 100%; min-width: 0; }
.pg { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin: 6px 0; }
.pg.warn { border-color: var(--warn); background: var(--warn-soft); }
.pg.dim { border-style: dashed; opacity: .72; }
.pg summary { cursor: pointer; }
.pgrow { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pgrow:last-child { border-bottom: 0; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .fgrid, .tok-add { grid-template-columns: minmax(0, 1fr); } }

.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.groups button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font: inherit; text-align: start; }
.groups button b { font-size: 16px; }
.groups button span { font-size: 12.5px; color: var(--ink-3); }
.groups button.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand-soft); }
.groups button.on b { color: var(--brand); }

/* =========================================================
   ליטוש UI — טבלת לידים, סינון, סטטוסים, וואטסאפ, ומראה כללי
   ========================================================= */
:root { --bg: #f3f5f8; --radius: 12px; --radius-s: 8px; --shadow: 0 1px 2px rgba(16,24,32,.05), 0 6px 18px rgba(16,24,32,.05); --focus: 0 0 0 3px rgba(13,148,136,.25); }
.main { max-width: 1560px; padding: 22px 24px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.2px; margin: 0; }
.head { box-shadow: 0 1px 0 var(--line); border-bottom: 0; }
.nav { background: linear-gradient(180deg, #0d2f2c 0%, #0a2624 100%); }
.nav a { transition: background .12s; }
.nav a.on { box-shadow: inset 3px 0 0 #5eead4; }
.btn { transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:focus-visible, input:focus-visible, select:focus-visible { box-shadow: var(--focus); }
.btn.primary { box-shadow: 0 1px 2px rgba(15,118,110,.25); }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.brand { background: #f1f5f9; color: #334155; border-color: #e2e8f0; font-weight: 600; }

/* סרגל סינון */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 14px; }
.filters .search { position: relative; flex: 2 1 260px; display: block; }
.filters .search .ico { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .55; pointer-events: none; }
.filters .search input { padding-inline-start: 36px; height: 42px; border-radius: 10px; background: var(--surface-2); }
.filters .search input:focus { background: #fff; }
.filters .fsel { display: grid; gap: 3px; flex: 1 1 160px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.filters .fsel select { height: 42px; border-radius: 10px; }
.filters .ftoggle { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }

/* סרגל מעל הטבלה */
.leads-bar { display: flex; align-items: center; gap: 10px; margin: 0 2px 8px; }
.leads-bar .count { color: var(--ink-2); font-size: 14px; }
.leads-bar .count b { color: var(--ink); font-size: 16px; }

/* טבלת לידים */
table.leads-t { border-collapse: separate; border-spacing: 0; }
table.leads-t th { font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .2px; padding: 11px 12px; background: #f8fafc; z-index: 2; }
table.leads-t th.sortable { cursor: pointer; user-select: none; }
table.leads-t th.sortable:hover, table.leads-t th.on { color: var(--brand); }
table.leads-t .sort-ind { font-size: 9px; margin-inline-start: 4px; }
table.leads-t td { padding: 10px 12px; font-size: 14px; }
table.leads-t tbody tr:nth-child(even) td { background: #fcfdfe; }
table.leads-t tr.click:hover td { background: #f0faf8; }
table.leads-t td:first-child, table.leads-t th:first-child { padding-inline-start: 16px; }
.dt { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.name-cell { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; color: var(--ink); }
.name-cell .avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.name-cell .pill { font-size: 11px; padding: 1px 8px; }
.name-cell .lock { font-size: 12px; opacity: .7; }
.phone-cell { display: inline-flex; align-items: center; gap: 8px; }
.phone-cell a.ltr { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.phone-cell a.ltr:hover { color: var(--brand); }
a.wa { width: 24px; height: 24px; flex: none; border-radius: 50%; display: inline-block; transition: transform .12s, box-shadow .12s;
  background: center / 24px 24px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='12' fill='%2325D366'/%3E%3Cpath fill='%23fff' d='M12 5.2a6.8 6.8 0 0 0-5.9 10.2L5.2 18.8l3.5-.9A6.8 6.8 0 1 0 12 5.2z'/%3E%3Cpath fill='%2325D366' d='M9.6 8.6c.2 0 .4 0 .5.4l.6 1.4c.1.2 0 .4-.1.5l-.4.5c-.1.1-.1.3 0 .4.5.9 1.3 1.6 2.2 2.1.2.1.3.1.4 0l.5-.6c.1-.2.3-.2.5-.1l1.4.7c.2.1.3.2.3.4 0 .9-.7 1.6-1.6 1.6-2.9-.2-5.3-2.6-5.5-5.5 0-.9.6-1.6 1.2-1.7z'/%3E%3C/svg%3E"); }
a.wa:hover { transform: scale(1.12); box-shadow: 0 2px 8px rgba(37,211,102,.35); }
.ans { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.src { font-size: 13px; color: var(--ink-2); }
.src.src-facebook::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #1877f2; margin-inline-end: 6px; }

/* בורר סטטוס בצבעים */
.stage-sel { border-radius: 99px; font-weight: 600; font-size: 13px; min-height: 32px; padding: 4px 12px; border: 1px solid transparent; width: auto; min-width: 120px; cursor: pointer; }
.stage-sel.st-new { background: var(--info-soft); color: var(--info); }
.stage-sel.st-progress { background: var(--warn-soft); color: var(--warn); }
.stage-sel.st-interview { background: #ede9fe; color: #6d28d9; }
.stage-sel.st-win { background: var(--ok-soft); color: var(--ok); }
.stage-sel.st-closed { background: #eef0f2; color: var(--ink-3); }
.col-head { border-top: 3px solid var(--line-2); border-radius: 8px 8px 0 0; }
.col-head.st-new { border-top-color: var(--info); }
.col-head.st-progress { border-top-color: var(--warn); }
.col-head.st-interview { border-top-color: #7c3aed; }
.col-head.st-win { border-top-color: var(--ok); }
.kcard { transition: box-shadow .12s, transform .12s; }
.kcard:hover { box-shadow: 0 4px 14px rgba(16,24,32,.09); transform: translateY(-1px); }

/* בורר עמודות */
.colpick-order { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-2); max-height: 260px; overflow-y: auto; }
.colpick-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; border-radius: 6px; background: #fff; border: 1px solid var(--line); margin-bottom: 4px; font-size: 13.5px; }
.colpick-group .checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; }

@media (max-width: 860px) {
  .main { padding: 14px 12px; }
  .filters .fsel, .filters .search { flex: 1 1 100%; }
}

.trunc { display: inline-block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

.checks label.row { flex-wrap: nowrap; align-items: flex-start; gap: 8px; line-height: 1.4; }
.checks label.row input { margin-top: 1px; flex: none; }

.jp-body { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 8px; }
.jp-region + .jp-region { margin-top: 10px; }
.jp-rh { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13.5px; color: var(--brand); padding: 4px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; position: sticky; top: -8px; background: var(--surface-2); z-index: 1; }
.jp-brand { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; }
.jp-bh { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.jp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; padding-top: 4px; }
.jp-list label.row { flex-wrap: nowrap; align-items: flex-start; gap: 8px; }

.filters .custom-range { display: flex; align-items: center; gap: 6px; flex: 1 1 300px; font-size: 13px; color: var(--ink-3); }
.filters .custom-range input { height: 42px; border-radius: 10px; flex: 1; min-width: 0; }

/* בחירה מרובה */
table.leads-t th.chk, table.leads-t td.chk { width: 40px; padding-inline: 12px 4px; }
table.leads-t tr.picked td { background: #e6f4f2 !important; }
.bulk-bar { position: sticky; top: calc(var(--head-h) + 6px); z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #0d2f2c; color: #fff; border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; box-shadow: 0 8px 24px rgba(13,47,44,.25); }
.bulk-bar select { width: auto; min-width: 240px; max-width: 100%; height: 38px; }
.bulk-bar .btn.ghost { color: #d6ebe8; border-color: rgba(255,255,255,.3); background: transparent; }

.stage-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--line); border-inline-start: 4px solid var(--line-2); border-radius: 10px; background: #fff; margin-bottom: 6px; }
.stage-row.st-new { border-inline-start-color: var(--info); }
.stage-row.st-progress { border-inline-start-color: var(--warn); }
.stage-row.st-win { border-inline-start-color: var(--ok); }
.stage-row.st-closed { border-inline-start-color: var(--ink-3); background: #fafbfc; }

/* סרגל מותגים במשרות */
.brand-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.brand-bar .bgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.brand-bar .bg-label { font-size: 12px; font-weight: 800; color: var(--brand); margin-inline-end: 2px; }
.bchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.bchip span { background: var(--surface-2); color: var(--ink-3); border-radius: 99px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.bchip:hover { border-color: var(--brand-2); }
.bchip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.bchip.on span { background: rgba(255,255,255,.2); color: #fff; }
.bchip.all { font-weight: 700; }
.brand-card h2 { font-size: 18px; }

.bulk-bar input[type=datetime-local] { width: auto; height: 38px; }
.bulk-bar select[aria-label="פעולה"] { min-width: 170px; font-weight: 600; }
.bulk-bar .btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }

.leads-brands { margin-bottom: 12px; padding: 10px 12px; }

.req { color: var(--bad); font-weight: 700; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.camp-card { border-top: 3px solid #1877f2; margin-bottom: 14px; }
.camp-card .stat .v { font-size: 22px; }
