/* ETRIXTECH E-TEKNISI V81 — mobile shell and separated realtime chat */

/* Bottom navigation must never appear before login/license is complete. */
body:not(.logged-in) #mobileBottomNav{
  display:none!important;
  visibility:hidden!important;
  pointer-events:none!important;
}

/* Keep responsive sidebar usable on phone browsers. */
@media(max-width:1050px){
  body.logged-in .sidebar.open{
    display:block!important;
    transform:translateX(0)!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }
  body.logged-in .overlay.show{
    display:block!important;
    pointer-events:auto!important;
  }
}

/* APK uses bottom navigation only. The old top action bar is intentionally removed. */
body.apk-mode.logged-in .topbar{
  display:none!important;
}
body.apk-mode.logged-in .sidebar,
body.apk-mode.logged-in .overlay{
  display:none!important;
}
body.apk-mode.logged-in .app-shell{
  display:flex!important;
  min-height:100dvh!important;
  padding-top:max(10px,env(safe-area-inset-top))!important;
  overflow-x:hidden!important;
}
body.apk-mode.logged-in .main{
  width:100%!important;
  min-width:0!important;
}
body.apk-mode.logged-in .content{
  width:100%!important;
  max-width:100%!important;
  padding:8px 10px calc(92px + env(safe-area-inset-bottom))!important;
  overflow-x:hidden!important;
}
body.apk-mode.logged-in .content>.view.active{
  margin-top:0!important;
}
body.apk-mode.logged-in .footer{
  display:none!important;
}
body.apk-mode.logged-in .card:first-child{
  margin-top:0!important;
}

/* One stable mobile menu for both APK and mobile browser. */
#mobileBottomNav.mobile-bottom-nav-v78{
  box-sizing:border-box!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  width:auto!important;
  max-width:none!important;
  min-width:0!important;
  overflow:hidden!important;
}
#mobileBottomNav.mobile-bottom-nav-v78 button{
  position:relative!important;
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  padding:6px 2px!important;
}
#mobileBottomNav.mobile-bottom-nav-v78 button span{
  font-size:21px!important;
  line-height:1!important;
}
#mobileBottomNav.mobile-bottom-nav-v78 button small{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:10px!important;
  line-height:1.1!important;
}
.mobile-chat-badge-v81{
  position:absolute!important;
  right:8px!important;
  top:3px!important;
  display:grid!important;
  place-items:center!important;
  min-width:17px!important;
  height:17px!important;
  padding:0 4px!important;
  border-radius:999px!important;
  background:#d7193f!important;
  color:#fff!important;
  font-size:9px!important;
  font-style:normal!important;
  font-weight:900!important;
  box-shadow:0 2px 6px rgba(0,0,0,.2)!important;
}
body.apk-mode.logged-in #mobileBottomNav.mobile-bottom-nav-v78{
  display:grid!important;
  left:0!important;
  right:0!important;
  bottom:0!important;
  width:100%!important;
  height:auto!important;
  min-height:72px!important;
  padding:7px 8px calc(7px + env(safe-area-inset-bottom))!important;
  border-radius:0!important;
  border-left:0!important;
  border-right:0!important;
  border-bottom:0!important;
  background:rgba(255,255,255,.98)!important;
  box-shadow:0 -5px 18px rgba(30,55,80,.15)!important;
}
@media(max-width:900px){
  body.mobile-web-mode.logged-in #mobileBottomNav.mobile-bottom-nav-v78:not([hidden]){
    display:grid!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    width:100%!important;
    min-height:68px!important;
    padding:6px 8px calc(6px + env(safe-area-inset-bottom))!important;
    border-radius:0!important;
  }
  body.mobile-web-mode.logged-in .content{
    padding-bottom:calc(84px + env(safe-area-inset-bottom))!important;
  }
  body.mobile-web-mode.logged-in .footer{
    padding-bottom:calc(82px + env(safe-area-inset-bottom))!important;
  }
}

/* Completed status is shown once, inside the task card header. */
.task-actions-v78:empty{display:none!important}

/* WhatsApp-like chat: one technician per conversation. */
.chat-app-v81{
  display:grid;
  grid-template-columns:290px minmax(0,1fr);
  min-height:610px;
  height:calc(100vh - 115px);
  max-height:760px;
  overflow:hidden;
  border:1px solid #a9bfd1;
  border-radius:12px;
  background:#eef5fa;
  box-shadow:4px 5px 0 rgba(83,110,135,.16);
}
.chat-contact-panel-v81{
  min-width:0;
  display:flex;
  flex-direction:column;
  border-right:1px solid #b7cad9;
  background:#f8fbfd;
}
.chat-contact-head-v81{
  min-height:68px;
  padding:13px 14px;
  display:flex;
  align-items:center;
  border-bottom:1px solid #bfd0dc;
  background:linear-gradient(#edf7fe,#dcebf6);
}
.chat-contact-head-v81 strong{display:block;font-size:14px;color:#17344d}
.chat-contact-head-v81 small{display:block;margin-top:3px;font-size:10.5px;color:#5d7285;line-height:1.35}
.chat-contact-list-v81{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:5px;
}
.chat-contact-v81{
  width:100%!important;
  min-height:66px!important;
  display:grid!important;
  grid-template-columns:42px minmax(0,1fr) auto!important;
  gap:9px!important;
  align-items:center!important;
  padding:8px!important;
  border:0!important;
  border-bottom:1px solid #e0e9ef!important;
  border-radius:8px!important;
  background:transparent!important;
  color:#163148!important;
  box-shadow:none!important;
  text-align:left!important;
}
.chat-contact-v81:hover,.chat-contact-v81.active{
  background:#dff2ff!important;
}
.chat-contact-v81.active{
  box-shadow:inset 4px 0 0 #009bd8!important;
}
.chat-avatar-v81{
  width:40px;
  height:40px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:linear-gradient(135deg,#0b92ca,#23b788);
  color:#fff;
  font-size:16px;
  font-weight:900;
}
.chat-contact-copy-v81{min-width:0;display:block}
.chat-contact-copy-v81 strong,.chat-contact-copy-v81 small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-contact-copy-v81 strong{font-size:12px}
.chat-contact-copy-v81 small{margin-top:4px;color:#657b8e;font-size:10.5px;font-weight:500}
.chat-contact-meta-v81{display:flex;flex-direction:column;align-items:flex-end;gap:6px}
.chat-contact-meta-v81 small{font-size:9px;color:#718497}
.chat-contact-meta-v81 b{min-width:20px;height:20px;padding:0 5px;display:grid;place-items:center;border-radius:999px;background:#18a85b;color:#fff;font-size:9px}
.chat-conversation-v81{
  min-width:0;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  background:linear-gradient(rgba(234,244,251,.92),rgba(234,244,251,.92)),repeating-linear-gradient(45deg,#eef6fb 0,#eef6fb 12px,#e7f1f8 12px,#e7f1f8 24px);
}
.chat-thread-head-v81{
  min-height:68px;
  display:grid;
  grid-template-columns:42px minmax(0,1fr) auto;
  align-items:center;
  gap:9px;
  padding:9px 12px;
  border-bottom:1px solid #b8cbd9;
  background:linear-gradient(#edf7fe,#dcebf6);
}
.chat-thread-avatar-v81{width:38px;height:38px;display:grid;place-items:center;border-radius:50%;background:#fff;border:1px solid #a9bfd1;font-size:19px}
.chat-thread-title-v81{min-width:0}
.chat-thread-title-v81 strong,.chat-thread-title-v81 small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-thread-title-v81 strong{font-size:13px;color:#17344d}
.chat-thread-title-v81 small{margin-top:3px;font-size:10px;color:#607589}
#enableNotifBtn.notif-active-v81{background:#e6fff0!important;color:#08793b!important;border-color:#75d7a0!important}
.chat-thread-v81{
  min-height:0!important;
  max-height:none!important;
  height:auto!important;
  overflow-y:auto!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  background:transparent!important;
  padding:14px!important;
  gap:4px!important;
}
.chat-row-v81{display:flex;width:100%;margin:3px 0}
.chat-row-v81.mine{justify-content:flex-end}
.chat-row-v81.theirs{justify-content:flex-start}
.chat-row-v81 .chat-bubble-v78{
  width:auto!important;
  min-width:120px;
  max-width:min(74%,620px)!important;
  margin:0!important;
  padding:8px 11px 7px!important;
  border:1px solid #c5d5df!important;
  border-radius:10px 10px 10px 2px!important;
  background:#fff!important;
  box-shadow:0 2px 5px rgba(33,58,79,.10)!important;
}
.chat-row-v81.mine .chat-bubble-v78{
  border-color:#a9dabd!important;
  border-radius:10px 10px 2px 10px!important;
  background:#dcf8e8!important;
}
.chat-row-v81 .chat-bubble-v78 strong{font-size:10px;color:#476176}
.chat-row-v81 .chat-bubble-v78 p{margin:3px 0!important;font-size:12px;line-height:1.42;color:#172d40}
.chat-row-v81 .chat-bubble-v78 small{font-size:9px!important;text-align:right;color:#6f8291!important}
.chat-row-v81 .chat-bubble-v78 img{max-width:260px!important;width:100%;height:auto;border-radius:8px}
.chat-ticket-tag-v81{display:block;width:max-content;max-width:100%;margin:4px 0;padding:3px 6px;border-radius:5px;background:#edf4f8;color:#526b7e;font-size:9px;font-style:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-empty-v81{margin:auto;padding:12px 18px;border-radius:999px;background:rgba(255,255,255,.85);color:#667b8c;font-size:11px}
.chat-form-v81{
  margin:0!important;
  padding:9px 10px calc(9px + env(safe-area-inset-bottom));
  border-top:1px solid #bdcedb;
  background:#f5f8fa;
  gap:7px!important;
}
.chat-tech-select-v81{display:none!important}
.chat-targets-v81{display:grid;grid-template-columns:minmax(0,1fr);gap:6px}
.chat-targets-v81 select{min-height:31px!important;padding:5px 8px!important;font-size:10.5px!important;background:#fff!important}
.chat-compose-v81{
  display:grid!important;
  grid-template-columns:38px minmax(0,1fr) 70px!important;
  gap:7px!important;
  align-items:end!important;
}
.chat-compose-v81 .attach-btn{width:38px;height:38px;display:grid;place-items:center;border:1px solid #9eb5c6;border-radius:7px;background:#fff;font-size:18px;cursor:pointer}
.chat-compose-v81 textarea{min-height:38px!important;max-height:95px!important;padding:8px 10px!important;border-radius:8px!important;font-size:12px!important}
.chat-compose-v81 button{height:38px!important;min-height:38px!important;padding:6px 10px!important}
.chat-form-v81.disabled-v81{opacity:.65;pointer-events:none}

@media(max-width:900px){
  .chat-app-v81{
    grid-template-columns:1fr;
    grid-template-rows:auto minmax(0,1fr);
    min-height:540px;
    height:calc(100dvh - 150px);
    max-height:none;
  }
  .chat-contact-panel-v81{border-right:0;border-bottom:1px solid #b7cad9}
  .chat-contact-head-v81{display:none}
  .chat-contact-list-v81{display:flex;gap:5px;overflow-x:auto;padding:6px;max-height:72px}
  .chat-contact-v81{flex:0 0 190px!important;min-height:58px!important;grid-template-columns:36px minmax(0,1fr) auto!important;padding:6px!important}
  .chat-avatar-v81{width:34px;height:34px;font-size:14px}
  .chat-thread-head-v81{min-height:58px;padding:7px 9px}
  .chat-thread-v81{padding:9px!important}
  .chat-row-v81 .chat-bubble-v78{max-width:88%!important}
}

@media(max-width:600px){
  body.apk-mode.logged-in .content{padding-left:8px!important;padding-right:8px!important}
  .chat-app-v81{height:calc(100dvh - 100px);min-height:460px;border-radius:9px}
  body.mobile-web-mode .chat-app-v81{height:calc(100dvh - 155px)}
  .chat-thread-head-v81{grid-template-columns:36px minmax(0,1fr) auto}
  .chat-thread-avatar-v81{width:34px;height:34px;font-size:17px}
  #enableNotifBtn{font-size:0!important;width:36px!important;min-width:36px!important;padding:0!important}
  #enableNotifBtn::after{content:'🔔';font-size:16px}
  .chat-compose-v81{grid-template-columns:36px minmax(0,1fr) 58px!important;gap:5px!important}
  .chat-compose-v81 .attach-btn{width:36px;height:36px}
  .chat-compose-v81 textarea,.chat-compose-v81 button{height:36px!important;min-height:36px!important}
}
