:root{
--navy:#0f2744;--navy-soft:#1c3556;--navy-deep:#08152a;
--gold:#c9a227;--gold-soft:#e3c25a;--gold-deep:#a8841a;
--offwhite:#faf8f5;
--ink:#1a1a1a;--muted:#6b6f78;--line:#e6e3dc;
--bubble-user-bg:#0f2744;--bubble-user-ink:#faf8f5;
--bubble-ai-bg:#ffffff;--bubble-ai-ink:#1a1a1a;--bubble-ai-border:#e6e3dc;
--bubble-sim-bg:#fff8e6;--bubble-sim-ink:#1a1a1a;--bubble-sim-border:#c9a227;
--danger:#b3261e;
--shadow-sm:0 2px 8px rgba(15,39,68,.06);
--shadow-md:0 8px 24px rgba(15,39,68,.10);
--shadow-lg:0 20px 50px rgba(15,39,68,.18);
--radius:14px;--radius-sm:10px;
--chat-height:600px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--offwhite)}
body{font-family:'Heebo',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:var(--ink);font-size:16px;line-height:1.55;-webkit-font-smoothing:antialiased}
body[lang="en"]{font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}
.app{max-width:880px;margin:0 auto;background:var(--offwhite)}
/* LANDING */
.landing{display:flex;flex-direction:column;background:linear-gradient(180deg,#fff 0%,var(--offwhite) 100%)}
.app.chat-mode .landing{display:none}
.landing-topbar{display:flex;justify-content:space-between;align-items:center;padding:14px 24px;background:var(--navy);color:var(--offwhite);box-shadow:var(--shadow-sm)}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.brand-mark{width:32px;height:32px;border-radius:8px;background:var(--gold);color:var(--navy);display:grid;place-items:center;font-weight:700;font-size:13px;letter-spacing:.5px;flex-shrink:0}
.brand-title{display:flex;flex-direction:column;min-width:0}
.brand-name{font-weight:600;font-size:14px;letter-spacing:.2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-sub{font-size:11px;color:#c8d0dc;font-weight:400}
.lang-toggle{display:flex;background:rgba(250,248,245,.08);border-radius:8px;padding:2px;border:1px solid rgba(250,248,245,.12)}
.lang-toggle button{background:transparent;color:var(--offwhite);border:none;padding:5px 10px;font-size:12px;cursor:pointer;border-radius:6px;font-family:inherit;font-weight:500;min-width:32px}
.lang-toggle button.active{background:var(--gold);color:var(--navy)}
.hero{padding:44px 28px 24px;text-align:center;max-width:680px;margin:0 auto;width:100%}
.hero-mark{width:72px;height:72px;border-radius:16px;background:var(--navy);color:var(--gold);display:grid;place-items:center;font-weight:800;font-size:28px;letter-spacing:1px;margin:0 auto 22px;box-shadow:var(--shadow-md)}
.hero h1{margin:0 0 12px;font-size:30px;font-weight:700;line-height:1.2;color:var(--navy);letter-spacing:-.3px}
.hero .subhead{margin:0 0 28px;font-size:16px;color:var(--muted);line-height:1.6;max-width:520px;margin-inline:auto}
.hero .subhead strong{color:var(--navy);font-weight:600}
/* 3 main categories on landing */
.categories{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;max-width:720px;margin:0 auto 28px;padding:0 24px}
.cat{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:20px 16px;text-align:center;box-shadow:var(--shadow-sm)}
.cat-icon{width:44px;height:44px;border-radius:10px;background:var(--navy);color:var(--gold);display:grid;place-items:center;margin:0 auto 12px}
.cat-icon svg{width:22px;height:22px}
.cat-title{font-size:14px;font-weight:600;color:var(--navy);margin:0 0 4px}
.cat-desc{font-size:12px;color:var(--muted);line-height:1.5;margin:0}
/* ============ LIS ZONES (LLM Indexing Summary) ============ */
.lis-section{max-width:720px;margin:0 auto 28px;padding:0 24px}
.lis-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:22px 24px;box-shadow:var(--shadow-sm)}
.lis-card-title{font-size:14px;font-weight:600;color:var(--navy);text-transform:uppercase;letter-spacing:.5px;margin:0 0 14px;display:flex;align-items:center;gap:8px}
.lis-card-title::before{content:"";width:4px;height:14px;background:var(--gold);border-radius:2px;display:inline-block}
.key-facts{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin:0 0 18px}
.key-fact{display:flex;align-items:flex-start;gap:8px;padding:10px 12px;background:var(--offwhite);border-radius:var(--radius-sm);font-size:13px;color:var(--ink);line-height:1.5;border:1px solid var(--line)}
.key-fact::before{content:"";flex-shrink:0;width:6px;height:6px;border-radius:50%;background:var(--gold);margin-top:7px}
.workshop-summary{font-size:14px;color:var(--ink);line-height:1.7;margin:0;padding-top:14px;border-top:1px solid var(--line)}
.workshop-summary a{color:var(--navy);font-weight:600;text-decoration:underline;text-decoration-color:var(--gold);text-underline-offset:3px}
.workshop-summary a:hover{color:var(--gold-deep)}
/* Internal links block (in splash-foot + welcome) */
.internal-links{margin-top:10px;padding-top:10px;border-top:1px solid var(--line);font-size:11px;color:var(--muted);line-height:1.6;text-align:center}
.internal-links a{color:var(--navy);font-weight:500;text-decoration:none;border-bottom:1px solid var(--gold)}
.internal-links a:hover{color:var(--gold-deep)}
.welcome-internal-links{margin-top:14px;padding:10px 12px;background:var(--offwhite);border:1px solid var(--line);border-radius:var(--radius-sm);font-size:12px;color:var(--muted);line-height:1.6;text-align:center}
.welcome-internal-links a{color:var(--navy);font-weight:500;text-decoration:none;border-bottom:1px solid var(--gold)}
.welcome-internal-links a:hover{color:var(--gold-deep)}
.splash-card{max-width:440px;width:calc(100% - 48px);margin:0 auto 40px;background:#fff;border-radius:var(--radius);box-shadow:var(--shadow-lg);padding:30px 28px;border:1px solid var(--line)}
.splash-card-title{font-size:18px;font-weight:600;color:var(--navy);margin:0 0 6px;text-align:center}
.splash-card-sub{font-size:13px;color:var(--muted);margin:0 0 22px;text-align:center}
.field{margin-bottom:16px}
.field label{display:block;font-size:13px;font-weight:500;color:var(--navy);margin-bottom:6px}
.field input{width:100%;padding:12px 14px;border:1px solid var(--line);border-radius:var(--radius-sm);font-size:15px;font-family:inherit;background:#fff;color:var(--ink);transition:border-color .15s,box-shadow .15s}
.field input:focus{outline:none;border-color:var(--gold);box-shadow:0 0 0 3px rgba(201,162,39,.15)}
.btn-primary{width:100%;padding:13px 16px;background:var(--gold);color:var(--navy);border:none;border-radius:var(--radius-sm);font-family:inherit;font-size:15px;font-weight:600;cursor:pointer;transition:all .15s;letter-spacing:.2px}
.btn-primary:hover:not(:disabled){background:var(--gold-soft);transform:translateY(-1px)}
.btn-primary:disabled{opacity:.55;cursor:not-allowed}
.splash-error{margin-top:12px;padding:10px 12px;background:#fdecea;border:1px solid #f5c2c0;border-radius:var(--radius-sm);color:var(--danger);font-size:13px;display:none;word-break:break-word}
.splash-error.show{display:block}
.splash-foot{margin-top:20px;padding-top:14px;border-top:1px solid var(--line);font-size:11px;color:var(--muted);line-height:1.55;text-align:center}
/* CHAT CONTAINER */
.chat-container{display:none;flex-direction:column;height:var(--chat-height);max-height:none;background:var(--offwhite);border-radius:var(--radius);overflow:hidden;margin:12px auto;max-width:880px;width:100%;box-shadow:var(--shadow-lg);border:1px solid var(--line)}
.app.chat-mode .chat-container{display:flex}
.chat-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 20px;background:var(--navy);color:var(--offwhite);flex-shrink:0}
.chat-header .brand-mark{width:36px;height:36px;font-size:15px}
.chat-header .brand-name{font-size:15px}
.chat-header .brand-sub{font-size:12px}
.header-actions{display:flex;gap:8px;align-items:center}
.icon-btn{background:transparent;color:var(--offwhite);border:1px solid rgba(250,248,245,.18);border-radius:8px;padding:7px 12px;font-size:13px;font-weight:500;cursor:pointer;transition:all .15s;font-family:inherit}
.icon-btn:hover{background:rgba(250,248,245,.08);border-color:rgba(250,248,245,.32)}
/* MODE BANNER */
.mode-banner{display:none;background:var(--gold);color:var(--navy);padding:10px 18px;font-size:13px;font-weight:600;flex-shrink:0;border-bottom:2px solid var(--gold-deep);align-items:center;justify-content:space-between;gap:12px}
.mode-banner.show{display:flex}
.mode-banner-text{flex:1;display:flex;align-items:center;gap:8px}
.mode-banner-text svg{width:16px;height:16px;flex-shrink:0}
.mode-end-btn{background:var(--navy);color:var(--gold);border:none;border-radius:8px;padding:6px 14px;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit;transition:all .15s;white-space:nowrap}
.mode-end-btn:hover{background:var(--navy-soft)}
.mode-end-btn:disabled{opacity:.5;cursor:not-allowed}
.chat{flex:1 1 0;overflow-y:auto;padding:20px 18px 8px;scroll-behavior:smooth;min-height:0;background:var(--offwhite)}
.messages{display:flex;flex-direction:column;gap:12px;max-width:760px;margin:0 auto}
.msg{display:flex;flex-direction:column;max-width:85%;animation:fadeIn .25s ease-out}
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
.msg.user{align-self:flex-end;align-items:flex-end}
.msg.assistant{align-self:flex-start;align-items:flex-start}
.bubble{padding:11px 15px;border-radius:14px;font-size:14.5px;line-height:1.55;white-space:pre-wrap;word-wrap:break-word}
.msg.user .bubble{background:var(--bubble-user-bg);color:var(--bubble-user-ink);border-bottom-left-radius:4px}
body[dir="ltr"] .msg.user .bubble{border-bottom-left-radius:14px;border-bottom-right-radius:4px}
.msg.assistant .bubble{background:var(--bubble-ai-bg);color:var(--bubble-ai-ink);border:1px solid var(--bubble-ai-border);border-bottom-right-radius:4px}
body[dir="ltr"] .msg.assistant .bubble{border-bottom-right-radius:14px;border-bottom-left-radius:4px}
.msg.sim-character .bubble{background:var(--bubble-sim-bg);color:var(--bubble-sim-ink);border:2px solid var(--bubble-sim-border);border-bottom-right-radius:4px}
body[dir="ltr"] .msg.sim-character .bubble{border-bottom-right-radius:14px;border-bottom-left-radius:4px}
.sim-character-label{font-size:11px;font-weight:600;color:var(--gold-deep);margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px}
/* ============ DIAGNOSTIC CTA (additive) ============ */
.diag-cta{max-width:760px;margin:0 auto 4px;width:100%}
.diag-cta-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:16px 18px;box-shadow:var(--shadow-sm);animation:fadeIn .3s ease-out}
.diag-cta-head{display:flex;align-items:center;gap:10px;margin-bottom:8px}
.diag-cta-icon{width:34px;height:34px;border-radius:8px;background:var(--navy);color:var(--gold);display:grid;place-items:center;flex-shrink:0}
.diag-cta-icon svg{width:18px;height:18px}
.diag-cta-title{font-size:14.5px;font-weight:700;color:var(--navy);margin:0}
.diag-cta-desc{font-size:13px;color:var(--muted);line-height:1.55;margin:0 0 12px}
.diag-cta-btn{display:inline-flex;align-items:center;gap:8px;padding:10px 18px;background:var(--gold);color:var(--navy);border:none;border-radius:var(--radius-sm);font-family:inherit;font-size:14px;font-weight:600;cursor:pointer;transition:all .15s}
.diag-cta-btn:hover:not(:disabled){background:var(--gold-soft);transform:translateY(-1px)}
.diag-cta-btn:disabled{opacity:.55;cursor:not-allowed}
.diag-cta-btn svg{width:15px;height:15px}
body[dir="rtl"] .diag-cta-btn svg{transform:scaleX(-1)}
.composer-row.diag-mode{border-color:var(--navy);background:#fbfcfd}
/* WELCOME / HUB */
.welcome{max-width:760px;margin:0 auto 16px;padding:18px;background:#fff;border:1px solid var(--line);border-radius:var(--radius-sm);box-shadow:var(--shadow-sm)}
.welcome-title{font-size:16px;font-weight:600;color:var(--navy);margin:0 0 4px}
.welcome-sub{font-size:13px;color:var(--muted);margin:0 0 16px;line-height:1.55}
.hub-section{margin-bottom:14px;padding-bottom:14px;border-bottom:1px solid var(--line)}
.hub-section:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}
.hub-section-title{font-size:12px;font-weight:600;color:var(--navy);text-transform:uppercase;letter-spacing:.5px;margin:0 0 10px;display:flex;align-items:center;gap:6px}
.hub-section-title svg{width:14px;height:14px;color:var(--gold)}
.hub-btn{display:flex;align-items:center;gap:10px;padding:12px 14px;background:#fff;border:1px solid var(--line);border-radius:var(--radius-sm);cursor:pointer;transition:all .15s;font-family:inherit;text-align:right;width:100%;margin-bottom:8px}
body[dir="ltr"] .hub-btn{text-align:left}
.hub-btn:last-child{margin-bottom:0}
.hub-btn:hover{background:var(--navy);color:var(--offwhite);border-color:var(--navy);transform:translateY(-1px);box-shadow:var(--shadow-sm)}
.hub-btn:hover .hub-btn-title{color:var(--offwhite)}
.hub-btn:hover .hub-btn-desc{color:#c8d0dc}
.hub-btn:hover .hub-btn-icon{background:var(--gold);color:var(--navy)}
.hub-btn-icon{width:36px;height:36px;border-radius:8px;background:var(--navy);color:var(--gold);display:grid;place-items:center;flex-shrink:0;transition:all .15s}
.hub-btn-icon svg{width:18px;height:18px}
.hub-btn-text{flex:1;min-width:0}
.hub-btn-title{font-size:13.5px;font-weight:600;color:var(--navy);margin:0 0 2px;transition:color .15s}
.hub-btn-desc{font-size:11.5px;color:var(--muted);margin:0;line-height:1.4;transition:color .15s}
.hub-btn-arrow{flex-shrink:0;color:var(--muted);transition:transform .15s}
.hub-btn:hover .hub-btn-arrow{color:var(--gold)}
.hub-btn-arrow svg{width:14px;height:14px}
body[dir="rtl"] .hub-btn-arrow svg{transform:scaleX(-1)}
.sim-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px}
@media (max-width:560px){.sim-grid{grid-template-columns:1fr}}
.sim-grid .hub-btn{margin-bottom:0;flex-direction:column;text-align:center;align-items:center;gap:8px;padding:14px 10px}
body[dir="ltr"] .sim-grid .hub-btn{text-align:center}
.sim-grid .hub-btn-arrow{display:none}
.sim-grid .hub-btn-text{text-align:center}
.sim-grid .hub-btn-title{font-size:12.5px}
.sim-grid .hub-btn-desc{font-size:10.5px;line-height:1.4}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.chip{padding:6px 11px;background:var(--offwhite);border:1px solid var(--line);border-radius:16px;font-size:12px;font-family:inherit;color:var(--navy);cursor:pointer;transition:all .15s;font-weight:500}
.chip:hover{background:var(--navy);color:var(--offwhite);border-color:var(--navy)}
/* SIM SUMMARY */
.sim-summary-wrap{max-width:760px;margin:8px auto;width:100%}
.sim-summary{background:#fff;border:2px solid var(--gold);border-radius:var(--radius);padding:18px 20px;animation:fadeIn .3s ease-out}
.sim-summary-title{font-size:15px;font-weight:700;color:var(--navy);margin:0 0 12px;display:flex;align-items:center;gap:8px}
.sim-summary-title svg{width:20px;height:20px;color:var(--gold)}
.sim-summary-row{padding:8px 0;border-bottom:1px solid var(--line);font-size:13.5px}
.sim-summary-row:last-child{border-bottom:none}
.sim-summary-label{font-weight:600;color:var(--navy);margin-bottom:4px;font-size:12px;text-transform:uppercase;letter-spacing:.3px}
.sim-summary-value{color:var(--ink);line-height:1.5;white-space:pre-wrap}
.sim-score-big{font-size:28px;font-weight:700;color:var(--gold-deep);display:inline-block}
.sim-mako-reaction{background:var(--navy);color:var(--offwhite);padding:12px 14px;border-radius:var(--radius-sm);margin-top:12px;font-size:13.5px;line-height:1.55}
/* BRIEFING MODAL */
.modal-overlay{position:fixed;inset:0;background:rgba(15,39,68,.6);display:none;align-items:center;justify-content:center;z-index:1000;padding:16px}
.modal-overlay.show{display:flex}
.modal{background:#fff;border-radius:var(--radius);padding:24px;max-width:500px;width:100%;box-shadow:var(--shadow-lg);animation:fadeIn .2s ease-out;max-height:90vh;overflow-y:auto}
.modal-title{font-size:17px;font-weight:600;color:var(--navy);margin:0 0 6px}
.modal-sub{font-size:13px;color:var(--muted);margin:0 0 14px;line-height:1.5}
.role-toggle-label{font-size:12px;font-weight:600;color:var(--navy);text-transform:uppercase;letter-spacing:.5px;margin:14px 0 8px}
.role-toggle{display:flex;gap:6px;flex-wrap:wrap}
.role-toggle button{flex:1;min-width:120px;padding:9px 12px;border:1px solid var(--line);background:#fff;border-radius:var(--radius-sm);font-family:inherit;font-size:12.5px;font-weight:500;color:var(--ink);cursor:pointer;transition:all .15s}
.role-toggle button.active{background:var(--navy);color:var(--offwhite);border-color:var(--navy)}
.role-hint{font-size:12px;color:var(--muted);margin:8px 0 6px;font-style:italic;line-height:1.5}
.modal textarea{width:100%;padding:12px;border:1px solid var(--line);border-radius:var(--radius-sm);font-family:inherit;font-size:14px;resize:vertical;min-height:80px;color:var(--ink)}
.modal textarea:focus{outline:none;border-color:var(--gold);box-shadow:0 0 0 3px rgba(201,162,39,.15)}
.modal-actions{display:flex;gap:8px;margin-top:16px;justify-content:flex-end;flex-wrap:wrap}
.modal-btn{padding:10px 18px;border:1px solid var(--line);background:#fff;color:var(--navy);border-radius:var(--radius-sm);font-family:inherit;font-size:14px;font-weight:500;cursor:pointer;transition:all .15s}
.modal-btn:hover{background:var(--offwhite)}
.modal-btn.primary{background:var(--gold);color:var(--navy);border-color:var(--gold)}
.modal-btn.primary:hover{background:var(--gold-soft)}
.modal-btn.ghost{background:transparent;border-color:transparent;color:var(--muted)}
.modal-btn.ghost:hover{color:var(--ink)}
.typing{display:flex;align-self:flex-start;padding:12px 16px;background:#fff;border:1px solid var(--line);border-radius:14px;border-bottom-right-radius:4px;gap:4px}
body[dir="ltr"] .typing{border-bottom-right-radius:14px;border-bottom-left-radius:4px}
.typing.sim{background:var(--bubble-sim-bg);border-color:var(--gold);border-width:2px}
.typing span{width:6px;height:6px;background:var(--muted);border-radius:50%;animation:typingBounce 1.2s infinite ease-in-out}
.typing span:nth-child(2){animation-delay:.15s}
.typing span:nth-child(3){animation-delay:.3s}
@keyframes typingBounce{0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-5px);opacity:1}}
.composer{flex-shrink:0;background:var(--offwhite);border-top:1px solid var(--line);padding:10px 16px 14px}
.composer-inner{max-width:760px;margin:0 auto}
.composer-row{display:flex;gap:8px;align-items:flex-end;background:#fff;border:1px solid var(--line);border-radius:var(--radius-sm);padding:6px 6px 6px 10px;box-shadow:var(--shadow-sm);transition:border-color .15s}
body[dir="ltr"] .composer-row{padding:6px 10px 6px 6px}
.composer-row:focus-within{border-color:var(--gold);box-shadow:0 0 0 3px rgba(201,162,39,.12)}
.composer-row.sim-mode{border-color:var(--gold);background:#fffdf7}
.composer-row.ask-mode{border-color:var(--navy);background:#fdfdfd}
.composer textarea{flex:1;border:none;outline:none;resize:none;font-family:inherit;font-size:14.5px;line-height:1.5;padding:6px 4px;background:transparent;color:var(--ink);max-height:120px;min-height:22px}
.send-btn{border:none;border-radius:8px;width:38px;height:38px;display:grid;place-items:center;cursor:pointer;transition:all .15s;flex-shrink:0;background:var(--navy);color:var(--gold)}
.send-btn:hover:not(:disabled){background:var(--navy-soft)}
.send-btn:disabled{opacity:.45;cursor:not-allowed}
.send-btn svg{width:17px;height:17px;transform:scaleX(-1)}
body[dir="ltr"] .send-btn svg{transform:scaleX(1)}
.composer-hint{max-width:760px;margin:6px auto 0;font-size:10px;color:var(--muted);text-align:center}
@media (max-width:480px){
:root{--chat-height:560px}
.hero{padding:28px 18px 18px}.hero h1{font-size:22px}.hero .subhead{font-size:14px}
.hero-mark{width:56px;height:56px;font-size:20px;margin-bottom:16px}
.categories{grid-template-columns:1fr;gap:10px;padding:0 18px;margin-bottom:18px}
.cat{padding:14px;display:flex;align-items:center;gap:12px;text-align:right}
body[dir="ltr"] .cat{text-align:left}
.cat-icon{margin:0;flex-shrink:0;width:38px;height:38px}.cat-icon svg{width:18px;height:18px}
.cat-content{flex:1}
.lis-section{padding:0 18px;margin-bottom:18px}
.lis-card{padding:18px 16px}
.key-facts{grid-template-columns:1fr;gap:8px}
.splash-card{padding:22px 18px;margin-bottom:24px}.splash-card-title{font-size:16px}
.landing-topbar{padding:11px 16px}
.chat-container{margin:8px 8px;border-radius:12px}
.chat-header{padding:11px 14px}
.chat-header .brand-mark{width:30px;height:30px;font-size:12px}
.chat-header .brand-name{font-size:13px}.chat-header .brand-sub{font-size:11px}
.icon-btn{padding:5px 9px;font-size:11px}
.chat{padding:14px 12px 6px}.msg{max-width:90%}
.bubble{font-size:14px;padding:10px 13px}
.composer{padding:8px 12px 12px}.composer textarea{font-size:14px}
.mode-banner{padding:8px 12px;font-size:12px}
.modal{padding:18px}.modal-title{font-size:15px}
}
@media (min-width:481px) and (max-width:768px){
:root{--chat-height:620px}.hero{padding:36px 22px 22px}.hero h1{font-size:24px}
.categories{grid-template-columns:1fr;gap:12px}
.cat{display:flex;align-items:center;gap:14px;text-align:right}
body[dir="ltr"] .cat{text-align:left}
.cat-icon{margin:0}.cat-content{flex:1}.chat-container{margin:12px 12px}
.key-facts{grid-template-columns:1fr}
}
@media (min-width:769px) and (max-width:1199px){:root{--chat-height:660px}}
@media (min-width:1200px){:root{--chat-height:720px}}
{
"@context": "https://schema.org",
"@type": "WebPage",
"@id": "https://nirmako.com/mako-client/#webpage",
"url": "https://nirmako.com/mako-client/",
"name": "MAKO Client — מאקו האישי שלך | NIRMAKO Private Coaching Tool",
"description": "כלי אימון דיגיטלי אישי ללקוחות NIRMAKO ולחברי TAB Israel. שלושה מצבי עבודה: שאלה ממוקדת, סשן אימון מלא, וסימולציות מנהל/לקוח/משקיע. דו-לשוני עברית–אנגלית.",
"inLanguage": "he",
"isPartOf": { "@id": "https://nirmako.com/#website" },
"about": { "@id": "https://nirmako.com/#organization" },
"speakable": {
"@type": "SpeakableSpecification",
"cssSelector": [".key-facts", ".workshop-summary"]
},
"breadcrumb": { "@id": "https://nirmako.com/mako-client/#breadcrumb" }
}
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"@id": "https://nirmako.com/mako-client/#breadcrumb",
"itemListElement": [
{ "@type": "ListItem", "position": 1, "name": "NIRMAKO", "item": "https://nirmako.com/" },
{ "@type": "ListItem", "position": 2, "name": "TAB Boardroom", "item": "https://nirmako.com/tab-boardroom" },
{ "@type": "ListItem", "position": 3, "name": "MAKO Client" }
]
}
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"@id": "https://nirmako.com/mako-client/#software",
"name": "MAKO Client",
"alternateName": "המאקו הדיגיטלי",
"url": "https://nirmako.com/mako-client/",
"applicationCategory": "BusinessApplication",
"applicationSubCategory": "Coaching & Leadership Training",
"operatingSystem": "Web Browser (Chrome, Safari, Firefox, Edge)",
"inLanguage": ["he", "en"],
"isAccessibleForFree": false,
"featureList": [
"Ask MAKO — focused one-shot answer mode",
"Full coaching session based on NIRMAKO and TAB methodologies",
"Manager/Employee conversation simulation",
"Sales meeting simulation",
"Investor meeting simulation",
"Value Builder business diagnostic",
"Bilingual interface (Hebrew + English)",
"Personal access code authentication",
"Session scoring and pattern analysis"
],
"audience": {
"@type": "BusinessAudience",
"audienceType": "NIRMAKO clients and TAB Israel members"
},
"provider": { "@id": "https://nirmako.com/#organization" },
"creator": {
"@type": "Person",
"name": "Nir Makovsky",
"alternateName": "MAKO",
"jobTitle": "CEO & Founder",
"worksFor": { "@id": "https://nirmako.com/#organization" }
},
"offers": {
"@type": "Offer",
"availability": "https://schema.org/InStock",
"eligibleCustomerType": "Existing NIRMAKO or TAB Israel client",
"category": "Coaching subscription"
}
}
{
"@context": "https://schema.org",
"@type": "Organization",
"@id": "https://nirmako.com/#organization",
"name": "NIRMAKO",
"alternateName": ["NIRMAKO COACH", "TAB Israel", "ניר מקובסקי"],
"url": "https://nirmako.com/",
"telephone": "+972-52-2549504",
"logo": {
"@type": "ImageObject",
"url": "https://nirmako.com/%d7%9c%d7%95%d7%92%d7%95-nirmako/%d7%90%d7%99%d7%9e%d7%95%d7%9f-%d7%9e%d7%9b%d7%99%d7%a8%d7%95%d7%aa/%d7%90%d7%99%d7%9e%d7%95%d7%9f-%d7%9e%d7%9b%d7%99%d7%a8%d7%95%d7%aa-2/"
},
"image": "https://nirmako.com/%d7%9c%d7%95%d7%92%d7%95-nirmako/%d7%90%d7%99%d7%9e%d7%95%d7%9f-%d7%9e%d7%9b%d7%99%d7%a8%d7%95%d7%aa/%d7%90%d7%99%d7%9e%d7%95%d7%9f-%d7%9e%d7%9b%d7%99%d7%a8%d7%95%d7%aa-2/",
"address": {
"@type": "PostalAddress",
"streetAddress": "הסיבים 49",
"addressLocality": "פתח תקוה",
"postalCode": "4959504",
"addressCountry": "IL"
},
"founder": {
"@type": "Person",
"name": "Nir Makovsky",
"alternateName": "MAKO"
},
"sameAs": [
"https://www.facebook.com/NIRMAKOCOACH",
"https://www.instagram.com/NIRMAKO",
"https://twitter.com/NIRMAKO",
"https://il.pinterest.com/NIRMAKO",
"https://www.linkedin.com/in/nirmakovsky",
"https://www.youtube.com/@Highjump-TAB-Xcelerated"
]
}
{
"@context": "https://schema.org",
"@type": "FAQPage",
"@id": "https://nirmako.com/mako-client/#faq",
"inLanguage": "he",
"mainEntity": [
{
"@type": "Question",
"name": "מה זה כלי MAKO Client?",
"acceptedAnswer": {
"@type": "Answer",
"text": "MAKO Client הוא כלי אימון דיגיטלי אישי ללקוחות NIRMAKO ולחברי TAB Israel. הכלי מציע שלושה מצבי עבודה: שאלה ממוקדת לדילמה ספציפית, סשן אימון מלא לפי שיטות NIRMAKO ו-TAB Boardroom, ושלוש סימולציות לתרגול שיחות אמיתיות — מנהל/עובד, מכירה ללקוח, ופגישת משקיע."
}
},
{
"@type": "Question",
"name": "מי יכול להשתמש בכלי?",
"acceptedAnswer": {
"@type": "Answer",
"text": "הכלי מיועד ללקוחות NIRMAKO וחברי TAB Israel פעילים בלבד, שקיבלו קוד גישה אישי מ-MAKO (ניר מקובסקי). הכלי אינו פתוח לציבור הרחב."
}
},
{
"@type": "Question",
"name": "אילו סוגי סימולציה זמינים?",
"acceptedAnswer": {
"@type": "Answer",
"text": "שלושה סוגי סימולציה: שיחת מנהל/עובד (פידבק, עימות, הצבת גבול) עם 4 וריאציות תפקיד; פגישת מכירה ללקוח (סגירה, טיפול בהתנגדויות) עם אפשרות הפוכה לתרגול עמדת הקונה; ופגישת משקיע (Pitch, due diligence, משא ומתן) עם אפשרות הפוכה לתרגול עמדת המשקיע."
}
},
{
"@type": "Question",
"name": "באילו שפות הכלי תומך?",
"acceptedAnswer": {
"@type": "Answer",
"text": "הכלי דו-לשוני ותומך בעברית ובאנגלית, עם מעבר חופשי בין השפות בכל שלב של הסשן."
}
},
{
"@type": "Question",
"name": "איך מקבלים קוד גישה?",
"acceptedAnswer": {
"@type": "Answer",
"text": "קוד הגישה האישי ניתן ע\"י MAKO (ניר מקובסקי) ללקוחות NIRMAKO פעילים ולחברי TAB Israel. ניתן ליצור קשר ישיר בטלפון 052-2549504 או דרך עמוד ה-TAB Boardroom של NIRMAKO."
}
},
{
"@type": "Question",
"name": "האם הסימולציה מקבלת ציון?",
"acceptedAnswer": {
"@type": "Answer",
"text": "כן. בסיום כל סימולציה הכלי מספק ציון (1–10), סיכום השיחה, דפוסים שזוהו אצל המשתמש, משימה לפעולה הבאה, ותובנה אישית ממאקו."
}
}
]
}
// ===========================================
// CONFIG
// ===========================================
const WORKER_BASE = 'https://lingering-bird-4409.10011334.workers.dev';
const EP_START = WORKER_BASE + '/client-coach/start';
const EP_ASK = WORKER_BASE + '/client-coach/ask';
const EP_MESSAGE = WORKER_BASE + '/client-coach/message';
const EP_SIM_START = WORKER_BASE + '/client-coach/simulation/start';
const EP_SIM_MESSAGE = WORKER_BASE + '/client-coach/simulation/message';
const EP_SIM_END = WORKER_BASE + '/client-coach/simulation/end';
/* ===== DIAGNOSTIC endpoints (additive — Worker patch pending) ===== */
const EP_DIAG_START = WORKER_BASE + '/client-coach/diagnostic/start';
const EP_DIAG_MESSAGE = WORKER_BASE + '/client-coach/diagnostic/message';
const EP_DIAG_END = WORKER_BASE + '/client-coach/diagnostic/end';
const STORAGE_KEY = 'mako_client_session_v1';
const STORAGE_HIST = 'mako_client_history_v1';
const STORAGE_MODE = 'mako_client_mode_v1';
let state = {
session_uuid:null,
client_code:null,
client_name:null,
language:'he',
history:[],
sending:false,
mode:null,
simActive:false,
simUuid:null,
simType:null,
simGptRole:null,
/* diagnostic state (additive) */
diagActive:false,
diagUuid:null,
diagType:null
};
const STRINGS = {
he:{
brand_name:'המאקו הדיגיטלי',
brand_sub:'Private Client',
new_session:'חזרה',
hero_title:'המאקו הדיגיטלי שלך',
hero_subhead_html:'כלי אישי ללקוחות NIRMAKO. שאל אותי שאלה, נהל איתי שיחת אימון, או תרגל מולי שיחה אמיתית — מנהל, לקוח, או משקיע.',
cat1_title:'שאלה למקובסקי', cat1_desc:'תשובה ממוקדת לדילמה ספציפית',
cat2_title:'שיחת אימון', cat2_desc:'סשן עם שאלות אבחון ומיקוד',
cat3_title:'סימולציות', cat3_desc:'מנהל · לקוח · משקיע',
lis_title:'מה כולל הכלי',
kf_1:'3 מצבי שיחה: שאלה ממוקדת, סשן אימון מלא, וסימולציות',
kf_2:'3 סוגי סימולציה: מנהל/עובד, מכירה ללקוח, פגישת משקיע',
kf_3:'דו-לשוני: עברית ואנגלית עם מעבר חופשי',
kf_4:'בנוי על שיטות NIRMAKO ו-TAB Boardroom',
kf_5:'גישה אישית עם קוד אישי מ-MAKO',
kf_6:'ללקוחות TAB Israel ו-NIRMAKO בלבד',
workshop_summary_html:'כלי האימון הדיגיטלי של MAKO נבנה ללקוחות NIRMAKO ולחברי TAB Boardroom של TAB Israel. הכלי מציע שלושה מצבי עבודה: שאלה ממוקדת לדילמה אחת, סשן אימון מלא לפי שיטות NIRMAKO ו-TAB, ושלוש סימולציות לתרגול שיחות אמיתיות — שיחת מנהל/עובד, פגישת מכירה ללקוח, ופגישת משקיע. הכלי תומך בעברית ובאנגלית ופועל באמצעות קוד גישה אישי שניתן ע״י ניר מקובסקי (MAKO). למידע נוסף על שיטת ה-TAB Boardroom ועל קבוצות הייעוץ של NIRMAKO, ראו את עמוד ה-TAB Boardroom הראשי.',
splash_internal_links_html:'לפרטים על שיטת ה-TAB Boardroom ועל קבוצות הייעוץ של NIRMAKO',
welcome_internal_links_html:'רוצה להעמיק בשיטות? עבור ל-TAB Boardroom של NIRMAKO לפרטים על קבוצות הייעוץ.',
splash_card_title:'היכנס',
splash_card_sub:'קוד אישי שקיבלת ממאקו',
code_label:'קוד גישה',
submit:'פתח את הכלי', submitting:'מתחבר...',
err_invalid:'קוד לא תקין או לא פעיל. פנה למאקו.',
err_network:'בעיית רשת. נסה שוב.',
err_server:'תקלה בשרת.',
foot_html:'ללקוחות NIRMAKO בלבד. במצבי משבר — תפס את MAKO ישירות: 052-2549504',
welcome_title:'מה תרצה לעשות עכשיו?',
welcome_sub:'בחר אחת מהאפשרויות. תוכל לעבור בין מצבים בכל רגע.',
hub_ask_title:'שאלה למקובסקי',
hub_chat_title:'שיחת אימון',
hub_diag_title:'דיאגנוסטיקה עסקית',
hub_sim_title:'סימולציות — תרגול שיחה אמיתית',
mode_ask_title:'תשובה ממוקדת',
mode_ask_desc:'דילמה אחת, תשובה אחת — בלי שיחה ארוכה',
mode_coach_title:'סשן אימון מלא',
mode_coach_desc:'שאלות אבחון, אתגור, ופעולה לפי שיטות NIRMAKO',
hub_tab_title:'תהליכי TAB',
mode_tab_title:'קבלת מידע על תהליכי TAB',
mode_tab_desc:'איך עובד בורד, תהליך ההצטרפות, ומה קורה בפגישות',
tab_seed:'ספר לי על תהליכי העבודה של TAB — איך מתנהל בורד, איך נראה תהליך ההצטרפות, ומה קורה בפגישות.',
mode_diag_title:'Value Builder — אבחון ערך',
mode_diag_desc:'8 מנועי הערך של העסק — איפה אתה חזק, איפה תלוי בך',
sim_mgr_title:'מנהל / עובד', sim_mgr_desc:'שיחת עימות, פידבק, או הצבת גבול',
sim_sales_title:'מכירה ללקוח', sim_sales_desc:'פגישת מכירה, סגירה, או טיפול בהתנגדות',
sim_inv_title:'פגישת משקיע', sim_inv_desc:'Pitch, due diligence, או משא ומתן',
placeholder_default:'בחר מצב מהתפריט למעלה...',
placeholder_ask:'נסח את הדילמה במשפט-שניים, ושלח...',
placeholder_coach:'ספר לי מה קורה...',
placeholder_diag:'ענה על השאלה...',
placeholder_sim_mgr:'דבר עם המנהל/עובד...',
placeholder_sim_sales:'דבר עם הלקוח...',
placeholder_sim_inv:'דבר עם המשקיע...',
placeholder_sim_reverse:'מאקו ידבר אליך כ-{role}. ענה...',
hint:'Enter לשליחה · Shift+Enter לשורה חדשה',
banner_ask:'❓ מצב שאלה ממוקדת — תשובה אחת, ואז סיום',
banner_coach:'💬 שיחת אימון פעילה — מאקו מאמן אותך',
banner_diag:'📊 אבחון Value Builder — 8 מנועי הערך של העסק',
banner_sim_mgr_employee_default:'👥 סימולציה: GPT הוא העובד שלך',
banner_sim_mgr_manager_default:'👥 סימולציה: GPT הוא המנהל שלך',
banner_sim_mgr_reverse_emp:'👥 סימולציה הפוכה: GPT הוא הבוס, אתה העובד',
banner_sim_mgr_reverse_mgr:'👥 סימולציה הפוכה: GPT הוא הבעלים, אתה המנהל',
banner_sim_sales:'💼 סימולציית מכירה: GPT הוא הלקוח הפוטנציאלי',
banner_sim_sales_reverse:'💼 סימולציה הפוכה: GPT הוא המוכר, אתה הקונה',
banner_sim_inv:'💰 פגישת משקיע: GPT הוא המשקיע',
banner_sim_inv_reverse:'💰 סימולציה הפוכה: GPT הוא היזם/מנכ״ל, אתה המשקיע',
end_mode:'סיים',
confirm_end:'לסיים את המצב הנוכחי ולחזור לתפריט?',
/* diagnostic CTA bubble */
diag_cta_title:'מוכן לאבחון מהיר של העסק?',
diag_cta_desc:'אבחון Value Builder עובר על 8 מנועי הערך של העסק — וחושף איפה אתה חזק, ואיפה הערך תלוי בך. כ-10 דקות, שאלה-שאלה.',
diag_cta_btn:'התחל דיאגנוסטיקה עסקית',
diag_intro:'נתחיל באבחון Value Builder. אענה אותך דרך 8 מנועי הערך של העסק, שאלה-שאלה. בוא נתחיל מהראשון.',
diag_ended:'האבחון הסתיים',
diag_label:'אבחון',
summary_score:'ציון', summary_text:'סיכום', summary_patterns:'דפוסים שצפו',
summary_commitment:'משימה הבאה', summary_mako:'תובנה ממאקו',
diag_summary_drivers:'מנועי הערך', diag_summary_strength:'איפה אתה חזק',
diag_summary_risk:'איפה הערך תלוי בך', diag_summary_priority:'המהלך הראשון',
chips:[
['לקוח גדול שורף אותי','יש לי לקוח שמושך הרבה זמן וחונק. מה לעשות?'],
['מנהל לא בשל','אני חושב להוריד מנהל מהתפקיד — איך לגשת לזה?'],
['ההכנסות תקועות','ההכנסות עומדות במקום — איפה להתחיל?'],
['אני שרוף','אני לא יכול לקחת חופש כבר חודשים.']
]
},
en:{
brand_name:'Your Digital MAKO', brand_sub:'Private Client',
new_session:'Back',
hero_title:'Your Digital MAKO',
hero_subhead_html:'Private tool for NIRMAKO clients. Ask me a question, run a coaching session, or practice a real conversation — manager, prospect, or investor.',
cat1_title:'Ask MAKO', cat1_desc:'Focused answer to a specific dilemma',
cat2_title:'Coaching session', cat2_desc:'Diagnostic questions, focus, action',
cat3_title:'Simulations', cat3_desc:'Manager · Prospect · Investor',
lis_title:'What the tool includes',
kf_1:'3 conversation modes: focused answer, full coaching, simulations',
kf_2:'3 simulation types: manager/employee, sales, investor meeting',
kf_3:'Bilingual: Hebrew and English with free switching',
kf_4:'Built on NIRMAKO and TAB Board Room methodologies',
kf_5:'Personal access code from MAKO',
kf_6:'For TAB Israel and NIRMAKO clients only',
workshop_summary_html:"MAKO's digital coaching tool was built for NIRMAKO clients and members of the TAB Board Room at TAB Israel. The tool offers three modes: focused answer for a single dilemma, full coaching session based on NIRMAKO and TAB methodologies, and three simulations for practicing real conversations — manager/employee, sales meeting, and investor meeting. The tool supports Hebrew and English and operates via a personal access code issued by Nir Makovsky (MAKO). For more on the TAB Board Room methodology and NIRMAKO peer advisory groups, see the main TAB Board Room page.",
splash_internal_links_html:'Learn more about the TAB Board Room methodology and NIRMAKO peer advisory groups',
welcome_internal_links_html:'Want to go deeper into the methodologies? Visit the TAB Board Room at NIRMAKO for details on peer advisory groups.',
splash_card_title:'Sign in',
splash_card_sub:'Personal code from MAKO',
code_label:'Access code',
submit:'Open tool', submitting:'Connecting...',
err_invalid:'Invalid or inactive code. Contact MAKO.',
err_network:'Network issue. Try again.',
err_server:'Server error.',
foot_html:'NIRMAKO clients only. Crisis: reach MAKO at 052-2549504',
welcome_title:'What do you want to do?',
welcome_sub:'Pick one. You can switch modes anytime.',
hub_ask_title:'Ask MAKO',
hub_chat_title:'Coaching session',
hub_diag_title:'Business diagnostic',
hub_sim_title:'Simulations — practice a real conversation',
mode_ask_title:'Focused answer',
mode_ask_desc:'One dilemma, one answer — no long thread',
mode_coach_title:'Full coaching session',
mode_coach_desc:'Diagnostic, challenge, action — NIRMAKO style',
hub_tab_title:'TAB Processes',
mode_tab_title:'Learn about TAB processes',
mode_tab_desc:'How a board runs, the joining process, what happens in meetings',
tab_seed:'Tell me about how TAB works — how a board meeting runs, what the joining process looks like, and what happens in the meetings.',
mode_diag_title:'Value Builder — value audit',
mode_diag_desc:"The 8 value drivers — where you're strong, where value depends on you",
sim_mgr_title:'Manager / Employee', sim_mgr_desc:'Confrontation, feedback, or setting boundaries',
sim_sales_title:'Sales to client', sim_sales_desc:'Sales meeting, closing, objections',
sim_inv_title:'Investor meeting', sim_inv_desc:'Pitch, due diligence, negotiation',
placeholder_default:'Pick a mode above...',
placeholder_ask:'Frame your dilemma in 1-2 sentences and send...',
placeholder_coach:"Tell me what's going on...",
placeholder_diag:'Answer the question...',
placeholder_sim_mgr:'Speak with the manager/employee...',
placeholder_sim_sales:'Speak with the prospect...',
placeholder_sim_inv:'Speak with the investor...',
placeholder_sim_reverse:'MAKO will speak to you as {role}. Reply...',
hint:'Enter to send · Shift+Enter for new line',
banner_ask:'❓ Focused-answer mode — one answer, then end',
banner_coach:'💬 Coaching session active',
banner_diag:'📊 Value Builder audit — the 8 value drivers',
banner_sim_mgr_employee_default:'👥 Simulation: GPT is your employee',
banner_sim_mgr_manager_default:'👥 Simulation: GPT is your manager',
banner_sim_mgr_reverse_emp:'👥 Reverse: GPT is the boss, you are the employee',
banner_sim_mgr_reverse_mgr:'👥 Reverse: GPT is the owner, you are the manager',
banner_sim_sales:'💼 Sales sim: GPT is the prospect',
banner_sim_sales_reverse:'💼 Reverse: GPT is the seller, you are the buyer',
banner_sim_inv:'💰 Investor meeting: GPT is the investor',
banner_sim_inv_reverse:'💰 Reverse: GPT is the founder, you are the investor',
end_mode:'End',
confirm_end:'End current mode and return to menu?',
diag_cta_title:'Ready for a quick business audit?',
diag_cta_desc:'The Value Builder audit walks through the 8 value drivers of your business — revealing where you\'re strong and where value depends on you. About 10 minutes, one question at a time.',
diag_cta_btn:'Start business diagnostic',
diag_intro:"Let's start the Value Builder audit. I'll take you through the 8 value drivers, one question at a time. Let's begin with the first.",
diag_ended:'Diagnostic complete',
diag_label:'Audit',
summary_score:'Score', summary_text:'Summary', summary_patterns:'Patterns observed',
summary_commitment:'Next commitment', summary_mako:'MAKO insight',
diag_summary_drivers:'Value drivers', diag_summary_strength:'Where you are strong',
diag_summary_risk:'Where value depends on you', diag_summary_priority:'First move',
chips:[
['Big client draining me',"I have a client eating too much time. What to do?"],
['Manager not maturing',"I'm thinking of demoting a manager — how to approach it?"],
['Revenue stuck',"Revenue is flat — where do I start?"],
["I'm burned out","I haven't taken a vacation in months."]
]
}
};
const $ = id => document.getElementById(id);
const els = {
app:$('app'), landing:$('landing'), chatContainer:$('chat-container'),
heroTitle:$('hero-title'), heroSubhead:document.querySelector('.subhead'),
splashCardTitle:$('splash-card-title'), splashCardSub:$('splash-card-sub'),
codeLabel:$('code-label'), codeInput:$('code-input'),
splashSubmit:$('splash-submit'), splashSubmitLabel:$('splash-submit-label'),
splashError:$('splash-error'), splashFoot:$('splash-foot'),
splashInternalLinks:$('splash-internal-links'),
welcomeInternalLinks:$('welcome-internal-links'),
lisTitle:$('lis-title'), keyFacts:$('key-facts'), workshopSummary:$('workshop-summary'),
landingLangToggle:$('landing-lang-toggle'),
brandName:$('brand-name-text'), brandSub:$('brand-sub-text'),
newSessionBtn:$('new-session-btn'), newSessionLabel:$('new-session-label'),
langToggle:$('lang-toggle'), chat:$('chat'), welcome:$('welcome'),
welcomeTitle:$('welcome-title'), welcomeSub:$('welcome-sub'),
hubAskTitle:$('hub-ask-title'), hubChatTitle:$('hub-chat-title'), hubSimTitle:$('hub-sim-title'),
hubDiagTitle:$('hub-diag-title'),
modeAskBtn:$('mode-ask-btn'), modeAskTitle:$('mode-ask-title'), modeAskDesc:$('mode-ask-desc'),
modeCoachBtn:$('mode-coach-btn'), modeCoachTitle:$('mode-coach-title'), modeCoachDesc:$('mode-coach-desc'),
modeDiagBtn:$('mode-diag-btn'), modeDiagTitle:$('mode-diag-title'), modeDiagDesc:$('mode-diag-desc'),
modeTabBtn:$('mode-tab-btn'), modeTabTitle:$('mode-tab-title'), modeTabDesc:$('mode-tab-desc'), hubTabTitle:$('hub-tab-title'),
simMgrBtn:$('sim-mgr-btn'), simMgrTitle:$('sim-mgr-title'), simMgrDesc:$('sim-mgr-desc'),
simSalesBtn:$('sim-sales-btn'), simSalesTitle:$('sim-sales-title'), simSalesDesc:$('sim-sales-desc'),
simInvBtn:$('sim-inv-btn'), simInvTitle:$('sim-inv-title'), simInvDesc:$('sim-inv-desc'),
chips:$('chips'), messages:$('messages'),
input:$('input'), send:$('send'), hint:$('composer-hint'),
composerRow:$('composer-row'),
modeBanner:$('mode-banner'), modeBannerText:$('mode-banner-text-content'),
modeEndBtn:$('mode-end-btn'), modeEndLabel:$('mode-end-label'),
briefingModal:$('briefing-modal'), briefingTitle:$('briefing-title'),
briefingSub:$('briefing-sub'), briefingInput:$('briefing-input'),
briefingLabel:$('briefing-label'),
briefingCancel:$('briefing-cancel'), briefingSkip:$('briefing-skip'), briefingStart:$('briefing-start'),
roleToggle:$('role-toggle'), roleToggleLabel:$('role-toggle-label'), roleHint:$('role-hint')
};
function calculateChatHeight(){
const vh=window.innerHeight, vw=window.innerWidth;
let target;
if(vw<=480){target=Math.min(vh-24,600);target=Math.max(target,480);}
else if(vw<=768){target=Math.min(vh-32,640);target=Math.max(target,520);}
else if(vw{if(els.chat)els.chat.scrollTop=els.chat.scrollHeight;});
}
window.addEventListener('resize',()=>{if(els.app.classList.contains('chat-mode'))applyChatHeight();});
window.addEventListener('orientationchange',()=>{setTimeout(()=>{if(els.app.classList.contains('chat-mode'))applyChatHeight();},200);});
function escapeHtml(s){return String(s).replace(/[&"']/g,c=>({'&':'&','':'>','"':'"',"'":'''}[c]));}
function applyLanguage(lang){
state.language=lang;
const s=STRINGS[lang];
document.documentElement.lang=lang;
document.documentElement.dir=(lang==='he')?'rtl':'ltr';
document.body.setAttribute('lang',lang);
document.body.setAttribute('dir',(lang==='he')?'rtl':'ltr');
els.heroTitle.textContent=s.hero_title;
els.heroSubhead.innerHTML=s.hero_subhead_html;
document.querySelectorAll('[data-i18n]').forEach(el=>{
const key=el.getAttribute('data-i18n');
if(s[key])el.textContent=s[key];
});
els.splashCardTitle.textContent=s.splash_card_title;
els.splashCardSub.textContent=s.splash_card_sub;
els.codeLabel.textContent=s.code_label;
els.splashSubmitLabel.textContent=s.submit;
els.splashFoot.innerHTML=s.foot_html;
// LIS + internal links
if(els.lisTitle) els.lisTitle.textContent=s.lis_title;
if(els.workshopSummary) els.workshopSummary.innerHTML=s.workshop_summary_html;
if(els.splashInternalLinks) els.splashInternalLinks.innerHTML=s.splash_internal_links_html;
if(els.welcomeInternalLinks) els.welcomeInternalLinks.innerHTML=s.welcome_internal_links_html;
els.landingLangToggle.querySelectorAll('button').forEach(b=>b.classList.toggle('active',b.dataset.lang===lang));
els.langToggle.querySelectorAll('button').forEach(b=>b.classList.toggle('active',b.dataset.lang===lang));
els.brandName.textContent=s.brand_name;
els.brandSub.textContent=s.brand_sub;
els.newSessionLabel.textContent=s.new_session;
els.welcomeTitle.textContent=s.welcome_title;
els.welcomeSub.textContent=s.welcome_sub;
els.hubAskTitle.textContent=s.hub_ask_title;
els.hubChatTitle.textContent=s.hub_chat_title;
els.hubSimTitle.textContent=s.hub_sim_title;
if(els.hubDiagTitle) els.hubDiagTitle.textContent=s.hub_diag_title;
els.modeAskTitle.textContent=s.mode_ask_title;
els.modeAskDesc.textContent=s.mode_ask_desc;
els.modeCoachTitle.textContent=s.mode_coach_title;
els.modeCoachDesc.textContent=s.mode_coach_desc;
if(els.modeDiagTitle) els.modeDiagTitle.textContent=s.mode_diag_title;
if(els.modeDiagDesc) els.modeDiagDesc.textContent=s.mode_diag_desc;
if(els.hubTabTitle) els.hubTabTitle.textContent=s.hub_tab_title;
if(els.modeTabTitle) els.modeTabTitle.textContent=s.mode_tab_title;
if(els.modeTabDesc) els.modeTabDesc.textContent=s.mode_tab_desc;
els.simMgrTitle.textContent=s.sim_mgr_title;
els.simMgrDesc.textContent=s.sim_mgr_desc;
els.simSalesTitle.textContent=s.sim_sales_title;
els.simSalesDesc.textContent=s.sim_sales_desc;
els.simInvTitle.textContent=s.sim_inv_title;
els.simInvDesc.textContent=s.sim_inv_desc;
els.modeEndLabel.textContent=s.end_mode;
els.briefingSub.textContent=s.briefing_sub;
els.briefingLabel.textContent=s.briefing_label;
els.roleToggleLabel.textContent=s.role_toggle_label;
els.briefingCancel.textContent=s.cancel;
els.briefingSkip.textContent=s.skip;
els.briefingStart.textContent=s.start;
els.hint.textContent=s.hint;
updatePlaceholder();
renderChips();
}
function renderChips(){
const s=STRINGS[state.language];
els.chips.innerHTML='';
s.chips.forEach(([label,prompt])=>{
const b=document.createElement('button');
b.className='chip';b.textContent=label;b.dataset.prompt=prompt;
b.addEventListener('click',()=>{
enterMode('coach');
els.input.value=prompt;autoResize();els.input.focus();updateSendState();
});
els.chips.appendChild(b);
});
}
function updatePlaceholder(){
const s=STRINGS[state.language];
if(state.simActive){
let key='placeholder_sim_'+
(state.simType==='manager_employee'?'mgr':
state.simType==='sales'?'sales':'inv');
els.input.placeholder = s[key] || s.placeholder_default;
} else if(state.diagActive){
els.input.placeholder = s.placeholder_diag;
} else if(state.mode==='ask'){
els.input.placeholder = s.placeholder_ask;
} else if(state.mode==='coach'){
els.input.placeholder = s.placeholder_coach;
} else {
els.input.placeholder = s.placeholder_default;
}
}
function buildHeaders(){return {'Content-Type':'application/json'};}
// =============================
// LANGUAGE + AUTH
// =============================
els.landingLangToggle.querySelectorAll('button').forEach(b=>{b.addEventListener('click',()=>applyLanguage(b.dataset.lang));});
els.langToggle.querySelectorAll('button').forEach(b=>{
b.addEventListener('click',()=>{
applyLanguage(b.dataset.lang);
if(state.session_uuid){
const saved=JSON.parse(localStorage.getItem(STORAGE_KEY)||'{}');
saved.language=b.dataset.lang;
localStorage.setItem(STORAGE_KEY,JSON.stringify(saved));
}
});
});
els.codeInput.addEventListener('input',()=>{
els.codeInput.value=els.codeInput.value.toUpperCase();
els.splashSubmit.disabled=!els.codeInput.value.trim();
});
els.codeInput.addEventListener('keydown',(e)=>{
if(e.key==='Enter'&&!els.splashSubmit.disabled){e.preventDefault();startSession();}
});
els.splashSubmit.addEventListener('click',startSession);
async function startSession(){
const code=els.codeInput.value.trim().toUpperCase();
if(!code)return;
const s=STRINGS[state.language];
els.splashSubmit.disabled=true;
els.splashSubmitLabel.textContent=s.submitting;
els.splashError.classList.remove('show');
try{
const resp=await fetch(EP_START,{
method:'POST', headers:buildHeaders(),
body:JSON.stringify({client_code:code,language:state.language})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
if(resp.status===401||resp.status===403){showSplashError(s.err_invalid);return;}
if(!resp.ok){showSplashError(s.err_server+' (HTTP '+resp.status+')');return;}
if(!data||!data.session_uuid){showSplashError(s.err_server+' (bad response)');return;}
state.session_uuid=data.session_uuid;
state.client_code=code;
state.client_name=data.client_name||'Client';
state.language=data.language||state.language;
state.history=[];
localStorage.setItem(STORAGE_KEY,JSON.stringify({
session_uuid:state.session_uuid,
client_code:code,
client_name:state.client_name,
language:state.language,ts:Date.now()
}));
localStorage.setItem(STORAGE_HIST,JSON.stringify([]));
applyLanguage(state.language);
openChat();
}catch(err){
showSplashError(STRINGS[state.language].err_network);
}finally{
els.splashSubmit.disabled=false;
els.splashSubmitLabel.textContent=STRINGS[state.language].submit;
}
}
function showSplashError(msg){els.splashError.textContent=msg;els.splashError.classList.add('show');}
/* renders the auto first-message diagnostic invitation, above the hub */
function renderDiagnosticCTA(){
if(document.getElementById('diag-cta-block')) return; // once
const s=STRINGS[state.language];
const block=document.createElement('div');
block.className='diag-cta';
block.id='diag-cta-block';
block.innerHTML=
'
'); row.innerHTML='
'+escapeHtml(data.reaction_from_mako); wrap.appendChild(reaction); } container.appendChild(wrap); els.messages.appendChild(container); scrollToBottom(); } /* diagnostic summary card — reuses sim-summary styling */ function renderDiagSummary(data){ const s=STRINGS[state.language]; const container=document.createElement('div'); container.className='sim-summary-wrap'; const wrap=document.createElement('div'); wrap.className='sim-summary'; const title=document.createElement('div'); title.className='sim-summary-title'; title.innerHTML=''+escapeHtml(s.diag_ended)+''; wrap.appendChild(title); if(data.final_score!=null){ const row=document.createElement('div');row.className='sim-summary-row'; row.innerHTML='
') : escapeHtml(String(data.drivers)); row.innerHTML='
'+escapeHtml(data.reaction_from_mako); wrap.appendChild(reaction); } container.appendChild(wrap); els.messages.appendChild(container); scrollToBottom(); } function renderTyping(isSim){ const wrap=document.createElement('div'); wrap.className='msg '+(isSim?'sim-character':'assistant'); const tp=document.createElement('div'); tp.className='typing'+(isSim?' sim':''); tp.innerHTML=''; wrap.appendChild(tp); els.messages.appendChild(wrap); scrollToBottom(); return wrap; } function scrollToBottom(){requestAnimationFrame(()=>{els.chat.scrollTop=els.chat.scrollHeight;});} function persistHistory(){try{localStorage.setItem(STORAGE_HIST,JSON.stringify(state.history.slice(-40)));}catch{}} function init(){ applyLanguage('he'); try{ const saved=JSON.parse(localStorage.getItem(STORAGE_KEY)||'null'); if(saved&&saved.session_uuid){ state.session_uuid=saved.session_uuid; state.client_code=saved.client_code||null; state.client_name=saved.client_name; state.language=saved.language||'he'; applyLanguage(state.language); openChat(); } }catch(e){} } init();
MK
NIRMAKO · Private Client
Personal Coaching Tool
MK
המאקו הדיגיטלי שלך
כלי אישי ללקוחות NIRMAKO. שאל אותי שאלה, נהל איתי שיחת אימון, או תרגל מולי שיחה אמיתית — מנהל, לקוח, או משקיע.
שאלה למקובסקי
תשובה ממוקדת לדילמה ספציפית
שיחת אימון
סשן עם שאלות אבחון ומיקוד
סימולציות
מנהל · לקוח · משקיע
מה כולל הכלי
3 מצבי שיחה: שאלה ממוקדת, סשן אימון מלא, וסימולציות
3 סוגי סימולציה: מנהל/עובד, מכירה ללקוח, פגישת משקיע
דו-לשוני: עברית ואנגלית עם מעבר חופשי
בנוי על שיטות NIRMAKO ו-TAB Boardroom
גישה אישית עם קוד אישי מ-MAKO
ללקוחות TAB Israel ו-NIRMAKO בלבד
כלי האימון הדיגיטלי של MAKO נבנה ללקוחות NIRMAKO ולחברי TAB Boardroom של TAB Israel. הכלי מציע שלושה מצבי עבודה: שאלה ממוקדת לדילמה אחת, סשן אימון מלא לפי שיטות NIRMAKO ו-TAB, ושלוש סימולציות לתרגול שיחות אמיתיות — שיחת מנהל/עובד, פגישת מכירה ללקוח, ופגישת משקיע. הכלי תומך בעברית ובאנגלית ופועל באמצעות קוד גישה אישי שניתן ע״י ניר מקובסקי (MAKO). למידע נוסף על שיטת ה-TAB Boardroom ועל קבוצות הייעוץ של NIRMAKO, ראו את עמוד ה-TAB Boardroom הראשי.
היכנס
קוד אישי שקיבלת ממאקו
ללקוחות NIRMAKO בלבד. במצבי משבר — תפס את MAKO ישירות: 052-2549504
לפרטים על שיטת ה-TAB Boardroom ועל קבוצות הייעוץ של NIRMAKO
MK
המאקו הדיגיטלי
Private Client
מצב פעיל
מה תרצה לעשות עכשיו?
בחר אחת מהאפשרויות. תוכל לעבור בין מצבים בכל רגע.
שאלה למקובסקי
שיחת אימון
תהליכי TAB
דיאגנוסטיקה עסקית
סימולציות — תרגול שיחה אמיתית
רוצה להעמיק בשיטות? עבור ל-TAB Boardroom של NIRMAKO לפרטים על קבוצות הייעוץ.
סימולציה
בחר מי ישחק GPT, ותן בריף קצר. אפשר גם לדלג.
תפקיד GPT
בריף (אופציונלי)
'+
'
';
// insert ABOVE the hub welcome card
els.chat.insertBefore(block, els.welcome);
document.getElementById('diag-cta-btn-el').addEventListener('click',()=>startDiagnostic('value_builder'));
scrollToBottom();
}
function removeDiagnosticCTA(){
const b=document.getElementById('diag-cta-block');
if(b) b.remove();
}
function openChat(){
els.app.classList.add('chat-mode');
applyChatHeight();
requestAnimationFrame(applyChatHeight);
setTimeout(applyChatHeight,100);setTimeout(applyChatHeight,400);
setTimeout(()=>{
els.chatContainer.scrollIntoView({behavior:'smooth',block:'start'});
},200);
renderDiagnosticCTA();
}
// =============================
// MODE MANAGEMENT
// =============================
els.modeAskBtn.addEventListener('click',()=>enterMode('ask'));
els.modeCoachBtn.addEventListener('click',()=>enterMode('coach'));
els.simMgrBtn.addEventListener('click',()=>openBriefingModal('manager_employee'));
els.simSalesBtn.addEventListener('click',()=>openBriefingModal('sales'));
els.simInvBtn.addEventListener('click',()=>openBriefingModal('investor'));
if(els.modeDiagBtn) els.modeDiagBtn.addEventListener('click',()=>startDiagnostic('value_builder'));
if(els.modeTabBtn) els.modeTabBtn.addEventListener('click',()=>{
enterMode('coach');
els.input.value=STRINGS[state.language].tab_seed;
autoResize(); updateSendState();
sendCoachMessage();
});
function enterMode(mode){
state.mode=mode;
state.simActive=false;
state.simUuid=null;
state.simType=null;
state.simGptRole=null;
state.diagActive=false;
state.diagUuid=null;
state.diagType=null;
removeDiagnosticCTA();
els.welcome.style.display='none';
els.input.disabled=false;
els.composerRow.classList.remove('sim-mode','ask-mode','diag-mode');
if(mode==='ask')els.composerRow.classList.add('ask-mode');
updatePlaceholder();
showModeBanner();
els.input.focus();
updateSendState();
}
function exitMode(){
state.mode=null;
state.simActive=false;
state.simUuid=null;
state.simType=null;
state.simGptRole=null;
state.diagActive=false;
state.diagUuid=null;
state.diagType=null;
els.welcome.style.display='';
els.input.value='';
els.input.disabled=true;
els.composerRow.classList.remove('sim-mode','ask-mode','diag-mode');
updatePlaceholder();
hideModeBanner();
els.messages.innerHTML='';
state.history=[];
localStorage.setItem(STORAGE_HIST,JSON.stringify([]));
localStorage.removeItem(STORAGE_MODE);
removeDiagnosticCTA();
renderDiagnosticCTA();
updateSendState();
}
function showModeBanner(){
const s=STRINGS[state.language];
let text='';
if(state.simActive){
if(state.simType==='manager_employee'){
if(state.simGptRole==='employee')text=s.banner_sim_mgr_employee_default;
else if(state.simGptRole==='manager')text=s.banner_sim_mgr_manager_default;
else if(state.simGptRole==='reverse_emp')text=s.banner_sim_mgr_reverse_emp;
else if(state.simGptRole==='reverse_mgr')text=s.banner_sim_mgr_reverse_mgr;
} else if(state.simType==='sales'){
text = state.simGptRole==='reverse' ? s.banner_sim_sales_reverse : s.banner_sim_sales;
} else if(state.simType==='investor'){
text = state.simGptRole==='reverse' ? s.banner_sim_inv_reverse : s.banner_sim_inv;
}
} else if(state.diagActive){ text=s.banner_diag; }
else if(state.mode==='ask') text=s.banner_ask;
else if(state.mode==='coach') text=s.banner_coach;
if(text){
els.modeBannerText.textContent=text;
els.modeBanner.classList.add('show');
} else hideModeBanner();
}
function hideModeBanner(){els.modeBanner.classList.remove('show');}
els.modeEndBtn.addEventListener('click',()=>{
if(state.simActive){
return endSimulation();
}
if(state.diagActive){
return endDiagnostic();
}
if(!confirm(STRINGS[state.language].confirm_end))return;
exitMode();
});
els.newSessionBtn.addEventListener('click',exitMode);
function autoResize(){els.input.style.height='auto';els.input.style.height=Math.min(els.input.scrollHeight,120)+'px';}
function updateSendState(){
const hasMode = state.mode || state.simActive || state.diagActive;
els.send.disabled = state.sending || !hasMode || !els.input.value.trim();
}
els.input.addEventListener('input',()=>{autoResize();updateSendState();});
els.input.addEventListener('keydown',(e)=>{
if(e.key==='Enter'&&!e.shiftKey){e.preventDefault();if(!els.send.disabled)handleSend();}
});
els.send.addEventListener('click',handleSend);
function handleSend(){
if(state.simActive) return sendSimMessage();
if(state.diagActive) return sendDiagnosticMessage();
if(state.mode==='ask') return sendAsk();
if(state.mode==='coach') return sendCoachMessage();
}
// =============================
// MODE 1: ASK (one-shot)
// =============================
async function sendAsk(){
const text=els.input.value.trim();
if(!text||state.sending||!state.session_uuid)return;
state.sending=true;updateSendState();
renderMessage('user',text);
els.input.value='';autoResize();
const typing=renderTyping();
try{
const resp=await fetch(EP_ASK,{
method:'POST',headers:buildHeaders(),
body:JSON.stringify({session_uuid:state.session_uuid,question:text})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
typing.remove();
if(!resp.ok){renderMessage('assistant',state.language==='he'?'[שגיאה '+resp.status+']':'[Error '+resp.status+']');return;}
const reply=(data&&data.reply)?data.reply:(state.language==='he'?'[תגובה ריקה]':'[Empty]');
renderMessage('assistant',reply);
}catch(err){
typing.remove();
renderMessage('assistant',state.language==='he'?'[בעיית רשת]':'[Network issue]');
}finally{
state.sending=false;updateSendState();els.input.focus();
}
}
// =============================
// MODE 2: COACH (multi-turn)
// =============================
async function sendCoachMessage(){
const text=els.input.value.trim();
if(!text||state.sending||!state.session_uuid)return;
state.sending=true;updateSendState();
renderMessage('user',text);
state.history.push({role:'user',content:text});persistHistory();
els.input.value='';autoResize();
const typing=renderTyping();
try{
const resp=await fetch(EP_MESSAGE,{
method:'POST',headers:buildHeaders(),
body:JSON.stringify({session_uuid:state.session_uuid,message:text,history:state.history.slice(0,-1)})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
typing.remove();
if(!resp.ok){renderMessage('assistant',state.language==='he'?'[שגיאה '+resp.status+']':'[Error '+resp.status+']');return;}
const reply=(data&&data.reply)?data.reply:(state.language==='he'?'[תגובה ריקה]':'[Empty]');
renderMessage('assistant',reply);
state.history.push({role:'assistant',content:reply});persistHistory();
}catch(err){
typing.remove();
renderMessage('assistant',state.language==='he'?'[בעיית רשת]':'[Network issue]');
}finally{
state.sending=false;updateSendState();els.input.focus();
}
}
// =============================
// MODE: DIAGNOSTIC (Value Builder) — additive, mirrors coach multi-turn
// =============================
async function startDiagnostic(diagType){
if(state.sending||!state.session_uuid)return;
removeDiagnosticCTA();
els.welcome.style.display='none';
els.input.disabled=false;
state.sending=true;
updateSendState();
state.mode='diagnostic';
state.diagType=diagType||'value_builder';
state.history=[];
const typing=renderTyping();
try{
const resp=await fetch(EP_DIAG_START,{
method:'POST',headers:buildHeaders(),
body:JSON.stringify({
session_uuid:state.session_uuid,
client_code:state.client_code,
diag_type:state.diagType,
language:state.language
})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
typing.remove();
if(!resp.ok){
renderMessage('assistant',state.language==='he'?'[שגיאה בפתיחת אבחון '+resp.status+']':'[Diagnostic start error '+resp.status+']');
state.mode=null;
els.welcome.style.display='';
renderDiagnosticCTA();
return;
}
state.diagActive=true;
state.diagUuid=data.diag_uuid||data.diagnostic_uuid||null;
persistMode();
els.composerRow.classList.add('diag-mode');
showModeBanner();
updatePlaceholder();
const s=STRINGS[state.language];
const firstQ=(data&&data.reply)?data.reply:s.diag_intro;
renderMessage('assistant',firstQ);
state.history.push({role:'assistant',content:firstQ});persistHistory();
}catch(err){
typing.remove();
renderMessage('assistant',state.language==='he'?'[בעיית רשת]':'[Network issue]');
state.mode=null;
els.welcome.style.display='';
renderDiagnosticCTA();
}finally{
state.sending=false;updateSendState();els.input.focus();
}
}
async function sendDiagnosticMessage(){
const text=els.input.value.trim();
if(!text||state.sending||!state.diagUuid)return;
state.sending=true;updateSendState();
renderMessage('user',text);
state.history.push({role:'user',content:text});persistHistory();
els.input.value='';autoResize();
const typing=renderTyping();
try{
const resp=await fetch(EP_DIAG_MESSAGE,{
method:'POST',headers:buildHeaders(),
body:JSON.stringify({diag_uuid:state.diagUuid,message:text,history:state.history.slice(0,-1)})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
typing.remove();
if(!resp.ok){renderMessage('assistant',state.language==='he'?'[שגיאה '+resp.status+']':'[Error '+resp.status+']');return;}
const reply=(data&&data.reply)?data.reply:(state.language==='he'?'[תגובה ריקה]':'[Empty]');
renderMessage('assistant',reply);
state.history.push({role:'assistant',content:reply});persistHistory();
// optional: if Worker signals completion, auto-render summary
if(data && data.completed === true){ endDiagnostic(true); }
}catch(err){
typing.remove();
renderMessage('assistant',state.language==='he'?'[בעיית רשת]':'[Network issue]');
}finally{
state.sending=false;updateSendState();els.input.focus();
}
}
async function endDiagnostic(silent){
if(!state.diagUuid||state.sending)return;
if(!silent){ if(!confirm(STRINGS[state.language].confirm_end))return; }
state.sending=true;
els.modeEndBtn.disabled=true;
updateSendState();
const typing=renderTyping();
try{
const resp=await fetch(EP_DIAG_END,{
method:'POST',headers:buildHeaders(),
body:JSON.stringify({diag_uuid:state.diagUuid})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
typing.remove();
if(!resp.ok){
const errMsg=data?.message||data?.error||('שגיאה '+resp.status);
renderMessage('assistant','['+errMsg+']');
return;
}
renderDiagSummary(data);
state.diagActive=false;
state.diagUuid=null;
state.diagType=null;
localStorage.removeItem(STORAGE_MODE);
hideModeBanner();
els.composerRow.classList.remove('diag-mode');
state.mode=null;
els.input.disabled=true;
updatePlaceholder();
setTimeout(()=>{els.welcome.style.display='';},800);
}catch(err){
typing.remove();
renderMessage('assistant','['+STRINGS[state.language].err_network+']');
}finally{
state.sending=false;
els.modeEndBtn.disabled=false;
updateSendState();
}
}
// =============================
// MODE 3: SIMULATIONS
// =============================
let pendingSimType=null;
let pendingGptRole=null;
function getRoleOptions(simType){
const s=STRINGS[state.language];
if(simType==='manager_employee'){
return [
{role:'employee', label:s.role_mgr_default, hint:s.hint_mgr_default},
{role:'manager', label:s.role_mgr_swap, hint:s.hint_mgr_swap},
{role:'reverse_emp', label:s.role_mgr_reverse_emp, hint:s.hint_mgr_reverse_emp},
{role:'reverse_mgr', label:s.role_mgr_reverse_mgr, hint:s.hint_mgr_reverse_mgr}
];
}
if(simType==='sales'){
return [
{role:'client', label:s.role_sales_default, hint:s.hint_sales_default},
{role:'reverse', label:s.role_sales_reverse, hint:s.hint_sales_reverse}
];
}
if(simType==='investor'){
return [
{role:'investor',label:s.role_inv_default, hint:s.hint_inv_default},
{role:'reverse', label:s.role_inv_reverse, hint:s.hint_inv_reverse}
];
}
return [];
}
function openBriefingModal(simType){
pendingSimType=simType;
const s=STRINGS[state.language];
const options=getRoleOptions(simType);
pendingGptRole=options[0].role;
els.briefingTitle.textContent =
simType==='manager_employee' ? s.briefing_title_mgr :
simType==='sales' ? s.briefing_title_sales :
s.briefing_title_inv;
els.briefingInput.value='';
els.briefingInput.placeholder =
simType==='manager_employee' ? s.placeholder_brief_mgr :
simType==='sales' ? s.placeholder_brief_sales :
s.placeholder_brief_inv;
els.roleToggle.innerHTML='';
options.forEach((opt,idx)=>{
const b=document.createElement('button');
b.dataset.role=opt.role;
b.textContent=opt.label;
if(idx===0)b.classList.add('active');
b.addEventListener('click',()=>{
pendingGptRole=opt.role;
els.roleToggle.querySelectorAll('button').forEach(x=>x.classList.toggle('active',x===b));
els.roleHint.textContent=opt.hint;
});
els.roleToggle.appendChild(b);
});
els.roleHint.textContent=options[0].hint;
els.briefingModal.classList.add('show');
setTimeout(()=>els.briefingInput.focus(),100);
}
function closeBriefingModal(){
els.briefingModal.classList.remove('show');
pendingSimType=null;
pendingGptRole=null;
}
els.briefingCancel.addEventListener('click',closeBriefingModal);
els.briefingSkip.addEventListener('click',()=>{
if(!pendingSimType)return;
const t=pendingSimType,r=pendingGptRole;
closeBriefingModal();
startSimulation(t,'',r);
});
els.briefingStart.addEventListener('click',()=>{
if(!pendingSimType)return;
const t=pendingSimType,r=pendingGptRole,b=els.briefingInput.value.trim();
closeBriefingModal();
startSimulation(t,b,r);
});
els.briefingModal.addEventListener('click',e=>{
if(e.target===els.briefingModal)closeBriefingModal();
});
async function startSimulation(simType,briefing,gptRole){
removeDiagnosticCTA();
els.welcome.style.display='none';
els.input.disabled=false;
state.sending=true;
updateSendState();
state.mode='sim';
const typing=renderTyping(true);
try{
const resp=await fetch(EP_SIM_START,{
method:'POST',headers:buildHeaders(),
body:JSON.stringify({
session_uuid:state.session_uuid,
client_code:state.client_code,
sim_type:simType,
briefing:briefing,
language:state.language,
gpt_role:gptRole
})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
typing.remove();
if(!resp.ok){
renderMessage('assistant',state.language==='he'?'[שגיאה בפתיחת סימולציה '+resp.status+']':'[Sim start error '+resp.status+']');
state.mode=null;
return;
}
state.simActive=true;
state.simUuid=data.sim_uuid;
state.simType=simType;
state.simGptRole=gptRole;
persistMode();
els.composerRow.classList.add('sim-mode');
showModeBanner();
updatePlaceholder();
const s=STRINGS[state.language];
const isReverse = gptRole && (gptRole.startsWith('reverse')||gptRole==='reverse');
renderMessage('assistant', isReverse ? s.sim_intro_reverse : s.sim_intro);
els.modeEndBtn.disabled=true;
}catch(err){
typing.remove();
renderMessage('assistant',state.language==='he'?'[בעיית רשת]':'[Network issue]');
state.mode=null;
}finally{
state.sending=false;updateSendState();els.input.focus();
}
}
async function sendSimMessage(){
const text=els.input.value.trim();
if(!text||state.sending||!state.simUuid)return;
state.sending=true;updateSendState();
els.modeEndBtn.disabled=false;
renderMessage('user',text);
els.input.value='';autoResize();
const typing=renderTyping(true);
try{
const resp=await fetch(EP_SIM_MESSAGE,{
method:'POST',headers:buildHeaders(),
body:JSON.stringify({sim_uuid:state.simUuid,message:text})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
typing.remove();
if(!resp.ok){renderMessage('assistant',state.language==='he'?'[שגיאה '+resp.status+']':'[Error '+resp.status+']');return;}
const reply=data?.reply||'';
if(!reply){renderMessage('assistant',state.language==='he'?'[תגובה ריקה]':'[Empty]');return;}
renderSimMessage(reply);
}catch(err){
typing.remove();
renderMessage('assistant',state.language==='he'?'[בעיית רשת]':'[Network issue]');
}finally{
state.sending=false;updateSendState();els.input.focus();
}
}
async function endSimulation(){
if(!state.simUuid||state.sending)return;
if(!confirm(STRINGS[state.language].confirm_end))return;
state.sending=true;
els.modeEndBtn.disabled=true;
updateSendState();
const typing=renderTyping(true);
try{
const resp=await fetch(EP_SIM_END,{
method:'POST',headers:buildHeaders(),
body:JSON.stringify({sim_uuid:state.simUuid})
});
const rawText=await resp.text();
let data=null;
try{data=rawText?JSON.parse(rawText):{};}catch{data={_raw:rawText};}
typing.remove();
if(!resp.ok){
const errMsg=data?.message||data?.error||('שגיאה '+resp.status);
renderMessage('assistant','['+errMsg+']');
return;
}
renderSimSummary(data);
state.simActive=false;
state.simUuid=null;
state.simType=null;
state.simGptRole=null;
localStorage.removeItem(STORAGE_MODE);
hideModeBanner();
els.composerRow.classList.remove('sim-mode');
state.mode=null;
els.input.disabled=true;
updatePlaceholder();
setTimeout(()=>{els.welcome.style.display='';},800);
}catch(err){
typing.remove();
renderMessage('assistant','['+STRINGS[state.language].err_network+']');
}finally{
state.sending=false;
els.modeEndBtn.disabled=false;
updateSendState();
}
}
function persistMode(){
if(state.simActive){
try{
localStorage.setItem(STORAGE_MODE,JSON.stringify({
mode:'sim',
simUuid:state.simUuid,
simType:state.simType,
simGptRole:state.simGptRole
}));
}catch{}
} else if(state.diagActive){
try{
localStorage.setItem(STORAGE_MODE,JSON.stringify({
mode:'diagnostic',
diagUuid:state.diagUuid,
diagType:state.diagType
}));
}catch{}
}
}
// =============================
// RENDERING
// =============================
function renderMessage(role,content){
const wrap=document.createElement('div');wrap.className='msg '+role;
const bubble=document.createElement('div');
bubble.className='bubble';
bubble.textContent=content||'';
wrap.appendChild(bubble);
els.messages.appendChild(wrap);scrollToBottom();return wrap;
}
function renderSimMessage(content){
const wrap=document.createElement('div');
wrap.className='msg sim-character';
const s=STRINGS[state.language];
let label='GPT';
const t=state.simType, r=state.simGptRole;
if(t==='manager_employee'){
if(r==='employee') label=s.sim_label_employee;
else if(r==='manager') label=s.sim_label_manager;
else if(r==='reverse_emp')label=s.sim_label_owner;
else if(r==='reverse_mgr')label=s.sim_label_owner;
} else if(t==='sales'){
label = r==='reverse' ? s.sim_label_seller : s.sim_label_client;
} else if(t==='investor'){
label = r==='reverse' ? s.sim_label_founder : s.sim_label_investor;
}
const lbl=document.createElement('div');
lbl.className='sim-character-label';
lbl.textContent=label;
wrap.appendChild(lbl);
const bubble=document.createElement('div');
bubble.className='bubble';
bubble.textContent=content;
wrap.appendChild(bubble);
els.messages.appendChild(wrap);
scrollToBottom();
return wrap;
}
function renderSimSummary(data){
const s=STRINGS[state.language];
const container=document.createElement('div');
container.className='sim-summary-wrap';
const wrap=document.createElement('div');
wrap.className='sim-summary';
const title=document.createElement('div');
title.className='sim-summary-title';
title.innerHTML=''+escapeHtml(s.sim_ended)+'';
wrap.appendChild(title);
if(data.final_score!=null){
const row=document.createElement('div');row.className='sim-summary-row';
row.innerHTML=''+
''+
'
'+
''+escapeHtml(s.diag_cta_title)+'
'+
''+escapeHtml(s.diag_cta_desc)+'
'+ ''+ ''+escapeHtml(s.summary_score)+'
'+data.final_score+'/10
';
wrap.appendChild(row);
}
if(data.summary_from_gpt){
const row=document.createElement('div');row.className='sim-summary-row';
row.innerHTML=''+escapeHtml(s.summary_text)+'
'+escapeHtml(data.summary_from_gpt)+'
';
wrap.appendChild(row);
}
if(data.patterns&&data.patterns.length>0){
const row=document.createElement('div');row.className='sim-summary-row';
const list=data.patterns.map(p=>'• '+escapeHtml(p)).join(''); row.innerHTML='
'+escapeHtml(s.summary_patterns)+'
'+list+'
';
wrap.appendChild(row);
}
if(data.next_commitment){
const row=document.createElement('div');row.className='sim-summary-row';
row.innerHTML=''+escapeHtml(s.summary_commitment)+'
'+escapeHtml(data.next_commitment)+'
';
wrap.appendChild(row);
}
if(data.reaction_from_mako){
const reaction=document.createElement('div');
reaction.className='sim-mako-reaction';
reaction.innerHTML=''+escapeHtml(s.summary_mako)+':'+escapeHtml(data.reaction_from_mako); wrap.appendChild(reaction); } container.appendChild(wrap); els.messages.appendChild(container); scrollToBottom(); } /* diagnostic summary card — reuses sim-summary styling */ function renderDiagSummary(data){ const s=STRINGS[state.language]; const container=document.createElement('div'); container.className='sim-summary-wrap'; const wrap=document.createElement('div'); wrap.className='sim-summary'; const title=document.createElement('div'); title.className='sim-summary-title'; title.innerHTML=''+escapeHtml(s.diag_ended)+''; wrap.appendChild(title); if(data.final_score!=null){ const row=document.createElement('div');row.className='sim-summary-row'; row.innerHTML='
'+escapeHtml(s.summary_score)+'
'+data.final_score+'/100
';
wrap.appendChild(row);
}
if(data.drivers){
const row=document.createElement('div');row.className='sim-summary-row';
const val = Array.isArray(data.drivers) ? data.drivers.map(d=>'• '+escapeHtml(typeof d==='string'?d:(d.name+': '+d.score))).join('') : escapeHtml(String(data.drivers)); row.innerHTML='
'+escapeHtml(s.diag_summary_drivers)+'
'+val+'
';
wrap.appendChild(row);
}
if(data.summary || data.summary_from_gpt){
const row=document.createElement('div');row.className='sim-summary-row';
row.innerHTML=''+escapeHtml(s.summary_text)+'
'+escapeHtml(data.summary||data.summary_from_gpt)+'
';
wrap.appendChild(row);
}
if(data.strength){
const row=document.createElement('div');row.className='sim-summary-row';
row.innerHTML=''+escapeHtml(s.diag_summary_strength)+'
'+escapeHtml(data.strength)+'
';
wrap.appendChild(row);
}
if(data.risk || data.owner_dependency){
const row=document.createElement('div');row.className='sim-summary-row';
row.innerHTML=''+escapeHtml(s.diag_summary_risk)+'
'+escapeHtml(data.risk||data.owner_dependency)+'
';
wrap.appendChild(row);
}
if(data.next_commitment || data.priority){
const row=document.createElement('div');row.className='sim-summary-row';
row.innerHTML=''+escapeHtml(s.diag_summary_priority)+'
'+escapeHtml(data.next_commitment||data.priority)+'
';
wrap.appendChild(row);
}
if(data.reaction_from_mako){
const reaction=document.createElement('div');
reaction.className='sim-mako-reaction';
reaction.innerHTML=''+escapeHtml(s.summary_mako)+':'+escapeHtml(data.reaction_from_mako); wrap.appendChild(reaction); } container.appendChild(wrap); els.messages.appendChild(container); scrollToBottom(); } function renderTyping(isSim){ const wrap=document.createElement('div'); wrap.className='msg '+(isSim?'sim-character':'assistant'); const tp=document.createElement('div'); tp.className='typing'+(isSim?' sim':''); tp.innerHTML=''; wrap.appendChild(tp); els.messages.appendChild(wrap); scrollToBottom(); return wrap; } function scrollToBottom(){requestAnimationFrame(()=>{els.chat.scrollTop=els.chat.scrollHeight;});} function persistHistory(){try{localStorage.setItem(STORAGE_HIST,JSON.stringify(state.history.slice(-40)));}catch{}} function init(){ applyLanguage('he'); try{ const saved=JSON.parse(localStorage.getItem(STORAGE_KEY)||'null'); if(saved&&saved.session_uuid){ state.session_uuid=saved.session_uuid; state.client_code=saved.client_code||null; state.client_name=saved.client_name; state.language=saved.language||'he'; applyLanguage(state.language); openChat(); } }catch(e){} } init();