/* OK ITHAKI V249476
 * Time-linked Home/+ colors, polls always published to Feed, stable animated Bil,
 * professional-name/code reconciliation without app logout, direct administrator
 * contact with same-thread replies, transparent navigation and video metadata.
 * Database/media/messages/calls/friends are preserved.
 */
(function(){
  'use strict';
  if(window.__ITHAKI_V249476_COMPLETE__)return;
  window.__ITHAKI_V249476_COMPLETE__={version:'V249476',installedAt:Date.now()};
  window.__ITHAKI_V249476_OWNS_PROFILE_BIL__=true;

  var BIL_KEY='ith_bil_enabled_v249461';
  var WRAP_FLAG='__v249476Wrapped';
  var observer=null;
  var installTimer=0;

  function I(){return window.ITH||(window.ITH={})}
  function S(){return window.__ITHAKI_CORE_STATE__||window.state||I().state||{}}
  function $(id){return document.getElementById(id)}
  function esc(v){return String(v==null?'':v).replace(/[&<>"']/g,function(c){return {'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]})}
  function lang(){try{return String(localStorage.getItem('ith_ui_lang_v249141')||localStorage.getItem('ith_ui_lang')||document.documentElement.lang||'el').toLowerCase().indexOf('en')===0?'en':'el'}catch(e){return'el'}}
  function tr(el,en){return lang()==='en'?en:el}
  function toast(msg,ms){try{if(window.toast)return window.toast(msg,ms||5200);if(I().notifyAppEvent)return I().notifyAppEvent(msg)}catch(e){}try{console.log('[V249476]',msg)}catch(e){}}
  function room(){var s=S();try{return String(s.room||localStorage.getItem('ith_room')||'ithaki-phone-test')}catch(e){return'ithaki-phone-test'}}
  function device(){var s=S();try{return String(s.device||s.device_id||localStorage.getItem('ith_device')||'')}catch(e){return''}}
  function name(){var s=S();try{return String(s.name||localStorage.getItem('ith_name')||'Μέλος').trim()}catch(e){return'Μέλος'}}
  function avatar(){var s=S();try{return String(s.avatar||localStorage.getItem('ith_avatar')||('animal:'+(localStorage.getItem('ith_animal')||'🦉')))}catch(e){return''}}
  function rid(){try{return crypto.randomUUID()}catch(e){return'req_'+Date.now().toString(36)+'_'+Math.random().toString(36).slice(2)}}
  function apiBase(){var s=S(),b=String(s.api||'').replace(/\/$/,'');if(b)return b;return location.protocol.indexOf('http')===0?location.origin:'https://ok-ithaki.gr'}
  async function getJson(path){var r=await fetch(apiBase()+path,{cache:'no-store',credentials:'same-origin'}),d={};try{d=await r.json()}catch(e){}if(!r.ok||!d||d.ok===false)throw new Error((d&&d.note)||(d&&d.detail)||('HTTP '+r.status));return d}
  async function postJson(path,body){var s=S(),headers={'Content-Type':'application/json'};if(s.token)headers['X-ITHAKI-TOKEN']=String(s.token);var r=await fetch(apiBase()+path,{method:'POST',cache:'no-store',credentials:'same-origin',headers:headers,body:JSON.stringify(body||{})}),d={};try{d=await r.json()}catch(e){}if(!r.ok||!d||d.ok===false)throw new Error((d&&d.note)||(d&&d.detail)||('HTTP '+r.status));return d}
  function securePayload(extra){return Object.assign({room_id:room(),device_id:device(),client_ts:Date.now(),request_id:rid(),website:''},extra||{})}

  function addCss(){
    if($('ithV249476Css'))return;
    var st=document.createElement('style');st.id='ithV249476Css';st.textContent=`
      :root{--ith476-home-bg:rgba(8,34,48,.72);--ith476-home-line:rgba(132,218,255,.22);--ith476-home-accent:#8fddff;--ith476-plus-bg:rgba(5,27,39,.97);--ith476-plus-accent:#8fddff}
      body[data-screen-theme="mountain"]{--ith476-home-bg:linear-gradient(145deg,rgba(36,66,79,.82),rgba(15,34,49,.78));--ith476-home-line:rgba(192,230,245,.28);--ith476-home-accent:#d8f1ff;--ith476-plus-bg:linear-gradient(160deg,rgba(33,61,75,.98),rgba(12,30,43,.98));--ith476-plus-accent:#d8f1ff}
      body[data-screen-theme="sea"]{--ith476-home-bg:linear-gradient(145deg,rgba(0,102,130,.80),rgba(3,51,78,.80));--ith476-home-line:rgba(113,229,255,.32);--ith476-home-accent:#7eeeff;--ith476-plus-bg:linear-gradient(160deg,rgba(0,85,111,.98),rgba(3,39,68,.98));--ith476-plus-accent:#7eeeff}
      body[data-screen-theme="sunset"]{--ith476-home-bg:linear-gradient(145deg,rgba(112,48,79,.82),rgba(49,27,58,.82));--ith476-home-line:rgba(255,180,196,.28);--ith476-home-accent:#ffc2d0;--ith476-plus-bg:linear-gradient(160deg,rgba(92,37,67,.98),rgba(37,24,51,.98));--ith476-plus-accent:#ffc2d0}
      body[data-screen-theme="night"]{--ith476-home-bg:linear-gradient(145deg,rgba(8,22,42,.84),rgba(2,8,18,.86));--ith476-home-line:rgba(132,157,255,.22);--ith476-home-accent:#b9c7ff;--ith476-plus-bg:linear-gradient(160deg,rgba(8,20,38,.985),rgba(1,6,14,.99));--ith476-plus-accent:#b9c7ff}
      #homePage .card,#homePage .tile,#homePage .homeWelcomePro,#homePage .wisdomBoard,#homePage .proProtection{background:var(--ith476-home-bg)!important;border-color:var(--ith476-home-line)!important;color:inherit!important;box-shadow:0 14px 34px rgba(0,0,0,.25)!important}
      #homePage .tile b,#homePage h1,#homePage h2,#homePage h3,#homePage .proPanelTitle{color:var(--ith476-home-accent)!important}
      #plusSheet,.plusSheet,#memberMenu.plusSheet{background:var(--ith476-plus-bg)!important;border-color:var(--ith476-home-line)!important;box-shadow:0 -20px 60px rgba(0,0,0,.55)!important}
      #plusSheet button,.plusSheet button{border-color:var(--ith476-home-line)!important;background:rgba(255,255,255,.055)!important;color:#fff!important}
      #plusSheet button b,.plusSheet button b{color:var(--ith476-plus-accent)!important}
      #nav,.nav{background:transparent!important;border:0!important;box-shadow:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
      #nav button,.nav button{background:transparent!important;border:0!important;box-shadow:none!important}
      #nav button.active,.nav button.active{background:rgba(255,255,255,.07)!important;border:1px solid rgba(255,255,255,.10)!important}
      #feedPage .ithFeedStageV249429[data-v249429-kind="video"] .ithFeedMetaV249429,
      #feedPage .ithFeedStageV249429[data-v249429-kind="photo"] .ithFeedMetaV249429{background:transparent!important;border:0!important;box-shadow:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;padding:4px 2px!important;text-shadow:0 2px 9px #000,0 0 4px #000!important}
      #feedPage .ithFeedMetaV249429 small{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;margin-top:2px!important}
      #feedPage .ithFeedMetaV249429 .ith476Caption{display:-webkit-box!important;-webkit-box-orient:vertical!important;-webkit-line-clamp:1!important;overflow:hidden!important;max-height:1.55em!important;transition:max-height .2s ease!important}
      #feedPage .ithFeedMetaV249429.ith476Open .ith476Caption{-webkit-line-clamp:unset!important;max-height:24dvh!important;overflow:auto!important}
      .ith476CaptionToggle{pointer-events:auto!important;display:inline-flex!important;align-items:center!important;min-height:25px!important;margin-top:3px!important;padding:2px 8px!important;border-radius:999px!important;border:1px solid rgba(255,255,255,.28)!important;background:transparent!important;color:#fff!important;font-size:11px!important;font-weight:850!important}
      #ithProfileBilV249476{position:relative;overflow:hidden;border:1px solid var(--ith476-home-line)!important;background:var(--ith476-home-bg)!important}
      #ithProfileBilV249476 .ith476BilRow{display:grid;grid-template-columns:84px 1fr;gap:12px;align-items:center}
      #ithProfileBilV249476 .bil475{transform:scale(1.12);transform-origin:center}
      #ithProfileBilV249476 .ith476BilActions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
      #ithProfileBilV249476 .ith476Wisdom{line-height:1.45;margin:5px 0 0;color:rgba(255,255,255,.86)}
      .bil475Head{animation:ith476Neck 7.5s ease-in-out infinite!important;transform-origin:32% 105%!important}
      .bil475Eye.l{animation:ith476EyeL 5.8s ease-in-out infinite!important}.bil475Eye.r{animation:ith476EyeR 5.8s ease-in-out infinite!important}
      .bil475Mouth{animation:ith476Mouth 4.8s ease-in-out infinite!important}
      @keyframes ith476Neck{0%,100%{transform:rotate(-1deg) translateY(0)}35%{transform:rotate(.8deg) translateY(-.5px)}68%{transform:rotate(-.2deg) translateY(.5px)}}
      @keyframes ith476EyeL{0%,42%,46%,100%{transform:translate(0,0) scaleY(1)}44%{transform:translate(1px,0) scaleY(.12)}70%{transform:translate(1px,.4px) scaleY(1)}}
      @keyframes ith476EyeR{0%,42%,46%,100%{transform:translate(0,0) scaleY(1)}44%{transform:translate(-1px,0) scaleY(.12)}70%{transform:translate(-1px,.4px) scaleY(1)}}
      @keyframes ith476Mouth{0%,100%{transform:scaleX(1) translateY(0)}50%{transform:scaleX(.78) translateY(.5px)}}
      #ithProNameMismatchV249476,#ithAdminContactV249476{position:fixed;inset:0;z-index:2147483645;display:grid;place-items:center;padding:12px;background:rgba(0,0,0,.72);backdrop-filter:blur(8px)}
      .ith476ModalCard{width:min(620px,calc(100vw - 24px));max-height:min(88dvh,760px);overflow:auto;padding:16px;border-radius:24px;background:#071522;color:#fff;border:1px solid rgba(255,255,255,.16);box-shadow:0 28px 90px rgba(0,0,0,.72)}
      .ith476ModalCard input,.ith476ModalCard textarea{width:100%;box-sizing:border-box;min-height:46px;margin:5px 0 10px;border-radius:13px;border:1px solid rgba(255,255,255,.17);background:rgba(255,255,255,.07);color:#fff;padding:10px}
      .ith476ModalActions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.ith476ModalActions button{min-height:46px;border-radius:13px}
      #ithAdminContactCardV249476 textarea{width:100%;box-sizing:border-box;min-height:96px;resize:vertical}
      .ith476ContactThread{display:grid;gap:8px;margin-top:10px;max-height:42dvh;overflow:auto}.ith476ContactItem{padding:10px;border-radius:14px;background:rgba(255,255,255,.055);border:1px solid rgba(255,255,255,.10)}.ith476ContactItem .reply{margin-top:8px;padding:9px;border-radius:11px;background:rgba(54,240,160,.09);border:1px solid rgba(54,240,160,.22)}
      .ith476ProBadge{display:inline-flex;margin-left:7px;padding:2px 7px;border-radius:999px;background:rgba(255,211,110,.14);border:1px solid rgba(255,211,110,.28);color:#ffd36e;font-size:11px;font-weight:850}
      .ith476PollAlways{margin:8px 0;padding:9px 11px;border-radius:13px;background:rgba(54,240,160,.08);border:1px solid rgba(54,240,160,.22);color:#dffff1;font-weight:750}
      @media(max-width:620px){#ithProfileBilV249476 .ith476BilRow{grid-template-columns:72px 1fr}.ith476ModalActions{grid-template-columns:1fr}}
    `;document.head.appendChild(st)
  }

  function defaultBilEnabled(){try{if(localStorage.getItem(BIL_KEY)==null)localStorage.setItem(BIL_KEY,'1')}catch(e){}}
  function bilEnabled(){try{return localStorage.getItem(BIL_KEY)!=='0'}catch(e){return true}}
  function profileWisdom(){var a=lang()==='en'?['Welcome back. A calm word opens a clear road.','Listen first; the best answer often comes second.','Respect gives freedom a safe place to stand.']:['Καλώς ήρθες ξανά. Ο ήρεμος λόγος ανοίγει καθαρό δρόμο.','Άκου πρώτα· η καλύτερη απάντηση συχνά έρχεται δεύτερη.','Ο σεβασμός δίνει στην ελευθερία ασφαλή χώρο.'];return a[Math.floor(Date.now()/300000)%a.length]}
  function bilMarkup(){return '<span class="bil475" aria-hidden="true"><i class="bil475Tail"></i><i class="bil475Foot l"></i><i class="bil475Foot r"></i><i class="bil475Shell"></i><i class="bil475Head"><i class="bil475Eye l"></i><i class="bil475Eye r"></i><i class="bil475Mouth"></i></i></span>'}
  function ensureProfileBil(){if(window.__ITHAKI_V249523_SHARE_BIL_OWNER__)return null;
    var p=$('profilePage');if(!p||!p.classList.contains('active')&&String(document.body&&document.body.dataset.page)!=='profile')return;
    if($('ithProfileBilV249476'))return;
    var host=p.querySelector('.profileCleanWrap')||p;
    var card=document.createElement('section');card.id='ithProfileBilV249476';card.className='card';
    card.innerHTML='<div class="ith476BilRow">'+bilMarkup()+'<div><h3 style="margin:0">Bil</h3><p class="ith476Wisdom">'+esc(profileWisdom())+'</p><div class="date">'+esc(bilEnabled()?tr('Εμφανίζεται στην Αρχική σε κάθε κανονικό άνοιγμα.','Appears on Home on every normal app start.'):tr('Είναι απενεργοποιημένος από τις ρυθμίσεις ειδοποιήσεων.','Disabled in notification settings.'))+'</div></div></div><div class="ith476BilActions"><button class="btn green" data-v249476-bil="open">🐢 '+esc(tr('Άνοιγμα Bil','Open Bil'))+'</button><button class="btn" data-v249476-bil="toggle">'+esc(bilEnabled()?tr('Απενεργοποίηση','Disable'):tr('Ενεργοποίηση','Enable'))+'</button><button class="btn" data-v249476-bil="wisdom">✦ '+esc(tr('Νέος λόγος','New saying'))+'</button></div>';
    card.addEventListener('click',function(e){var b=e.target.closest('[data-v249476-bil]');if(!b)return;e.preventDefault();var a=b.dataset.v249476Bil;if(a==='open'&&typeof I().openBilStableV249475==='function')return I().openBilStableV249475();if(a==='toggle'&&typeof I().setBilStableV249475==='function'){I().setBilStableV249475(!bilEnabled());card.remove();ensureProfileBil();return}if(a==='wisdom'){var x=card.querySelector('.ith476Wisdom');if(x)x.textContent=profileWisdom()}});
    host.insertBefore(card,host.firstChild)
  }
  function ensureBilAtStartup(){defaultBilEnabled();if(bilEnabled()&&String(document.body&&document.body.dataset.page||S().page||'home')==='home'){try{I().ensureBilStableV249475&&I().ensureBilStableV249475()}catch(e){}}}

  function decoratePollModal(){var menu=$('memberMenu'),feed=$('pollFeed');if(!menu||!menu.querySelector('.proPollModal')||!feed)return;feed.checked=true;feed.disabled=true;var row=feed.closest('label');if(row){row.style.display='none'}if(!menu.querySelector('.ith476PollAlways')){var n=document.createElement('div');n.className='ith476PollAlways';n.textContent=tr('Η ψηφοφορία θα δημοσιευτεί αυτόματα στη Ροή και θα εμφανίζεται και στις δημοσιεύσεις του προφίλ σου.','The poll will automatically be published to Feed and appear in your profile posts.');var btn=menu.querySelector('[onclick*="createPollFromCard"]');if(btn)btn.parentNode.insertBefore(n,btn)}}
  function wrapPoll(){
    var ith=I();
    if(typeof ith.openPoll==='function'&&!ith.openPoll[WRAP_FLAG]){var op=ith.openPoll;var w=function(){var r=op.apply(this,arguments);setTimeout(decoratePollModal,20);setTimeout(decoratePollModal,120);return r};w[WRAP_FLAG]=true;ith.openPoll=w}
    if(typeof ith.createPollFromCard==='function'&&!ith.createPollFromCard[WRAP_FLAG]){var cp=ith.createPollFromCard;var c=async function(){var feed=$('pollFeed');if(feed)feed.checked=true;var r=await cp.apply(this,arguments);setTimeout(function(){try{I().stableRouteV249429?I().stableRouteV249429('feed','poll-published-v249476'):I().page&&I().page('feed')}catch(e){}},40);return r};c[WRAP_FLAG]=true;ith.createPollFromCard=c}
  }

  function enhanceCaptions(){document.querySelectorAll('#feedPage .ithFeedStageV249429[data-v249429-kind="video"] .ithFeedMetaV249429,#feedPage .ithFeedStageV249429[data-v249429-kind="photo"] .ithFeedMetaV249429').forEach(function(meta){if(meta.dataset.v249476Caption==='1')return;meta.dataset.v249476Caption='1';var smalls=meta.querySelectorAll('small');if(smalls.length<2)return;var cap=smalls[0];cap.classList.add('ith476Caption');requestAnimationFrame(function(){var text=String(cap.textContent||'').trim(),needs=text.length>54||cap.scrollHeight>cap.clientHeight+2;if(!needs)return;var b=document.createElement('button');b.type='button';b.className='ith476CaptionToggle';b.textContent=tr('Άνοιγμα','Open');b.onclick=function(e){e.preventDefault();e.stopPropagation();var on=meta.classList.toggle('ith476Open');b.textContent=on?tr('Κλείσιμο','Close'):tr('Άνοιγμα','Open')};meta.appendChild(b)})})}

  async function professionalStatus(){var d=device();if(!d)return{professional_enabled:false,account_name:''};return getJson('/api/account/v249383/status?room_id='+encodeURIComponent(room())+'&device_id='+encodeURIComponent(d)+'&_v='+Date.now())}
  function currentProfileInput(){var x=$('profName');return String(x&&x.value||name()).trim()}
  function closeMismatch(){var x=$('ithProNameMismatchV249476');if(x)x.remove()}
  function showNameMismatch(st,newName,after){
    closeMismatch();var m=document.createElement('section');m.id='ithProNameMismatchV249476';m.innerHTML='<div class="ith476ModalCard"><div class="row"><div><b>🔐 '+esc(tr('Νέο όνομα επαγγελματικού μέλους','New professional member name'))+'</b><div class="date">'+esc(tr('Ο υπάρχων επαγγελματικός κωδικός ανήκει στο όνομα','The existing professional code belongs to'))+' <b>'+esc(st.account_name||'')+'</b>. '+esc(tr('Για το νέο όνομα χρειάζεται επιβεβαίωση και νέος κωδικός. Η εφαρμογή δεν θα σε πετάξει έξω.','The new name needs confirmation and a new code. The app will not log you out.'))+'</div></div><button class="icon" data-a="close">×</button></div><label>'+esc(tr('Παλιός επαγγελματικός κωδικός','Current professional code'))+'<input id="ith476OldCode" type="password" autocomplete="current-password"></label><label>'+esc(tr('Νέος κωδικός','New code'))+'<input id="ith476NewCode" type="password" autocomplete="new-password"></label><label>'+esc(tr('Επανάληψη νέου κωδικού','Repeat new code'))+'<input id="ith476NewCode2" type="password" autocomplete="new-password"></label><div id="ith476RebindStatus" class="date"></div><div class="ith476ModalActions"><button class="btn" data-a="use-old">'+esc(tr('Χρήση ονόματος του κωδικού','Use coded name'))+'</button><button class="btn green" data-a="rebind">'+esc(tr('Αποθήκευση νέου ονόματος και κωδικού','Save new name and code'))+'</button></div></div>';
    m.onclick=async function(e){var b=e.target.closest('[data-a]');if(!b)return;e.preventDefault();var a=b.dataset.a;if(a==='close'){closeMismatch();return}if(a==='use-old'){var old=String(st.account_name||'').trim();try{localStorage.setItem('ith_name',old);localStorage.setItem('ith_profile_name_locked_v249164',old);var s=S();s.name=old}catch(_){}closeMismatch();try{I().renderProfile&&I().renderProfile()}catch(_){}if(typeof after==='function')after();return}if(a==='rebind'){var oldCode=String($('ith476OldCode')&&$('ith476OldCode').value||''),n1=String($('ith476NewCode')&&$('ith476NewCode').value||''),n2=String($('ith476NewCode2')&&$('ith476NewCode2').value||''),status=$('ith476RebindStatus');if(n1.length<8||n1!==n2){if(status)status.textContent=tr('Οι νέοι κωδικοί πρέπει να είναι ίδιοι και τουλάχιστον 8 χαρακτήρες.','New codes must match and contain at least 8 characters.');return}b.disabled=true;if(status)status.textContent=tr('Έλεγχος παλιού κωδικού…','Checking current code…');try{var u=await postJson('/api/account/v249383/professional/unlock',securePayload({password:oldCode}));var token=String(u.session_token||'');if(!token)throw new Error(tr('Δεν δημιουργήθηκε ασφαλής συνεδρία.','Secure session was not created.'));if(status)status.textContent=tr('Ενημέρωση κοινού ονόματος…','Updating shared name…');await postJson('/api/account/v249383/professional/profile/update',securePayload({session_token:token,account_name:newName,avatar:avatar(),account_mode:'normal'}));if(status)status.textContent=tr('Αλλαγή κωδικού…','Changing code…');await postJson('/api/account/v249383/professional/password/change',securePayload({session_token:token,new_password:n1,new_password_confirm:n2}));try{localStorage.setItem('ith_name',newName);localStorage.setItem('ith_profile_name_locked_v249164',newName);localStorage.setItem('ith_professional_enabled_v249386','1');var s2=S();s2.name=newName}catch(_){}closeMismatch();toast(tr('Το νέο όνομα και ο νέος κωδικός αποθηκεύτηκαν. Η εφαρμογή παραμένει ανοιχτή.','New name and code saved. The app remains open.'),7000);try{I().renderProfile&&I().renderProfile()}catch(_){}if(typeof after==='function')after()}catch(err){b.disabled=false;if(status)status.textContent=String(err.message||err);toast(String(err.message||err),7000)}}};document.body.appendChild(m)
  }
  function wrapProfileSave(){var ith=I();if(typeof ith.saveProfile!=='function'||ith.saveProfile[WRAP_FLAG])return;var old=ith.saveProfile;var w=async function(){var next=currentProfileInput();try{var st=await professionalStatus();if(st.professional_enabled&&String(st.account_name||'').trim()&&String(st.account_name||'').trim()!==next){showNameMismatch(st,next,function(){old.call(ith)});return false}}catch(e){console.warn('V249476 professional name check',e)}return old.apply(this,arguments)};w[WRAP_FLAG]=true;ith.saveProfile=w}
  function wrapProfessionalOpen(){['openProfessionalCenterV249383','openProfessionalCenterV249384','openProfessionalCenterV249386','openProfessionalCenterFastV249392'].forEach(function(k){var fn=I()[k];if(typeof fn!=='function'||fn[WRAP_FLAG])return;var w=async function(){var current=name();try{var st=await professionalStatus();if(st.professional_enabled&&st.account_name&&String(st.account_name).trim()!==current){showNameMismatch(st,current,function(){fn.call(I())});return false}}catch(e){}return fn.apply(this,arguments)};w[WRAP_FLAG]=true;I()[k]=w})}

  function professionalLocal(){try{return localStorage.getItem('ith_professional_enabled_v249386')==='1'||localStorage.getItem('ith_professional_enabled_v249385')==='1'}catch(e){return false}}
  async function loadContactThread(){var box=$('ith476ContactThread');if(!box)return;box.innerHTML='<div class="date">'+esc(tr('Φόρτωση επικοινωνίας…','Loading communication…'))+'</div>';try{var r=await getJson('/api/feedback/status?room_id='+encodeURIComponent(room())+'&device_id='+encodeURIComponent(device())+'&limit=80&_v='+Date.now()),items=Array.isArray(r.feedback)?r.feedback:[];box.innerHTML=items.map(function(x){return '<div class="ith476ContactItem"><div class="row"><b>'+esc(x.nickname||name())+(x.professional_member?'<span class="ith476ProBadge">💼 '+esc(tr('Επαγγελματικό μέλος','Professional member'))+'</span>':'')+'</b><small class="date" style="margin-left:auto">'+esc(new Date((Number(x.created_at)||0)*1000).toLocaleString())+'</small></div><div>'+esc(x.message||'')+'</div>'+(x.admin_reply?'<div class="reply"><b>'+esc(tr('Απάντηση διαχειριστή','Administrator reply'))+'</b><div>'+esc(x.admin_reply)+'</div></div>':'<div class="date">'+esc(tr('Αναμονή απάντησης','Waiting for reply'))+'</div>')+'</div>'}).join('')||'<div class="date">'+esc(tr('Δεν υπάρχει ακόμη επικοινωνία.','No communication yet.'))+'</div>'}catch(e){box.innerHTML='<div class="date">'+esc(String(e.message||e))+'</div>'}}
  async function sendAdminContact(){var ta=$('ith476AdminMessage'),txt=String(ta&&ta.value||'').trim();if(!txt)return toast(tr('Γράψε πρώτα μήνυμα.','Write a message first.'));var b=$('ith476AdminSend');if(b)b.disabled=true;try{await postJson('/api/feedback/send',{room_id:room(),device_id:device(),nickname:name(),screen:'profile-v249476',message:txt,user_agent:navigator.userAgent||'',professional_member:professionalLocal()});if(ta)ta.value='';toast(tr('Το μήνυμα στάλθηκε στον διαχειριστή.','Message sent to the administrator.'));await loadContactThread()}catch(e){toast(String(e.message||e),7000)}finally{if(b)b.disabled=false}}
  function ensureAdminContact(){if(window.__ITHAKI_PROFILE_EXCLUSIVE_R10F37F1F3__){document.getElementById('ithAdminContactCardV249476')?.remove();return}var p=$('profilePage');if(!p||String(document.body&&document.body.dataset.page)!=='profile'||$('ithAdminContactCardV249476'))return;var wrap=p.querySelector('.profileCleanWrap')||p;var card=document.createElement('section');card.id='ithAdminContactCardV249476';card.className='card';card.innerHTML='<div class="row"><div><b>💬 '+esc(tr('Άμεση επικοινωνία με διαχειριστή','Direct administrator contact'))+'</b><div class="date">'+esc(tr('Το μήνυμα εμφανίζεται στον server με ένδειξη επαγγελματικού μέλους και ο διαχειριστής απαντά στο ίδιο σημείο.','The message appears on the server with a professional-member badge and the administrator replies in the same place.'))+'</div></div><button class="btn" id="ith476AdminRefresh">↻</button></div><textarea id="ith476AdminMessage" placeholder="'+esc(tr('Γράψε το μήνυμά σου…','Write your message…'))+'"></textarea><button id="ith476AdminSend" class="btn green" style="width:100%">'+esc(tr('Αποστολή στον διαχειριστή','Send to administrator'))+'</button><div id="ith476ContactThread" class="ith476ContactThread"></div>';card.querySelector('#ith476AdminSend').onclick=sendAdminContact;card.querySelector('#ith476AdminRefresh').onclick=loadContactThread;wrap.appendChild(card);loadContactThread()}

  function maintain(){addCss();wrapPoll();decoratePollModal();enhanceCaptions();if(window.__ITHAKI_BIL_ONLY_NOTIFICATIONS_V249477__){["ithProfileBilCardV249476","ithAdminContactCardV249476"].forEach(function(id){var x=document.getElementById(id);if(x)x.remove()});return}wrapProfileSave();wrapProfessionalOpen();ensureBilAtStartup();ensureProfileBil();ensureAdminContact()}
  function install(){addCss();defaultBilEnabled();maintain();clearInterval(installTimer);installTimer=setInterval(maintain,900);window.addEventListener('ithaki:page-changed',function(){setTimeout(maintain,30);setTimeout(maintain,180)});window.addEventListener('storage',maintain);window.addEventListener('ithaki:publication-sent',function(e){if(e&&e.detail&&e.detail.kind==='poll')setTimeout(function(){try{I().stableRouteV249429?I().stableRouteV249429('feed','poll-publication-v249476'):I().page&&I().page('feed')}catch(_){}},60)});if(document.body){observer=new MutationObserver(function(){maintain()});observer.observe(document.body,{childList:true,subtree:true,attributes:true,attributeFilter:['data-page','data-screen-theme']})}Object.assign(I(),{decoratePollAlwaysFeedV249476:decoratePollModal,ensureProfileBilV249476:ensureProfileBil,openProfessionalNameRebindV249476:showNameMismatch,loadAdministratorThreadV249476:loadContactThread,sendAdministratorContactV249476:sendAdminContact,enhanceTransparentFeedCaptionV249476:enhanceCaptions})}
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',function(){setTimeout(install,0)},{once:true});else setTimeout(install,0)
})();
