/* Всплывающий ИИ-помощник Express Mail */
.em-assistant-root{
  position:fixed;
  right:max(1rem, env(safe-area-inset-right, 0px));
  bottom:max(1rem, env(safe-area-inset-bottom, 0px));
  z-index:5200;
  font-family:inherit;
}
.em-assistant-fab{
  display:inline-flex;
  align-items:center;
  gap:0.45rem;
  border:0;
  border-radius:999px;
  padding:0.7rem 1rem 0.7rem 0.75rem;
  background:linear-gradient(145deg, #2563eb, #1d4ed8);
  color:#fff;
  font:inherit;
  font-weight:700;
  font-size:0.92rem;
  cursor:pointer;
  box-shadow:0 12px 28px rgba(37,99,235,.42);
}
.em-assistant-fab__icon{
  width:1.55rem;
  height:1.55rem;
  border-radius:999px;
  display:block;
  overflow:hidden;
  background:#fff;
}
.em-assistant-fab__icon img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}
.em-assistant-root.is-attention .em-assistant-fab{
  animation:emAssistantPulse 1.2s ease-in-out 2;
}
@keyframes emAssistantPulse{
  0%,100%{ transform:scale(1); }
  50%{ transform:scale(1.06); }
}
.em-assistant-backdrop{
  position:fixed;
  inset:0;
  background:rgba(59,130,246,.12);
  backdrop-filter:blur(2px);
  z-index:5190;
}
.em-assistant-popup{
  position:fixed;
  right:max(1rem, env(safe-area-inset-right, 0px));
  bottom:max(4.5rem, calc(env(safe-area-inset-bottom, 0px) + 4.2rem));
  width:min(42rem, calc(100vw - 2rem));
  z-index:5201;
}
.em-assistant{
  display:flex;
  flex-direction:column;
  gap:0.85rem;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(59,130,246,.14), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border:1px solid #dbe3ef;
  border-radius:18px;
  box-shadow:0 18px 40px rgba(15,23,42,.18);
  padding:0.95rem 1rem 1.05rem;
  max-height:min(84vh, 700px);
  overflow:auto;
}
.em-assistant__hero{
  display:flex;
  align-items:flex-start;
  gap:0.7rem;
}
.em-assistant__avatar{
  width:3rem;
  height:3rem;
  padding:0;
  border-radius:14px;
  overflow:hidden;
  border:2px solid #dbeafe;
  background:#eff6ff;
  box-shadow:0 4px 12px rgba(37,99,235,.16);
  flex:0 0 auto;
  cursor:zoom-in;
}
.em-assistant__avatar img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}
.em-assistant__photo-preview{
  position:fixed;
  inset:0;
  z-index:5300;
  display:grid;
  place-items:center;
  padding:2rem;
  background:rgba(15,23,42,.72);
  backdrop-filter:blur(5px);
}
.em-assistant__photo-preview[hidden]{ display:none; }
.em-assistant__photo-preview img{
  width:min(32rem, 82vw);
  height:min(32rem, 82vw);
  max-height:82vh;
  object-fit:cover;
  border-radius:24px;
  border:4px solid #fff;
  box-shadow:0 24px 70px rgba(15,23,42,.45);
}
.em-assistant__photo-close{
  position:fixed;
  top:max(1rem, env(safe-area-inset-top, 0px));
  right:max(1rem, env(safe-area-inset-right, 0px));
  width:2.75rem;
  height:2.75rem;
  border:0;
  border-radius:999px;
  background:#fff;
  color:#334155;
  font-size:1.65rem;
  line-height:1;
  cursor:pointer;
}
.em-assistant__hero-text{ min-width:0; flex:1; }
.em-assistant__title{
  font-size:1.02rem;
  font-weight:800;
  color:#0f172a;
}
.em-assistant__meta{
  margin-top:0.15rem;
  font-size:0.8rem;
  color:#64748b;
  line-height:1.35;
}
.em-assistant__close{
  border:0;
  background:transparent;
  color:#64748b;
  font-size:1.4rem;
  line-height:1;
  cursor:pointer;
  padding:0.1rem 0.35rem;
}
.em-assistant__advice{
  background:linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  color:#1e293b;
  border:1px solid #bfdbfe;
  border-radius:14px;
  padding:1rem 1.05rem;
}
.em-assistant__advice-label{
  font-size:0.7rem;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:#2563eb;
  font-weight:700;
  margin-bottom:0.4rem;
}
.em-assistant__advice-text{
  font-size:0.95rem;
  line-height:1.45;
  color:#1e293b;
  white-space:pre-wrap;
  word-break:break-word;
}
.em-assistant__advice-meta{
  margin-top:0.5rem;
  font-size:0.72rem;
  color:#64748b;
}
.em-assistant__ask-label{
  font-size:0.78rem;
  font-weight:600;
  color:#475569;
}
.em-assistant__chips{
  display:flex;
  flex-wrap:wrap;
  gap:0.4rem;
}
.em-assistant__chip{
  border:1px solid #bfdbfe;
  background:#eff6ff;
  color:#1d4ed8;
  border-radius:999px;
  padding:0.35rem 0.75rem;
  font:inherit;
  font-size:0.82rem;
  font-weight:600;
  cursor:pointer;
}
.em-assistant__chip:hover{ background:#dbeafe; }
.em-assistant__composer{
  display:grid;
  grid-template-columns:1fr;
  gap:0.65rem;
  align-items:stretch;
}
.em-assistant__composer textarea{
  width:100%;
  min-height:6.5rem;
  max-height:15rem;
  resize:vertical;
  border:1px solid #cbd5e1;
  border-radius:12px;
  padding:0.75rem 0.85rem;
  font:inherit;
  line-height:1.45;
  color:#0f172a;
  background:#fff;
}
.em-assistant__composer textarea:focus{
  outline:3px solid rgba(59,130,246,.14);
  border-color:#60a5fa;
}
.em-assistant__composer .btn{
  justify-self:end;
  min-width:8rem;
}
.em-assistant__composer.is-busy{ opacity:0.72; }
.em-assistant__status{
  font-size:0.8rem;
  color:#64748b;
}
@media (max-width:640px){
  .em-assistant-fab__label{ display:none; }
  .em-assistant-fab{ padding:0.85rem; border-radius:999px; }
  .em-assistant-popup{
    right:0.75rem;
    bottom:4.75rem;
    width:calc(100vw - 1.5rem);
  }
  .em-assistant__composer .btn{ width:100%; }
}
