// Variation 2: "Site Timeline" — Notion-inspired, calm, document-style, timeline-first
(function(){
const { useState } = React;

const V2Shell = ({ children, onNav, onBack, title, subtitle, right, active }) => (
  <div style={{
    background: '#faf9f6', minHeight: '100%', fontFamily: 'Assistant, sans-serif',
    color: '#2a2a2a', direction: 'rtl',
  }}>
    <div style={{ display: 'grid', gridTemplateColumns: '260px 1fr', minHeight: '100vh' }}>
      <aside style={{ background: '#f2f0ea', padding: '24px 18px', borderLeft: '1px solid #e8e5dc' }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 28 }}>
          <div style={{ width: 30, height: 30, borderRadius: 6, background: '#1a2c4a', color: '#fff',
            display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'Playfair Display, serif', fontWeight: 700, fontSize: 13 }}>YBP</div>
          <div>
            <div style={{ fontSize: 13, fontWeight: 600 }}>YBPROJECTS</div>
            <div style={{ fontSize: 10.5, color: '#7c7669' }}>סביבת עבודה</div>
          </div>
        </div>
        <div style={{ fontSize: 10.5, color: '#9a9481', fontWeight: 600, textTransform: 'uppercase', letterSpacing: 0.5, marginBottom: 8, paddingRight: 6 }}>ניווט</div>
        {[
          { k: 'home', icon: 'home', label: 'בית' },
          { k: 'projects', icon: 'briefcase', label: 'פרויקטים' },
          { k: 'calendar', icon: 'calendar', label: 'לוח זמנים' },
          { k: 'team', icon: 'users', label: 'צוות' },
        ].map(item => (
          <button key={item.k} onClick={() => onNav && onNav(item.k)} style={{
            display: 'flex', alignItems: 'center', gap: 10, padding: '7px 8px', width: '100%',
            background: active === item.k ? '#e8e5dc' : 'transparent', border: 'none', borderRadius: 5,
            fontSize: 13.5, color: '#2a2a2a', cursor: 'pointer', fontFamily: 'inherit', marginBottom: 2,
          }}>
            <Icon name={item.icon} size={16} color="#5a5548"/>
            <span>{item.label}</span>
          </button>
        ))}
        <div style={{ fontSize: 10.5, color: '#9a9481', fontWeight: 600, textTransform: 'uppercase', letterSpacing: 0.5, margin: '24px 0 8px', paddingRight: 6 }}>פרויקטים פעילים</div>
        {YBP_DATA.projects.filter(p => p.status !== 'done').slice(0, 4).map(p => (
          <button key={p.id} style={{
            display: 'flex', alignItems: 'center', gap: 10, padding: '7px 8px', width: '100%',
            background: 'transparent', border: 'none', borderRadius: 5,
            fontSize: 12.5, color: '#4a4536', cursor: 'pointer', fontFamily: 'inherit',
            textAlign: 'right',
          }}>
            <ProjectPlaceholder kind={p.cover} style={{ width: 18, height: 18, borderRadius: 4 }}/>
            <span style={{ flex: 1, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{p.name}</span>
          </button>
        ))}
      </aside>

      <main style={{ overflow: 'auto' }}>
        <div style={{ padding: '30px 56px 60px', maxWidth: 1080, margin: '0 auto' }}>
          {onBack && (
            <button onClick={onBack} style={{
              background: 'transparent', border: 'none', padding: '4px 0', cursor: 'pointer',
              color: '#7c7669', fontSize: 12.5, fontFamily: 'inherit', marginBottom: 12,
              display: 'flex', alignItems: 'center', gap: 6,
            }}>
              <Icon name="chevron" size={13}/>
              חזרה לפרויקטים
            </button>
          )}
          <div style={{ display: 'flex', alignItems: 'flex-start', gap: 20 }}>
            <div style={{ flex: 1 }}>
              <h1 style={{ margin: 0, fontFamily: 'Playfair Display, serif', fontSize: 38, fontWeight: 700, letterSpacing: -0.8, lineHeight: 1.1 }}>{title}</h1>
              {subtitle && <div style={{ marginTop: 8, fontSize: 14, color: '#7c7669' }}>{subtitle}</div>}
            </div>
            {right}
          </div>
          {children}
        </div>
      </main>
    </div>
  </div>
);

const V2ProjectsList = ({ onOpenProject }) => {
  const projects = YBP_DATA.projects;
  return (
    <V2Shell
      active="projects"
      onNav={() => {}}
      title="הפרויקטים"
      subtitle={`${projects.length} פרויקטים • מסעדות, משרדים, מסחרי`}
      right={
        <button style={{
          background: '#1a2c4a', color: '#fff', border: 'none',
          padding: '10px 16px', borderRadius: 6, fontSize: 13, fontWeight: 600, cursor: 'pointer',
          display: 'flex', alignItems: 'center', gap: 6, fontFamily: 'inherit',
        }}>
          <Icon name="plus" size={14}/>
          פרויקט חדש
        </button>
      }
    >
      <div style={{ marginTop: 32, display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 16 }}>
        {projects.map(p => (
          <div key={p.id} onClick={() => onOpenProject(p.id)} style={{
            background: '#fff', border: '1px solid #e8e5dc', borderRadius: 10,
            overflow: 'hidden', cursor: 'pointer', transition: 'transform 0.15s, box-shadow 0.15s',
          }}
          onMouseEnter={e => { e.currentTarget.style.transform = 'translateY(-2px)'; e.currentTarget.style.boxShadow = '0 6px 20px rgba(0,0,0,0.06)'; }}
          onMouseLeave={e => { e.currentTarget.style.transform = 'translateY(0)'; e.currentTarget.style.boxShadow = 'none'; }}>
            <ProjectPlaceholder kind={p.cover} style={{ height: 120 }} label={p.type.toUpperCase()}/>
            <div style={{ padding: 18 }}>
              <div style={{ display: 'flex', alignItems: 'flex-start', gap: 10, marginBottom: 10 }}>
                <div style={{ flex: 1 }}>
                  <div style={{ fontFamily: 'Playfair Display, serif', fontSize: 18, fontWeight: 700, letterSpacing: -0.3 }}>{p.name}</div>
                  <div style={{ fontSize: 12.5, color: '#7c7669', marginTop: 2 }}>{p.client}</div>
                </div>
                <V1StatusChip status={p.status} label={p.statusLabel}/>
              </div>
              <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 14 }}>
                <div style={{ flex: 1, height: 4, background: '#f0ede4', borderRadius: 2, overflow: 'hidden' }}>
                  <div style={{ height: '100%', width: `${p.progress}%`, background: '#1a2c4a' }}/>
                </div>
                <span style={{ fontSize: 12, fontWeight: 600 }}>{p.progress}%</span>
              </div>
              <div style={{ display: 'flex', gap: 14, marginTop: 14, fontSize: 11.5, color: '#7c7669' }}>
                <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}><Icon name="calendar" size={12}/>{p.daysLeft === 0 ? 'הושלם' : p.daysLeft + ' ימים'}</div>
                <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}><Icon name="users" size={12}/>{p.team}</div>
                <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}><Icon name="dollar" size={12}/>{fmtMoney(p.budget)}</div>
                {p.openIssues > 0 && <div style={{ marginRight: 'auto', display: 'flex', alignItems: 'center', gap: 4, color: '#b45309' }}><Icon name="alert" size={12}/>{p.openIssues}</div>}
              </div>
            </div>
          </div>
        ))}
      </div>
    </V2Shell>
  );
};

const V2ProjectDetail = ({ projectId, onBack, onOpenClient }) => {
  const project = YBP_DATA.projects.find(p => p.id === projectId) || YBP_DATA.projects[0];
  const detail = YBP_DATA.projectDetail;

  return (
    <V2Shell
      active="projects"
      onNav={() => {}}
      onBack={onBack}
      title={project.name}
      subtitle={`${project.client} • ${project.address}`}
      right={
        <div style={{ display: 'flex', gap: 8 }}>
          <button onClick={onOpenClient} style={{
            background: '#fff', border: '1px solid #e8e5dc', color: '#2a2a2a',
            padding: '8px 14px', borderRadius: 6, fontSize: 13, cursor: 'pointer', fontFamily: 'inherit',
          }}>מסך לקוח</button>
          <button style={{
            background: '#1a2c4a', color: '#fff', border: 'none',
            padding: '8px 14px', borderRadius: 6, fontSize: 13, fontWeight: 600, cursor: 'pointer',
            display: 'flex', alignItems: 'center', gap: 6, fontFamily: 'inherit',
          }}>
            <Icon name="plus" size={13}/>
            עדכון
          </button>
        </div>
      }
    >
      {/* Meta row */}
      <div style={{ marginTop: 24, display: 'flex', gap: 28, padding: '16px 0', borderTop: '1px solid #e8e5dc', borderBottom: '1px solid #e8e5dc' }}>
        {[
          ['סטטוס', <V1StatusChip status={project.status} label={project.statusLabel}/>],
          ['התקדמות', `${project.progress}%`],
          ['תקציב', `${fmtMoney(project.spent)} / ${fmtMoney(project.budget)}`],
          ['ימים שנותרו', project.daysLeft],
          ['אבן דרך', project.nextMilestone],
        ].map(([label, val], i) => (
          <div key={i}>
            <div style={{ fontSize: 11, color: '#9a9481', fontWeight: 600, textTransform: 'uppercase', letterSpacing: 0.3, marginBottom: 4 }}>{label}</div>
            <div style={{ fontSize: 14, fontWeight: 600 }}>{val}</div>
          </div>
        ))}
      </div>

      {/* Timeline section */}
      <section style={{ marginTop: 40 }}>
        <h2 style={{ fontFamily: 'Playfair Display, serif', fontSize: 24, fontWeight: 700, marginBottom: 20, letterSpacing: -0.5 }}>ציר הזמן של הפרויקט</h2>
        <div style={{ position: 'relative', paddingRight: 22 }}>
          <div style={{ position: 'absolute', right: 10, top: 10, bottom: 10, width: 2, background: '#e8e5dc' }}/>
          {project.phases.map((ph, i) => (
            <div key={i} style={{ position: 'relative', paddingBottom: 24, paddingRight: 24 }}>
              <div style={{
                position: 'absolute', right: 4, top: 6, width: 14, height: 14, borderRadius: 7,
                background: ph.status === 'done' ? '#1a2c4a' : ph.status === 'active' ? '#fff' : '#f0ede4',
                border: ph.status === 'active' ? '3px solid #1a2c4a' : '2px solid #e8e5dc',
                boxSizing: 'border-box',
              }}/>
              <div style={{
                background: '#fff', border: '1px solid #e8e5dc', borderRadius: 8, padding: 16,
              }}>
                <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 6 }}>
                  <div style={{ fontFamily: 'Playfair Display, serif', fontSize: 17, fontWeight: 700 }}>{ph.name}</div>
                  <span style={{ marginRight: 'auto', fontSize: 12, color: '#7c7669' }}>{ph.progress}%</span>
                </div>
                <div style={{ height: 4, background: '#f0ede4', borderRadius: 2, overflow: 'hidden' }}>
                  <div style={{ height: '100%', width: `${ph.progress}%`, background: ph.status === 'done' ? '#10b981' : '#1a2c4a' }}/>
                </div>
                {ph.status === 'active' && (
                  <div style={{ marginTop: 12, display: 'flex', gap: 8, flexWrap: 'wrap' }}>
                    {detail.tasks.filter(t => t.phase === ph.name.split(' ')[0] || ph.name.includes(t.phase)).slice(0, 3).map(t => (
                      <div key={t.id} style={{
                        display: 'flex', alignItems: 'center', gap: 6, background: '#faf9f6',
                        padding: '5px 10px', borderRadius: 4, fontSize: 11.5,
                      }}>
                        <Avatar name={t.assignee} size={16}/>
                        {t.title}
                      </div>
                    ))}
                  </div>
                )}
              </div>
            </div>
          ))}
        </div>
      </section>

      {/* Two col: tasks + updates */}
      <section style={{ marginTop: 40, display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24 }}>
        <div>
          <h2 style={{ fontFamily: 'Playfair Display, serif', fontSize: 22, fontWeight: 700, marginBottom: 14, letterSpacing: -0.3 }}>משימות פתוחות</h2>
          <div style={{ background: '#fff', border: '1px solid #e8e5dc', borderRadius: 8, overflow: 'hidden' }}>
            {detail.tasks.filter(t => t.status !== 'done').slice(0, 6).map((t, i) => (
              <div key={t.id} style={{
                display: 'flex', alignItems: 'center', gap: 12, padding: '12px 14px',
                borderTop: i > 0 ? '1px solid #f2f0ea' : 'none',
              }}>
                <div style={{
                  width: 16, height: 16, borderRadius: 8,
                  border: '2px solid ' + (t.status === 'blocked' ? '#ef4444' : t.status === 'in-progress' ? '#3b82f6' : '#d4cfbf'),
                  background: t.status === 'in-progress' ? '#3b82f6' : 'transparent',
                }}/>
                <div style={{ flex: 1, fontSize: 13, fontWeight: 500 }}>{t.title}</div>
                <Avatar name={t.assignee} size={22}/>
                <span style={{ fontSize: 11, color: '#7c7669' }}>{t.due.slice(5)}</span>
              </div>
            ))}
          </div>
        </div>
        <div>
          <h2 style={{ fontFamily: 'Playfair Display, serif', fontSize: 22, fontWeight: 700, marginBottom: 14, letterSpacing: -0.3 }}>יומן פרויקט</h2>
          {detail.updates.slice(0, 4).map(u => (
            <div key={u.id} style={{
              background: '#fff', border: '1px solid #e8e5dc', borderRadius: 8, padding: 14, marginBottom: 10,
            }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 6 }}>
                <Avatar name={u.author} size={22}/>
                <span style={{ fontSize: 12, fontWeight: 600 }}>{u.author}</span>
                <span style={{ fontSize: 11, color: '#9a9481', marginRight: 'auto' }}>{u.time}</span>
              </div>
              <div style={{ fontSize: 13, lineHeight: 1.4 }}>{u.text}</div>
            </div>
          ))}
        </div>
      </section>

      {/* Docs */}
      <section style={{ marginTop: 40 }}>
        <h2 style={{ fontFamily: 'Playfair Display, serif', fontSize: 22, fontWeight: 700, marginBottom: 14, letterSpacing: -0.3 }}>מסמכים</h2>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 10 }}>
          {detail.documents.map(d => (
            <div key={d.id} style={{ background: '#fff', border: '1px solid #e8e5dc', borderRadius: 8, padding: 14, display: 'flex', gap: 10, cursor: 'pointer' }}>
              <div style={{ fontSize: 10, fontWeight: 700, color: '#1a2c4a', padding: '6px 8px', background: '#f0ede4', borderRadius: 4, alignSelf: 'flex-start' }}>
                {d.type === 'folder' ? <Icon name="folder" size={14}/> : d.type.toUpperCase()}
              </div>
              <div style={{ minWidth: 0 }}>
                <div style={{ fontSize: 13, fontWeight: 600, lineHeight: 1.3 }}>{d.name}</div>
                <div style={{ fontSize: 11, color: '#9a9481', marginTop: 2 }}>{d.updated.slice(5)} • {d.size}</div>
              </div>
            </div>
          ))}
        </div>
      </section>
    </V2Shell>
  );
};

const V2ClientView = ({ projectId, onBack, onOpenBudget }) => {
  const { useState: useLocalState } = React;
  const [showBudgetDetail, setShowBudgetDetail] = React.useState(false);
  const project = YBP_DATA.projects.find(p => p.id === projectId) || YBP_DATA.projects[0];
  const detail = YBP_DATA.projectDetail;
  return (
    <div style={{ background: '#faf9f6', minHeight: '100%', fontFamily: 'Assistant, sans-serif', color: '#2a2a2a', direction: 'rtl' }}>
      <header style={{ padding: '16px 32px', borderBottom: '1px solid #e8e5dc', display: 'flex', alignItems: 'center', gap: 14, background: '#fff' }}>
        <button onClick={onBack} style={{ background: 'transparent', border: 'none', padding: 6, cursor: 'pointer', color: '#7c7669' }}><Icon name="chevron" size={16}/></button>
        <div style={{ width: 30, height: 30, borderRadius: 6, background: '#1a2c4a', color: '#fff',
          display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'Playfair Display, serif', fontWeight: 700, fontSize: 13 }}>YBP</div>
        <div style={{ fontSize: 12.5, color: '#7c7669' }}>פורטל לקוחות • {project.client}</div>
      </header>

      <div style={{ maxWidth: 780, margin: '0 auto', padding: '48px 32px' }}>
        <div style={{ fontSize: 12, color: '#9a9481', fontWeight: 600, textTransform: 'uppercase', letterSpacing: 0.8 }}>דוח סטטוס שבועי</div>
        <h1 style={{ fontFamily: 'Playfair Display, serif', fontSize: 42, fontWeight: 700, letterSpacing: -1, marginTop: 6, lineHeight: 1.1 }}>{project.name}</h1>
        <div style={{ fontSize: 14, color: '#7c7669', marginTop: 8 }}>{project.address} • עדכון ל-{new Date().toLocaleDateString('he-IL')}</div>

        <ProjectPlaceholder kind={project.cover} style={{ marginTop: 32, height: 240, borderRadius: 10 }} label="PROGRESS PHOTO"/>

        <div style={{ marginTop: 32, display: 'flex', alignItems: 'baseline', gap: 20 }}>
          <div style={{ fontFamily: 'Playfair Display, serif', fontSize: 88, fontWeight: 700, letterSpacing: -3, lineHeight: 1, color: '#1a2c4a' }}>{project.progress}<span style={{ fontSize: 40 }}>%</span></div>
          <div style={{ flex: 1 }}>
            <div style={{ fontSize: 15, fontWeight: 600 }}>הפרויקט מתקדם לפי לוח הזמנים</div>
            <div style={{ fontSize: 13, color: '#7c7669', marginTop: 4 }}>מתוכנן להסתיים בתאריך {project.endDate} — נותרו {project.daysLeft} ימים</div>
          </div>
        </div>

        <div style={{ marginTop: 40 }}>
          <h2 style={{ fontFamily: 'Playfair Display, serif', fontSize: 24, fontWeight: 700, letterSpacing: -0.5, marginBottom: 16 }}>איפה אנחנו בפרויקט</h2>
          {project.phases.map((ph, i) => (
            <div key={i} style={{ display: 'flex', alignItems: 'center', gap: 16, padding: '14px 0', borderTop: i > 0 ? '1px solid #e8e5dc' : 'none' }}>
              <div style={{ width: 28, height: 28, borderRadius: 14, background: ph.status === 'done' ? '#1a2c4a' : ph.status === 'active' ? '#fff' : '#f0ede4',
                border: ph.status === 'active' ? '2px solid #1a2c4a' : 'none',
                display: 'flex', alignItems: 'center', justifyContent: 'center', color: ph.status === 'done' ? '#fff' : '#1a2c4a', fontSize: 12, fontWeight: 700 }}>
                {ph.status === 'done' ? <Icon name="check" size={13} color="#fff" strokeWidth={3}/> : i + 1}
              </div>
              <div style={{ flex: 1, fontSize: 15, fontWeight: ph.status === 'active' ? 600 : 500 }}>{ph.name}</div>
              <div style={{ fontSize: 13, color: ph.status === 'done' ? '#047857' : ph.status === 'active' ? '#1d4ed8' : '#9a9481', fontWeight: 600 }}>
                {ph.status === 'done' ? 'הושלם ✓' : ph.status === 'active' ? ph.progress + '%' : 'ממתין'}
              </div>
            </div>
          ))}
        </div>

        <div style={{ marginTop: 40 }}>
          <h2 style={{ fontFamily: 'Playfair Display, serif', fontSize: 24, fontWeight: 700, letterSpacing: -0.5, marginBottom: 16 }}>ממה אנחנו עסוקים השבוע</h2>
          {detail.updates.slice(0, 3).map(u => (
            <div key={u.id} style={{ padding: '14px 0', borderTop: '1px solid #e8e5dc', fontSize: 14, lineHeight: 1.5 }}>
              <div style={{ fontSize: 11, color: '#9a9481', marginBottom: 4 }}>{u.time} • צוות {u.team}</div>
              {u.text}
            </div>
          ))}
        </div>

        {/* Budget summary for client */}
        <div style={{ marginTop: 40 }}>
          <h2 style={{ fontFamily: 'Playfair Display, serif', fontSize: 24, fontWeight: 700, letterSpacing: -0.5, marginBottom: 16 }}>סיכום תקציב</h2>
          <div style={{ background: '#fff', border: '1px solid #e8e5dc', borderRadius: 10, padding: 24 }}>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 20, marginBottom: 20 }}>
              {[
                { label: 'אומדן תקציב', value: project.budget, color: '#1a2c4a' },
                { label: 'הצעות מחיר', value: project.spent, color: '#d97706' },
                { label: 'עלות בפועל', value: project.budget - project.spent, color: project.budget - project.spent < 0 ? '#dc2626' : '#047857' },
              ].map(({ label, value, color }) => (
                <div key={label} style={{ textAlign: 'center' }}>
                  <div style={{ fontSize: 11, color: '#9a9481', fontWeight: 600, textTransform: 'uppercase', letterSpacing: 0.5, marginBottom: 6 }}>{label}</div>
                  <div style={{ fontFamily: 'Playfair Display, serif', fontSize: 28, fontWeight: 700, color, letterSpacing: -0.5 }}>
                    {value.toLocaleString('he-IL')} ₪
                  </div>
                </div>
              ))}
            </div>
            <div style={{ height: 8, background: '#f0ede4', borderRadius: 4, overflow: 'hidden' }}>
              <div style={{
                height: '100%',
                width: `${project.budget > 0 ? Math.min(100, (project.spent / project.budget) * 100) : 0}%`,
                background: project.spent > project.budget ? '#dc2626' : '#1a2c4a',
                borderRadius: 4,
              }}/>
            </div>
            <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 6, fontSize: 11, color: '#9a9481' }}>
              <span>0</span>
              <span style={{ fontWeight: 600, color: '#1a2c4a' }}>{project.budget > 0 ? Math.round((project.spent/project.budget)*100) : 0}% נוצל</span>
              <span>{project.budget.toLocaleString('he-IL')} ₪</span>
            </div>
            <div style={{ marginTop: 16, textAlign: 'center' }}>
              <button onClick={() => setShowBudgetDetail(!showBudgetDetail)} style={{
                background: 'transparent', border: '1px solid #e8e5dc', color: '#1a2c4a',
                padding: '8px 20px', borderRadius: 6, fontSize: 13, fontWeight: 600,
                cursor: 'pointer', fontFamily: 'inherit',
              }}>
                {showBudgetDetail ? '▲ הסתר פירוט' : '▼ הצג פירוט תקציב'}
              </button>
            </div>
            {showBudgetDetail && (
              <div style={{ marginTop: 16, borderTop: '1px solid #e8e5dc', paddingTop: 16 }}>
                {(() => {
                  const budgetData = (() => {
                    try {
                      return JSON.parse(localStorage.getItem('ybp_budget_' + projectId));
                    } catch(e) { return null; }
                  })();
                  if (!budgetData) return (
                    <div style={{ fontSize: 13, color: '#9a9481', textAlign: 'center', padding: '20px 0' }}>
                      פירוט תקציב יהיה זמין לאחר עדכון ראשוני מהצוות.
                    </div>
                  );
                  return budgetData.sections.map(s => {
                    const total = s.items.reduce((acc, it) => ({
                      estimate: acc.estimate + (Number(it.estimate)||0),
                      offer: acc.offer + (Number(it.offer)||0),
                      actual: acc.actual + (Number(it.actual)||0),
                    }), {estimate:0, offer:0, actual:0});
                    if (total.estimate === 0 && total.offer === 0 && total.actual === 0) return null;
                    return (
                      <div key={s.id} style={{ display: 'flex', alignItems: 'center', gap: 14, padding: '10px 0', borderBottom: '1px solid #f0ede4', fontSize: 13 }}>
                        <span style={{ fontSize: 18 }}>{s.icon}</span>
                        <span style={{ flex: 1, fontWeight: 600, color: '#1a2c4a' }}>{s.name}</span>
                        {total.estimate > 0 && <span style={{ color: '#9a9481' }}>א׳ {total.estimate.toLocaleString('he-IL')}</span>}
                        {total.offer > 0 && <span style={{ color: '#1a2c4a' }}>הצ׳ {total.offer.toLocaleString('he-IL')}</span>}
                        {total.actual > 0 && <span style={{ color: '#047857', fontWeight: 700 }}>פ׳ {total.actual.toLocaleString('he-IL')}</span>}
                      </div>
                    );
                  });
                })()}
              </div>
            )}
          </div>
        </div>

        <div style={{ marginTop: 48, padding: 24, background: '#1a2c4a', color: '#fff', borderRadius: 12, display: 'flex', alignItems: 'center', gap: 16 }}>
          <Avatar name={YBP_DATA.user.name} size={48}/>
          <div style={{ flex: 1 }}>
            <div style={{ fontSize: 11, opacity: 0.7, textTransform: 'uppercase', letterSpacing: 0.5 }}>מנהל הפרויקט</div>
            <div style={{ fontSize: 16, fontWeight: 700, marginTop: 2 }}>{YBP_DATA.user.name}</div>
          </div>
          <button style={{ background: '#fff', color: '#1a2c4a', border: 'none', padding: '10px 16px', borderRadius: 6, fontSize: 13, fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit' }}>שלח הודעה</button>
        </div>
      </div>
    </div>
  );
};

Object.assign(window, { V2ProjectsList, V2ProjectDetail, V2ClientView });
})();
