/* Base wrapper */
.ahw-wrap{
  position: fixed;
  z-index: 99999;
  width: 340px;
  max-width: calc(100vw - 20px);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: #0b3b8f;
}

/* Dock (sempre visibile quando pannello chiuso) */
.ahw-dock{
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.ahw-dock-btn{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(12,74,173,0.35);
  box-shadow: 0 10px 28px rgba(0,0,0,0.20);
  cursor: pointer;
}

.ahw-dock-btn:hover{
  box-shadow: 0 14px 34px rgba(0,0,0,0.26);
}

.ahw-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #0b3b8f;
  flex: 0 0 auto;
}

.ahw-dock-text{
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
}

.ahw-dock-link{
  text-decoration: none;
  color: #0b3b8f;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.90);
  border: 1px solid rgba(12,74,173,0.25);
  box-shadow: 0 8px 22px rgba(0,0,0,0.16);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ahw-dock-link:hover{
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
}

/* Panel */
.ahw-panel{
  display: none;
  margin-top: 10px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(12,74,173,0.35);
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.22);
  overflow: hidden;
}

.ahw-top{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  background: linear-gradient(180deg, rgba(12,74,173,0.10), rgba(255,255,255,0));
}

.ahw-title{
  font-size: 20px;
  line-height: 1.08;
  font-weight: 900;
}

.ahw-subtitle{
  margin-top: 6px;
  font-size: 16px;
  font-weight: 900;
}

.ahw-close{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(12,74,173,0.20);
  background: rgba(255,255,255,0.86);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #0b3b8f;
}

/* Chat area */
.ahw-chat{
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.ahw-bubble{
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.25;
  border: 1px solid rgba(12,74,173,0.18);
}

.ahw-bot{
  background: rgba(12,74,173,0.08);
  align-self: flex-start;
}

.ahw-user{
  background: rgba(255,106,0,0.12);
  border-color: rgba(255,106,0,0.25);
  align-self: flex-end;
  display: none;
}

.ahw-botname{
  font-weight: 900;
  margin-bottom: 4px;
}

.ahw-input{
  padding: 10px 14px 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.ahw-text{
  width: 100%;
  resize: none;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(12,74,173,0.25);
  background: rgba(255,255,255,0.92);
  outline: none;
  font-size: 14px;
}

.ahw-text:focus{
  border-color: rgba(12,74,173,0.55);
}

.ahw-send{
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #25D366;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.ahw-send:hover{
  filter: brightness(0.96);
}

.ahw-actions{
  padding: 0 14px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ahw-call, .ahw-info{
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 900;
  border: 1px solid rgba(12,74,173,0.22);
  background: rgba(255,255,255,0.92);
  color: #0b3b8f;
}

.ahw-call:hover, .ahw-info:hover{
  border-color: rgba(12,74,173,0.45);
}

.ahw-foot{
  padding: 10px 14px 14px;
  font-size: 12.5px;
  color: rgba(0,0,0,0.60);
  font-weight: 700;
}

/* State */
.ahw-wrap.is-open .ahw-panel{ display: block; }
.ahw-wrap.is-open .ahw-dock{ display: none; }

.ahw-wrap.is-closed .ahw-panel{ display: none; }
.ahw-wrap.is-closed .ahw-dock{ display: inline-flex; }

/* Mobile: bottom sheet */
@media (max-width: 520px){
  .ahw-wrap{
    width: calc(100vw - 18px);
    max-width: calc(100vw - 18px);
  }
  .ahw-panel{
    border-radius: 18px;
  }
  .ahw-actions{
    grid-template-columns: 1fr;
  }
  .ahw-chat{
    max-height: 34vh;
  }
}

.ahw-actions--single{
  grid-template-columns: 1fr;
}

.ahw-call--primary{
  background-color: #202857;
  border-color: #202857;
  color: #fff;
}

.ahw-call--primary:hover{
  filter: brightness(0.96);
}

