:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e4e7ec;
  --line-2: #eef0f3;
  --accent: #2456d6;
  --accent-hover: #1c46b4;
  --accent-soft: #eef3ff;
  --accent-ink: #1d3f9a;
  --side: #0e1730;
  --side-2: #17223f;
  --side-ink: #a7b1cc;
  --critical: #d03b3b;
  --critical-soft: #fdf0f0;
  --warning-ink: #9a5b00;
  --warning-soft: #fff6e5;
  --good: #0f8a3c;
  --good-soft: #ecf8f0;
  --wa: #128c4b;
  --chart-1: #2a78d6;
  --grid: #e9ebef;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, .22);
  --side-w: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }
.ic { flex: none; display: block; }
i[data-ic] { display: inline-flex; font-style: normal; }

/* ---------- כפתורים ושדות ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 9px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-weight: 500; font-size: 14px; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, color .15s, transform .06s;
}
.btn:hover { background: var(--surface-2); border-color: #d0d5dd; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { background: #0e7a40; }
.btn.danger { color: var(--critical); }
.btn.danger:hover { background: var(--critical-soft); border-color: #f2c4c4; }
.btn.small { height: 32px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn.big { height: 46px; font-size: 15.5px; width: 100%; }
.btn.ghost { box-shadow: none; background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.wa { color: var(--wa); border-color: #c7e8d5; background: #f2fbf6; }
.icon-btn.wa:hover { background: #def4e7; }
.icon-btn.ghost-dark { background: transparent; border: 0; color: var(--side-ink); }
.icon-btn.ghost-dark:hover { background: var(--side-2); color: #fff; }

input, select, textarea {
  border: 1px solid #d0d5dd; border-radius: 9px; background: var(--surface);
  padding: 8px 11px; outline: none; min-width: 0; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(36, 86, 214, .12); }
textarea { resize: vertical; min-height: 76px; width: 100%; }
select { cursor: pointer; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
label > input, label > select { font-weight: 400; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; }

/* ---------- לוגו ---------- */
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: inline-block;
  background: linear-gradient(135deg, #3b6cf0, #1f45b8) center / cover;
  -webkit-mask: none; position: relative;
}
.logo-mark::after {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 21l5-6 4 4 5-8' stroke='white' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}
.logo-mark.big { width: 40px; height: 40px; border-radius: 11px; }

/* ---------- התחברות ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side {
  background: radial-gradient(900px 500px at 10% 0%, #1f3a8a 0, transparent 60%), linear-gradient(160deg, #0e1730, #0a1124);
  color: #e6ebf7; padding: 48px 56px; display: flex; flex-direction: column; justify-content: center; gap: 28px;
}
.login-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; }
.login-side h2 { font-size: 30px; line-height: 1.3; font-weight: 700; color: #fff; }
.login-side ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; color: var(--side-ink); font-size: 15.5px; }
.login-side li { display: flex; align-items: center; gap: 12px; }
.login-side li i { width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, .07); display: grid; place-items: center; color: #9db8ff; }
.login-main { display: grid; place-items: center; padding: 24px 16px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.login-card h1 { font-size: 26px; }
.login-sub { color: var(--muted); margin: -10px 0 6px; }
.login-card input { height: 44px; }
.login-error { color: var(--critical); font-size: 14px; min-height: 20px; }

/* ---------- מבנה ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 18px 12px 14px;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.side-brand div { display: grid; line-height: 1.2; min-width: 0; }
.side-brand b { color: #fff; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-brand small { font-size: 12px; color: #7f8bab; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px;
  color: var(--side-ink); font-weight: 500; font-size: 14.5px; border: 0; background: none; width: 100%; text-align: start;
  position: relative; transition: background .15s, color .15s;
}
.side-nav a:hover, .side-link:hover { background: var(--side-2); color: #fff; }
.side-nav a.on { background: #1d2a4d; color: #fff; }
.side-nav a.on::before { content: ""; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #6b93ff; }
.side-nav em, .tabbar em {
  margin-inline-start: auto; font-style: normal; font-size: 12px; font-weight: 600; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 999px; background: rgba(255, 255, 255, .1); color: #dbe3f7; display: inline-grid; place-items: center;
}
.side-nav em:empty, .tabbar em:empty { display: none; }
.side-nav em.alert, .tabbar em.alert { background: var(--critical); color: #fff; }
.side-foot { margin-top: auto; display: grid; gap: 8px; border-top: 1px solid #1e2a4a; padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.me-txt { display: grid; line-height: 1.25; min-width: 0; flex: 1; }
.me-txt b { color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { color: #7f8bab; font-size: 12px; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: rgba(244, 246, 249, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.page-title { min-width: 0; flex: 1; }
.page-title h1 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.page-title p { margin: 1px 0 0; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { position: relative; width: 340px; }
.search i { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { width: 100%; height: 38px; padding-inline: 36px 34px; }
.search kbd { position: absolute; inset-inline-end: 9px; top: 50%; transform: translateY(-50%); font: 600 11px/1 ui-monospace, monospace; color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; background: var(--surface-2); }
main { padding: 6px 28px 48px; display: grid; gap: 18px; align-content: start; }
.mobile-only { display: none; }
.tabbar { display: none; }

/* ---------- כרטיסים כלליים ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-head h2 { font-size: 15px; font-weight: 600; flex: 1; }
.card-head .sub { color: var(--muted); font-size: 13px; font-weight: 400; }
.card-body { padding: 14px 18px 18px; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 500; font-size: 13.5px; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-soft); }

/* ---------- דשבורד ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; display: grid; gap: 6px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kpi:hover { border-color: #cfd6e4; box-shadow: 0 2px 12px rgba(16, 24, 40, .08); }
.kpi-label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.kpi-label i { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-value { font-size: 30px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; margin-top: 4px; }
.kpi-sub { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; min-height: 19px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.delta.up { color: var(--good); }
.delta.down { color: var(--critical); }
.flag { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.flag.critical { color: var(--critical); }
.flag.good { color: var(--good); }

.dash-2 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 18px; }
.dash-3 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }

/* גרף עמודות */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; overflow: visible; }
.chart-wrap .bar { fill: var(--chart-1); transition: opacity .12s; }
.chart-wrap.hovering .bar { opacity: .45; }
.chart-wrap.hovering .bar.hot { opacity: 1; }
.chart-wrap .gl { stroke: var(--grid); stroke-width: 1; }
.chart-wrap .base { stroke: #cdd2da; stroke-width: 1; }
.chart-wrap .tick { fill: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart-wrap .hit { fill: transparent; cursor: default; }
.tip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px; padding: 7px 10px;
  font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -100%); box-shadow: var(--shadow-lg); z-index: 5;
}
.tip b { display: block; font-size: 15px; font-weight: 600; }
.tip span { color: #c5cbd8; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th, .mini-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); text-align: start; }
.mini-table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.mini-table td.num { font-variant-numeric: tabular-nums; }
.table-scroll { max-height: 230px; overflow: auto; }

/* פסי כמות (משפך / מקורות) */
.hbars { display: grid; gap: 13px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; cursor: pointer; }
.hbar-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); min-width: 0; }
.hbar-label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-val { font-size: 13.5px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar-val small { color: var(--muted); font-weight: 400; margin-inline-start: 4px; }
.hbar-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.hbar-fill { height: 100%; background: var(--chart-1); border-radius: 4px; min-width: 2px; }
.hbar:hover .hbar-label { color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); flex: none; display: inline-block; }

/* רשימות קצרות בדשבורד */
.mini-list { display: grid; }
.mini-item { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid var(--line-2); cursor: pointer; min-width: 0; }
.mini-item:first-child { border-top: 0; padding-top: 2px; }
.mini-item:hover .mi-name { color: var(--accent); }
.mi-main { min-width: 0; flex: 1; display: grid; line-height: 1.3; }
.mi-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-side { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------- אווטאר ---------- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  font-size: 13.5px; font-weight: 600; background: var(--av-bg, #e8eefc); color: var(--av-ink, #2949a8); letter-spacing: -.02em;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 52px; height: 52px; font-size: 19px; }
.me .avatar { background: #2a3a66; color: #fff; }

/* ---------- תגיות סטטוס ---------- */
.pill-st { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); background: color-mix(in srgb, var(--c) 11%, white); border: 1px solid color-mix(in srgb, var(--c) 22%, white); white-space: nowrap; }
.pill-st .dot { background: var(--c); }
.st { position: relative; display: block; }
.st::before { content: ""; position: absolute; inset-inline-start: 11px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--c); transform: translateY(-50%); pointer-events: none; z-index: 1; }
.st select {
  appearance: none; -webkit-appearance: none; width: 100%; height: 30px; border-radius: 999px; box-shadow: none;
  padding: 0 26px 0 28px; padding-inline-start: 26px; padding-inline-end: 28px; font-size: 13px; font-weight: 500; color: var(--ink-2);
  background-color: color-mix(in srgb, var(--c) 11%, white); border: 1px solid color-mix(in srgb, var(--c) 24%, white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23667085' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 11px center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st select:hover { border-color: color-mix(in srgb, var(--c) 45%, white); }
.tag { display: inline-flex; align-items: center; height: 20px; font-size: 11.5px; font-weight: 600; padding: 0 7px; border-radius: 6px; margin-inline-start: 6px; vertical-align: 1px; white-space: nowrap; }
.tag.dup { background: #fff1e8; color: #b54708; }
.tag.att { background: var(--line-2); color: var(--muted); }

/* מועד */
.due { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; white-space: nowrap; border-radius: 7px; padding: 2px 8px 2px 7px; color: var(--ink-2); background: var(--line-2); }
.due.overdue { background: var(--critical-soft); color: var(--critical); }
.due.today { background: var(--warning-soft); color: var(--warning-ink); }
.due.missing { background: none; color: var(--faint); font-weight: 400; padding: 0; font-size: 12.5px; }

/* ---------- טבלת לידים ---------- */
.list-card { overflow: clip; }
.views { display: flex; gap: 6px; padding: 12px 14px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line-2); }
.views::-webkit-scrollbar { display: none; }
.view {
  display: inline-flex; align-items: center; gap: 7px; flex: none; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 500; font-size: 13.5px;
}
.view:hover { background: var(--line-2); color: var(--ink); }
.view .n { font-size: 12px; color: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.view.on { background: var(--accent-soft); color: var(--accent-ink); border-color: #d6e1fb; }
.view.on .n { color: var(--accent); }
.view.warn:not(.on) { color: var(--warning-ink); }
.view-sep { width: 1px; background: var(--line); flex: none; margin: 6px 4px; }
.list-tools { display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); }
.list-tools select { height: 32px; padding: 0 10px; font-size: 13.5px; }
.list-tools .count { color: var(--muted); font-size: 13px; margin-inline-start: auto; }

.trow {
  display: grid; align-items: center; gap: 14px; padding: 9px 16px; grid-template-columns: var(--cols);
  border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background .1s;
}
.table { --cols: minmax(200px, 1.7fr) 168px 196px minmax(124px, 1fr) minmax(100px, .9fr) 92px 92px; }
.table.has-owner { --cols: minmax(200px, 1.7fr) 168px 196px minmax(124px, 1fr) minmax(100px, .9fr) minmax(100px, .8fr) 92px 92px; }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: #f8faff; }
.trow.head { position: sticky; top: var(--tb-h, 78px); z-index: 2; background: var(--surface-2); cursor: default; font-size: 12px; color: var(--muted); font-weight: 600; padding-top: 10px; padding-bottom: 10px; letter-spacing: .01em; }
.trow.head:hover { background: var(--surface-2); }
.sortable { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 3px; }
.sortable:hover { color: var(--ink); }
.sortable.sorted { color: var(--accent); }
.c-name { display: flex; align-items: center; gap: 11px; min-width: 0; }
.c-name .nm { min-width: 0; display: grid; line-height: 1.3; }
.c-name b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-name .sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-phone { display: flex; align-items: center; gap: 6px; }
.c-phone a.num { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; direction: ltr; margin-inline-end: auto; }
.c-muted { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.show-more { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--line-2); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty i { width: 48px; height: 48px; border-radius: 12px; background: var(--line-2); color: var(--faint); display: grid; place-items: center; margin: 0 auto 12px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- לוח שלבים ---------- */
.board-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.board-tools select { height: 34px; padding: 0 10px; font-size: 13.5px; }
.board-tools .count { color: var(--muted); font-size: 13px; margin-inline-start: auto; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(258px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: start; }
.col { background: #eceff4; border-radius: var(--radius); padding: 10px; min-height: 200px; outline: 2px dashed transparent; outline-offset: -2px; transition: background .15s, outline-color .15s; }
.col.drag-over { background: #e1e9fd; outline-color: var(--accent); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.col-head .dot { background: var(--c); width: 9px; height: 9px; }
.col-head .n { margin-inline-start: auto; color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface); padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); }
.cards { display: grid; gap: 8px; }
.kcard { background: var(--surface); border-radius: 10px; padding: 11px 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); cursor: grab; transition: border-color .12s, box-shadow .12s; }
.kcard:hover { border-color: #c3cff0; box-shadow: 0 3px 10px rgba(16, 24, 40, .08); }
.kcard.dragging { opacity: .4; }
.kcard-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.kcard-top b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard .meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.kcard .ph { color: var(--muted); font-size: 12.5px; direction: ltr; font-variant-numeric: tabular-nums; }
.kcard .note { color: var(--muted); font-size: 12.5px; margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.more { text-align: center; color: var(--muted); font-size: 12.5px; padding: 6px; }

/* ---------- משימות ---------- */
.task-group { overflow: clip; }
.task-group .card-head { padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.task-group .card-head h2 { display: flex; align-items: center; gap: 8px; }
.gcount { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--line-2); border-radius: 999px; padding: 1px 8px; }
.task-group.overdue .card-head h2 { color: var(--critical); }
.task-group.overdue .gcount { background: var(--critical-soft); color: var(--critical); }
.task { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line-2); cursor: pointer; }
.task:first-of-type { border-top: 0; }
.task:hover { background: #f8faff; }
.task-time { font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.task-time small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.task-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.task-main .mi-main { min-width: 0; }
.task-acts { display: flex; gap: 6px; align-items: center; }

/* ---------- מגירת ליד ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .38); z-index: 50; backdrop-filter: blur(1px); }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(600px, 100vw); z-index: 60;
  background: var(--bg); box-shadow: var(--shadow-lg); transform: translateX(-105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.d-head { background: var(--surface); padding: 18px 22px 16px; border-bottom: 1px solid var(--line); }
.d-top { display: flex; align-items: center; gap: 14px; }
.d-id { flex: 1; min-width: 0; }
.d-name { font-size: 21px; font-weight: 700; border: 1px solid transparent; background: transparent; padding: 1px 6px; margin: 0 -7px; border-radius: 8px; width: 100%; box-shadow: none; }
.d-name:hover { border-color: var(--line); }
.d-sub { color: var(--muted); font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 1px; }
.d-close { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--muted); flex: none; align-self: flex-start; }
.d-close:hover { background: var(--line-2); color: var(--ink); }
.d-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.d-body { flex: 1; overflow-y: auto; padding: 16px 22px 34px; display: grid; gap: 14px; align-content: start; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow-sm); }
.box h3 { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.box h3 i { color: var(--faint); }
.box.attention { border-color: #f5d9a8; background: #fffcf5; }

/* שביל שלבים (בסגנון Salesforce) */
.path { display: flex; }
.step {
  flex: 1; min-width: 0; height: 36px; border: 0; background: #eef0f4; color: var(--muted); font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 14px 0 9px; white-space: nowrap;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 12px 100%, 0 50%);
  transition: background .15s, color .15s;
}
.step + .step { margin-inline-start: -9px; }
.step:first-child { clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%); border-radius: 0 8px 8px 0; padding-inline-start: 10px; }
.step:last-child { clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%); border-radius: 8px 0 0 8px; }
.step span { overflow: hidden; text-overflow: ellipsis; }
.step:hover { background: #e2e6ee; color: var(--ink-2); }
.step.done { background: #dbe6fd; color: var(--accent-ink); }
.step.done:hover { background: #cddcfb; }
.step.current { background: var(--accent); color: #fff; }
.step.current.won { background: var(--good); }
.path.closed .step { background: #f1f2f5; color: var(--faint); }
.closed-banner { display: flex; align-items: center; gap: 8px; background: var(--line-2); border-radius: 9px; padding: 9px 12px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 12px; }
.closed-banner b { font-weight: 600; }
.path-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

.grid-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-fields .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; color: var(--ink-2); font-size: 13.5px; font-weight: 400; }
.check input { width: 17px; height: 17px; box-shadow: none; accent-color: var(--accent); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.next-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.next-line input[type="datetime-local"] { flex: 1; min-width: 200px; height: 38px; }
.note-form { display: grid; gap: 8px; }
.note-form .btn { justify-self: start; }
.timeline { display: grid; margin-top: 16px; position: relative; }
.ev { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 0 0 14px; position: relative; }
.ev::before { content: ""; position: absolute; inset-inline-start: 14px; top: 30px; bottom: 2px; width: 2px; background: var(--line-2); }
.ev:last-child::before { display: none; }
.ev .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--muted); }
.ev.note .ico { background: var(--accent-soft); color: var(--accent); }
.ev.call .ico { background: #fff1e8; color: #c4500f; }
.ev.status .ico { background: #f1eefe; color: #5a46c8; }
.ev.task .ico { background: #e8f7f1; color: #12805a; }
.ev .txt { white-space: pre-wrap; word-break: break-word; font-size: 14px; padding-top: 4px; }
.ev.note .txt { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 11px; margin-top: 2px; }
.ev .who { color: var(--muted); font-size: 12px; margin-top: 3px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
details summary { cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
details summary i { color: var(--faint); }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 12px; }

/* ---------- חלון ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
.m-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.m-card.wide { width: min(860px, 100%); }
.m-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 0; }
.m-head .m-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.m-head h2 { margin: 0; font-size: 18px; flex: 1; }
.m-body { padding: 18px 24px; overflow-y: auto; display: grid; gap: 14px; }
.m-foot { padding: 14px 24px 20px; display: flex; gap: 8px; border-top: 1px solid var(--line-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 24px; margin-top: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 11px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.utable { width: 100%; border-collapse: collapse; font-size: 14px; }
.utable th { text-align: start; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.utable td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.utable td .btn { margin-inline-start: 4px; }
.u-cell { display: flex; align-items: center; gap: 10px; }
.inactive { opacity: .5; }
.role { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); }
.role.admin { background: var(--accent-soft); color: var(--accent-ink); }
.help { color: var(--muted); font-size: 13.5px; margin: 0; line-height: 1.6; }
.codebox { direction: ltr; text-align: left; background: #0e1730; color: #dbe3f7; border-radius: 10px; padding: 12px 14px; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; }
.copy-line { display: flex; gap: 8px; }
.copy-line input { flex: 1; direction: ltr; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.stat-line { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-line div { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.stat-line b { font-size: 20px; display: block; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select { height: 40px; }
.err { color: var(--critical); font-size: 13.5px; }
.dropzone { border: 1.5px dashed #c9d1de; border-radius: 12px; padding: 22px; text-align: center; display: grid; gap: 6px; justify-items: center; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone i { color: var(--accent); }
.dropzone input { display: none; }

/* ---------- הודעה קופצת ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--critical); }

.admin-only { display: none !important; }
body.is-admin .admin-only { display: inline-flex !important; }

/* ---------- מסכים בינוניים ---------- */
@media (max-width: 1320px) {
  .dash-3 { grid-template-columns: 1fr 1fr; }
  .dash-3 > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 1240px) and (min-width: 901px) {
  .table { --cols: minmax(180px, 1.7fr) 164px 186px minmax(118px, 1fr) minmax(96px, .9fr) 88px; }
  .table.has-owner { --cols: minmax(180px, 1.7fr) 164px 186px minmax(118px, 1fr) minmax(96px, .9fr) minmax(96px, .8fr) 88px; }
  .c-upd { display: none !important; }
  .search { width: 260px; }
}
@media (max-width: 1080px) {
  :root { --side-w: 72px; }
  .side { padding-inline: 10px; }
  .side-brand { justify-content: center; padding-inline: 0; }
  .side-brand div, .side-nav span, .side-link span, .me-txt, .side-nav em { display: none; }
  .side-nav a, .side-link { justify-content: center; padding: 11px; }
  .side-nav a.on::before { inset-inline-start: -10px; }
  .me { flex-direction: column; padding: 4px 0; }
  .dash-2 { grid-template-columns: 1fr; }
}

/* ---------- מובייל ---------- */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .shell { grid-template-columns: 1fr; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .side { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 7px; color: var(--muted); font-size: 11.5px; font-weight: 500; position: relative; }
  .tabbar a.on { color: var(--accent); }
  .tabbar em { position: absolute; top: 3px; left: calc(50% - 22px); height: 17px; min-width: 17px; font-size: 10.5px; background: var(--critical); color: #fff; padding: 0 5px; }
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .page-title h1 { font-size: 19px; }
  .search { order: 9; width: 100%; }
  .search kbd { display: none; }
  .topbar .btn.primary .lbl { display: none; }
  .topbar .btn.primary { width: 38px; padding: 0; }
  .mobile-only { display: inline-grid; }
  main { padding: 4px 16px 32px; gap: 14px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 25px; }
  .kpi-label i { display: none; }
  .dash-3 { grid-template-columns: 1fr; }
  .trow.head { display: none; }
  .trow, .table.has-owner .trow { grid-template-columns: 1fr auto; gap: 8px 10px; padding: 12px 14px; }
  .trow .c-name { grid-column: 1; }
  .trow .c-phone { grid-column: 2; grid-row: 1; }
  .trow .c-status { grid-column: 1 / -1; }
  .trow .c-next { grid-column: 1 / -1; }
  .trow .c-next:empty, .trow .c-src, .trow .c-owner, .trow .c-date { display: none; }
  .c-phone a.num { display: none; }
  .st select { width: auto; max-width: 100%; }
  .list-tools .count { width: 100%; margin: 0; }
  .task { grid-template-columns: 1fr auto; padding: 12px 14px; }
  .task-time { grid-column: 1 / -1; display: flex; gap: 6px; align-items: baseline; }
  .drawer { width: 100vw; }
  .d-head, .d-body { padding-inline: 16px; }
  .grid-fields, .form-grid, .path-foot { grid-template-columns: 1fr; }
  .step { font-size: 11.5px; padding-inline: 10px 6px; }
  .board { grid-auto-columns: 82vw; }
  .m-head, .m-body, .m-foot { padding-inline: 16px; }
  .tabs { padding-inline: 16px; }
}
