/* ══════════════════════════════════════════
   MEITAV FINANCE CRM  ·  Brand: #7ED857
   ══════════════════════════════════════════ */
:root {
  --sidebar-w:    230px;
  --green:        #7ED857;      /* Meitav brand green */
  --green-dark:   #5BB83A;      /* darker shade */
  --green-light:  #E8F8DE;      /* very light green bg */
  --sidebar-bg:   #0E1E0C;      /* near-black green */
  --sidebar-txt:  rgba(255,255,255,.80);
  --nifraim:      #7ED857;      /* green  – monthly recurring */
  --hikef:        #F59E0B;      /* amber  – one-time payment  */
  --hikef-bg:     #FEF3C7;
  --nif-bg:       #ECFBD9;
  --total-color:  #1976D2;      /* blue   – combined total    */
  --total-bg:     #E3F2FD;
  --bg:           #FFFFFF;      /* white background */
  --card-r:       12px;
  --shadow:       0 2px 12px rgba(0,0,0,.07);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
body {
  background: #FFFFFF;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #1A2B1A;
  margin: 0;
}
.main-content { background: #F2F4F8; }

/* Section separators in form */
.section-header-nif {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0 6px;
  border-bottom: 2px solid var(--green);
  margin-bottom: 14px;
  font-weight: 700; font-size: 1rem; color: #1A5C0A;
}
.section-header-hik {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0 6px;
  border-bottom: 2px solid #F59E0B;
  margin-bottom: 14px;
  font-weight: 700; font-size: 1rem; color: #92400E;
}
.section-pill-nif {
  background: var(--nif-bg); color: #2E7D0E;
  padding: 2px 12px; border-radius: 20px; font-size: .78rem;
}
.section-pill-hik {
  background: var(--hikef-bg); color: #92400E;
  padding: 2px 12px; border-radius: 20px; font-size: .78rem;
}
a { text-decoration: none; }

/* ══ SIDEBAR ════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  box-shadow: -4px 0 20px rgba(0,0,0,.25);
}

.sidebar-logo {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 90px;
  display: flex;
  align-items: center;
}
.logo-img {
  max-width: 170px;
  max-height: 65px;
  object-fit: contain;
  filter: brightness(1.1);
}
.logo-text {
  display: flex; align-items: center; gap: 10px;
  color: white;
}
.logo-text .bi { font-size: 1.9rem; color: var(--green); }
.logo-sub { font-size: .7rem; color: rgba(255,255,255,.45); }

.sidebar-nav { padding: 8px 0; flex: 1; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 18px;
  color: var(--sidebar-txt);
  font-size: .88rem;
  transition: all .18s;
  border-right: 3px solid transparent;
}
.nav-item .bi { font-size: 1.05rem; width: 20px; text-align: center; }
.nav-item:hover {
  background: rgba(126,216,87,.12);
  color: var(--green);
}
.nav-item.active {
  background: rgba(126,216,87,.18);
  color: var(--green);
  border-right-color: var(--green);
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  color: rgba(255,255,255,.35);
  font-size: .72rem;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(126, 216, 87, .08);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  font-size: 1.8rem;
  color: var(--green);
  line-height: 1;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  color: white;
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  color: var(--green);
  font-size: .68rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.user-logout {
  color: rgba(255,255,255,.5);
  font-size: 1.1rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all .15s;
}
.user-logout:hover {
  color: #FCA5A5;
  background: rgba(252, 165, 165, .1);
}

/* ══ MAIN CONTENT ════════════════════════════ */
.main-content {
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  padding: 24px 28px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.page-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.25rem;
  color: #0E1E0C;
}

/* ══ STAT CARDS ══════════════════════════════ */
.stat-card {
  background: white;
  border-radius: var(--card-r);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--c, #7ED857);
  position: relative;
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 10px;
  background: var(--ic-bg, #ECFBD9);
  color: var(--ic-c, #5BB83A);
}
.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--vc, #1A2B1A);
  line-height: 1.1;
}
.stat-label { font-size: .76rem; color: #666; margin-top: 4px; }
.stat-sub   { font-size: .72rem; color: #999; margin-top: 2px; }

/* ══ CARD PANEL ══════════════════════════════ */
.card-panel {
  background: white;
  border-radius: var(--card-r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 2px solid var(--bg);
  font-weight: 600;
  color: #0E1E0C;
  font-size: .88rem;
  background: white;
}

/* ══ COMMISSION COLOR SYSTEM ═════════════════
   נפרעים = green (monthly recurring income)
   היקף   = amber (one-time bonus)
   סה"כ   = blue  (total)
   ═══════════════════════════════════════════ */
.nif-val  { color: var(--green-dark) !important; font-weight: 700; }
.hik-val  { color: #D97706 !important; font-weight: 700; }
.tot-val  { color: var(--total-color) !important; font-weight: 700; }

.nif-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--nif-bg); color: #3A8A22;
  padding: 2px 8px; border-radius: 20px; font-size: .74rem; font-weight: 600;
}
.hik-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--hikef-bg); color: #92400E;
  padding: 2px 8px; border-radius: 20px; font-size: .74rem; font-weight: 600;
}
.tot-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--total-bg); color: #1565C0;
  padding: 2px 8px; border-radius: 20px; font-size: .74rem; font-weight: 600;
}

/* column header helpers */
.th-nif { color: #3A8A22 !important; }
.th-hik { color: #92400E !important; }
.th-tot { color: #1565C0 !important; }

/* ══ TABLE ═══════════════════════════════════ */
.table { font-size: .86rem; }
.table thead th {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #666;
  white-space: nowrap;
}
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #F0FBE6 !important; }

/* ══ PRODUCT BADGES ══════════════════════════ */
.product-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 500;
  margin: 1px;
  white-space: nowrap;
}
.badge-bituach  { background: #E3F2FD; color: #1565C0; }
.badge-finansim { background: #E8F5E9; color: #1B5E20; }
.badge-pensya   { background: #FCE4EC; color: #880E4F; }
.badge-niyud    { background: #FFF3E0; color: #BF360C; }
.badge-ktzava   { background: #F3E5F5; color: #4A148C; }

/* ══ COMMISSION PREVIEW (form) ═══════════════ */
.commission-preview {
  border: 1px solid #D9F0CA;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .84rem;
  background: #FAFDF8;
}
.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px dashed #E5E5E5;
}
.preview-row:last-of-type { border-bottom: none; margin-bottom: 0; }
.preview-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid #D9F0CA;
  text-align: center;
  font-size: .9rem;
}
.hint-text { font-size: .72rem; color: #888; font-style: italic; }

/* ══ PRODUCT BLOCK (form) ════════════════════ */
.product-block { transition: box-shadow .2s; }
.product-block:focus-within { box-shadow: 0 4px 18px rgba(126,216,87,.2); }

/* ══ RATE BOXES (companies page) ═════════════ */
.rate-box {
  background: #F8FAFC;
  border: 1px solid #E4EDE4;
  border-radius: 8px;
  padding: 9px 6px;
  text-align: center;
}
.rate-label { font-size: .67rem; color: #888; margin-bottom: 3px; line-height: 1.3; }
.rate-value { font-size: .95rem; font-weight: 700; color: #0E1E0C; }

/* ══ BUTTONS ═════════════════════════════════ */
.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: #0E2208;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: white;
}
.btn-outline-primary { border-color: var(--green); color: var(--green-dark); }
.btn-outline-primary:hover { background: var(--green); color: #0E2208; }

/* ══ ALERTS ══════════════════════════════════ */
.alert { border-radius: var(--card-r); border: none; }
.alert-success { background: #ECFBD9; color: #1B5E20; }
.alert-danger   { background: #FFEBEE; color: #B71C1C; }
.alert-warning  { background: #FFF8E1; color: #7B6014; }

/* ══ INFO BOX ════════════════════════════════ */
.info-box {
  background: #ECFBD9;
  border-right: 4px solid var(--green);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: .84rem;
  color: #2D5A1A;
  margin-bottom: 18px;
}

/* ══ SIDEBAR SECTIONS ════════════════════════ */
.nav-section-label {
  font-size: .63rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  padding: 14px 18px 4px;
  font-weight: 600;
}
.nav-badge {
  margin-right: auto;
  background: var(--green);
  color: #0E2208;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}
.nav-badge-danger { background: #EF4444; color: white; }

/* ══ PIPELINE BADGES ══════════════════════════ */
.pipeline-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
  white-space: nowrap;
}
.ps-interested { background: #DBEAFE; color: #1D4ED8; }
.ps-scheduled  { background: #FEF3C7; color: #92400E; }
.ps-moved      { background: #FEE2E2; color: #B91C1C; }
.ps-done       { background: #DCFCE7; color: #166534; }
.ps-unknown    { background: #F3F4F6; color: #6B7280; }

/* ══ MEETING URGENCY TAGS ═════════════════════ */
.meeting-tag {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 20px;
  font-size: .78rem; font-weight: 500;
}
.meeting-overdue { background: #FEE2E2; color: #B91C1C; }
.meeting-today   { background: #FEF3C7; color: #92400E; }
.meeting-soon    { background: #FFF7ED; color: #C2410C; }
.meeting-future  { background: #F0FBE6; color: #166534; }

/* ══ XS BUTTON ════════════════════════════════ */
.btn-xs {
  padding: 2px 7px; font-size: .75rem; border-radius: 5px;
}

/* ══ LEGEND BAR ══════════════════════════════ */
.legend-bar {
  display: flex;
  gap: 18px;
  font-size: .78rem;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 5px;
}

/* ══ ACTIVITY TIMELINE ════════════════════════ */
.timeline { position: relative; padding: 0 0 0 8px; }
.timeline::before {
  content: '';
  position: absolute; right: 15px; top: 0; bottom: 0;
  width: 2px; background: #E8EDF0;
}
.timeline-item {
  display: flex; gap: 14px;
  margin-bottom: 14px; align-items: flex-start;
  position: relative;
}
.timeline-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0; z-index: 1;
  font-size: .78rem; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.timeline-body {
  flex: 1; background: #FAFAFA;
  border-radius: 8px; padding: 8px 12px;
  border: 1px solid #F0F0F0; min-width: 0;
}
.timeline-body .tl-label {
  font-weight: 700; font-size: .8rem; color: #1A2B1A;
}
.timeline-body .tl-desc {
  font-size: .82rem; color: #444;
  white-space: pre-wrap; margin-top: 3px;
}
.timeline-body .tl-meta {
  font-size: .72rem; color: #9AA; margin-top: 4px;
}

/* client search autocomplete */
.client-ac-wrap { position: relative; }
.client-ac-list {
  position: absolute; top: 100%; right: 0; left: 0; z-index: 999;
  background: #fff; border: 1px solid #D1D5DB; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  max-height: 200px; overflow-y: auto;
}
.client-ac-item {
  padding: 8px 12px; cursor: pointer; font-size: .85rem;
  display: flex; justify-content: space-between; align-items: center;
}
.client-ac-item:hover { background: #F0FDF4; }
.client-ac-item .ac-phone { font-size: .75rem; color: #888; }
