:root {
  --bg: #040a1c;
  --bg-2: #081536;
  --card: rgba(16, 34, 82, 0.42);
  --card-2: rgba(22, 44, 104, 0.5);
  --border: rgba(96, 146, 255, 0.16);
  --border-strong: rgba(96, 146, 255, 0.32);
  --text: #eaf0ff;
  --muted: #8396c4;
  --faint: #5a6b97;
  --blue: #3b82f6;
  --cyan: #38bdf8;
  --violet: #7c6cf2;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --track: rgba(120, 150, 220, 0.16);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Heebo", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 85% -10%, #12307a 0%, transparent 60%),
              radial-gradient(900px 600px at 0% 30%, #0b2160 0%, transparent 60%),
              linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  min-height: 100vh;
}
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(120,160,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(120,160,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at top, #000 20%, transparent 75%);
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; color: inherit; cursor: pointer; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- סרגל צד ---------- */
.sidebar {
  position: fixed; top: 16px; bottom: 16px; right: 16px; width: 60px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0;
  background: rgba(10, 24, 62, .6); border: 1px solid var(--border); border-radius: 20px;
  backdrop-filter: blur(14px);
}
.sidebar a, .sidebar button {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  color: var(--muted); background: none; border: 0; text-decoration: none; transition: .2s;
}
.sidebar a:hover, .sidebar button:hover { color: var(--text); background: rgba(80,130,255,.12); }
.sidebar .logo { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #fff; box-shadow: 0 6px 20px rgba(59,130,246,.45); margin-bottom: 8px; }
.sidebar .logo svg { fill: currentColor; stroke: none; }
.sidebar .nav.active { color: #fff; background: rgba(59,130,246,.85); box-shadow: 0 4px 16px rgba(59,130,246,.4); }
.sidebar .spacer { flex: 1; }

main { position: relative; z-index: 1; margin-right: 92px; padding: 24px 24px 48px 24px; max-width: 1480px; }

/* ---------- כותרת ---------- */
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
h1 { margin: 4px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -.3px; }
h1 span { color: var(--muted); font-weight: 600; font-size: 20px; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: rgba(8,20,52,.7); border: 1px solid var(--border); }
.segmented button { border: 0; background: none; padding: 7px 16px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 500; }
.segmented button.on { background: linear-gradient(135deg, #4f8ff8, var(--blue)); color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,.4); }
.segmented.small { flex-wrap: wrap; }
.segmented.small button { padding: 5px 12px; font-size: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(8,20,52,.7); border: 1px solid var(--border); color: var(--muted); }
.icon-btn:hover { color: var(--text); }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }
.btn-primary { border: 0; padding: 10px 18px; border-radius: 12px; font-weight: 600; background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #fff; box-shadow: 0 6px 18px rgba(59,130,246,.4); }

.banner { margin-bottom: 16px; padding: 12px 16px; border-radius: 14px; font-size: 14px; border: 1px solid var(--border-strong); background: rgba(59,130,246,.12); display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner.error { border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.1); }
.banner button { border: 1px solid var(--border-strong); background: rgba(8,20,52,.6); padding: 6px 12px; border-radius: 10px; font-size: 13px; }

/* ---------- כרטיסים ---------- */
.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(12px); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 30px rgba(0,0,0,.25);
  margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card-kicker { color: var(--muted); font-size: 13px; }
.card-title-big { font-size: 24px; font-weight: 800; margin-top: 2px; }
.title-row { display: flex; align-items: baseline; gap: 10px; }

.loading .card, .loading .kpi { opacity: .45; transition: opacity .2s; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.kpi { background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(59,130,246,.18), transparent 70%); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-label { color: var(--muted); font-size: 14px; }
.kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #5b9bff, var(--blue)); box-shadow: 0 6px 16px rgba(59,130,246,.4); }
.kpi-icon.violet { background: linear-gradient(135deg, #9a8cff, var(--violet)); box-shadow: 0 6px 16px rgba(124,108,242,.4); }
.kpi-icon.cyan { background: linear-gradient(135deg, #67d4ff, #0ea5e9); box-shadow: 0 6px 16px rgba(56,189,248,.4); }
.kpi-icon.slate { background: linear-gradient(135deg, #8a9ac0, #56658c); box-shadow: none; }
.kpi-mid { display: flex; justify-content: space-between; align-items: flex-end; margin: 14px 0 12px; }
.kpi-value { font-size: 32px; font-weight: 800; line-height: 1; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: rgba(59,130,246,.18); color: #9cc2ff; border: 1px solid rgba(59,130,246,.3); white-space: nowrap; }
.badge.good { background: rgba(52,211,153,.14); color: #6ee7b7; border-color: rgba(52,211,153,.3); }
.badge.warn { background: rgba(251,191,36,.12); color: #fcd34d; border-color: rgba(251,191,36,.3); }
.badge.bad { background: rgba(248,113,113,.12); color: #fca5a5; border-color: rgba(248,113,113,.3); }
.bar { height: 5px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(270deg, var(--cyan), var(--blue)); box-shadow: 0 0 10px rgba(56,189,248,.5); transition: width .6s ease; }
.bar.slate > i { background: linear-gradient(270deg, #c3cde6, #7b8ab0); box-shadow: none; }
.kpi-foot { color: var(--faint); font-size: 12px; margin-top: 10px; }

/* שורה 2 */
.row-2 { display: grid; grid-template-columns: 2fr minmax(280px, 1fr); gap: 18px; }
.ring .val.small { font-size: 18px; }
.rep-hero .when { position: absolute; top: 12px; left: 14px; font-size: 12px; color: #dfe8ff; font-weight: 600; }
.tag.hot { color: #fcd34d; border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }
.col-side { display: flex; flex-direction: column; }
.col-side .card { flex: none; }
.col-side .card:last-child { flex: 1; }
.ring-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ring { position: relative; width: 110px; height: 110px; flex: none; }
.ring svg { width: 110px; height: 110px; transform: rotate(-90deg); stroke-width: 9; }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.ring-text .title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.ring-text p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.details { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.details li { display: flex; align-items: center; gap: 12px; }
.details .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(59,130,246,.14); border: 1px solid var(--border); color: #8fb6ff; flex: none; }
.details .ico svg { width: 17px; height: 17px; }
.details .txt { flex: 1; min-width: 0; }
.details .txt b { display: block; font-size: 14px; font-weight: 600; }
.details .txt small { color: var(--faint); font-size: 12px; }
.details .v { font-weight: 700; font-size: 15px; }

/* בר עם נקודה */
.lollipops { display: grid; gap: 16px; }
.lolli { display: grid; grid-template-columns: 150px 1fr 70px; align-items: center; gap: 14px; }
.lolli .lbl { font-size: 14px; color: #cdd8f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lolli .lbl small { display: block; color: var(--faint); font-size: 11px; }
.lolli .track { position: relative; height: 4px; border-radius: 999px; background: var(--track); }
.lolli .fill { position: absolute; top: 0; bottom: 0; right: 0; border-radius: inherit; background: linear-gradient(270deg, rgba(59,130,246,.55), var(--cyan)); transition: width .6s ease; }
.lolli .fill::after { content: ""; position: absolute; left: -6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(56,189,248,.55), 0 0 12px var(--cyan); }
.lolli.muted-row .fill { background: linear-gradient(270deg, rgba(160,175,210,.3), #c8d2ea); }
.lolli.muted-row .fill::after { box-shadow: 0 0 0 3px rgba(200,210,234,.35); }
.lolli .v { font-weight: 700; font-size: 14px; text-align: left; }
.lollipops.compact { gap: 14px; }
.lollipops.compact .lolli { grid-template-columns: 120px 1fr 54px; }

/* גרף הכנסות */
.chart { width: 100%; }
.chart svg { width: 100%; height: 260px; stroke-width: 1; }
.chart .grid line { stroke: rgba(120,150,220,.12); }
.chart text { fill: var(--muted); stroke: none; font-size: 11px; font-family: inherit; }
.chart .bar-rect { transition: opacity .2s; }
.chart .bar-rect:hover { opacity: .8; }
.chart .target { stroke: var(--amber); stroke-dasharray: 5 5; stroke-width: 1.5; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; vertical-align: -1px; }
.tooltip { position: fixed; pointer-events: none; z-index: 20; background: #0b1a42; border: 1px solid var(--border-strong); padding: 8px 12px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }

/* צוות */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: rgba(8,20,52,.6); padding: 5px 12px; border-radius: 999px; font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.chip .c { background: rgba(120,150,220,.18); border-radius: 999px; padding: 0 7px; font-size: 11px; }
.chip.on { background: linear-gradient(135deg, #4f8ff8, var(--blue)); color: #fff; border-color: transparent; }
.chip.on .c { background: rgba(255,255,255,.25); }
.rep-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.rep { border-radius: 16px; border: 1px solid var(--border); background: rgba(10,24,62,.55); padding: 10px; display: flex; flex-direction: column; }
.rep-hero { position: relative; overflow: hidden; height: 96px; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, rgba(90,110,220,.55), rgba(40,70,160,.45)); }
.rep-hero::before { content: ""; position: absolute; width: 120px; height: 120px; left: -20px; top: -20px; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 0 0 18px rgba(255,255,255,.03); }
.rep-hero.h1 { background: linear-gradient(135deg, rgba(110,100,230,.6), rgba(50,70,170,.45)); }
.rep-hero.h2 { background: linear-gradient(135deg, rgba(40,150,200,.5), rgba(30,70,150,.45)); }
.rep-hero.h3 { background: linear-gradient(135deg, rgba(80,120,230,.55), rgba(40,50,140,.5)); }
.rep-hero .badge { align-self: flex-start; background: rgba(4,10,28,.55); color: #dfe8ff; border-color: rgba(255,255,255,.14); }
.rep-hero .big { align-self: flex-start; font-size: 28px; font-weight: 800; }
.rep-hero .big small { font-size: 12px; font-weight: 500; color: #c6d3f5; margin-right: 6px; }
.rep-body { padding: 12px 4px 4px; flex: 1; display: flex; flex-direction: column; }
.rep-body h3 { margin: 0; font-size: 16px; font-weight: 700; }
.rep-body p { margin: 2px 0 10px; font-size: 12px; color: var(--faint); }
.rep-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { font-size: 11px; color: #b8c6ea; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); background: rgba(80,120,220,.08); }
.rep .bar { margin-top: auto; }
.footnote { color: var(--faint); font-size: 12px; margin: 16px 0 0; }

/* לקוחות */
.row-3 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.rank li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; }
.rank .pos { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: rgba(59,130,246,.15); color: #9cc2ff; }
.rank li:first-child .pos { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #fff; }
.rank .nm { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.rank .v { font-weight: 700; font-size: 14px; }
.empty { color: var(--faint); font-size: 14px; padding: 12px 0; }

/* ---------- רספונסיבי ---------- */
@media (max-width: 1200px) {
  .rep-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .rep-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .sidebar { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; height: 60px; flex-direction: row; justify-content: space-around; padding: 0 8px; }
  .sidebar .logo { margin: 0; }
  .sidebar .spacer { display: none; }
  main { margin-right: 0; padding: 16px 16px 96px; }
  h1 { font-size: 24px; }
  .kpis { grid-template-columns: 1fr; }
  .kpi-value { font-size: 28px; }
  .rep-grid { grid-template-columns: 1fr; }
  .lolli { grid-template-columns: 100px 1fr 56px; gap: 10px; }
  .lollipops.compact .lolli { grid-template-columns: 96px 1fr 44px; }
  .ring-card { flex-direction: row-reverse; }
}
