.ai-support-launcher{
  position:fixed;
  right:max(12px, env(safe-area-inset-right, 0px));
  bottom:max(12px, env(safe-area-inset-bottom, 0px));
  z-index:50;
  border:0;
  border-radius:999px;
  background:#ffd21f;
  color:#080808;
  font-weight:900;
  box-shadow:0 14px 40px #0006;
  padding:11px 16px 11px 11px;
  display:flex;
  gap:10px;
  align-items:center;
  cursor:pointer;
  min-height:48px;
  max-width:calc(100vw - 24px);
}

.ai-support-panel{
  position:fixed;
  right:max(12px, env(safe-area-inset-right, 0px));
  left:max(12px, env(safe-area-inset-left, 0px));
  bottom:0;
  z-index:51;
  width:auto;
  max-width:none;
  height:min(82vh, 640px);
  max-height:calc(100vh - 12px);
  background:#101010;
  color:#fff;
  border:1px solid #2c2c2c;
  border-radius:16px 16px 0 0;
  box-shadow:0 -12px 60px #0009;
  display:none;
  overflow:hidden;
}

.ai-support-panel.open{
  display:grid;
  grid-template-rows:auto 1fr auto auto auto;
}
.ai-support-legal{
  display:flex;
  flex-wrap:wrap;
  gap:6px 12px;
  padding:8px 14px 12px;
  border-top:1px solid #2c2c2c;
  background:#070707;
}
.ai-support-legal a{
  color:#9a9a9a;
  text-decoration:none;
  font-size:11px;
  font-weight:700;
}
.ai-support-legal a:hover{color:#ffd21f}

.ai-support-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 15px;
  border-bottom:1px solid #2c2c2c;
  background:#070707;
}

.ai-support-id{
  display:flex;
  gap:10px;
  align-items:center;
  font-weight:900;
}

.ai-support-avatar,
.ai-mini-logo{
  position:relative;
  display:grid;
  place-items:center;
  width:38px;
  height:38px;
  border-radius:10px;
  background:#ffd21f;
  color:#000;
  font-weight:1000;
  isolation:isolate;
}

.ai-mini-logo{
  width:34px;
  height:34px;
  border-radius:999px;
  background:#080808;
  color:#ffd21f;
}

.ai-support-avatar::before,
.ai-mini-logo::before{
  content:"";
  position:absolute;
  inset:-4px;
  border-radius:inherit;
  border:2px solid #ffd21f55;
  animation:autofixPulse 1.9s ease-out infinite;
}

.ai-support-avatar::after,
.ai-mini-logo::after{
  content:"";
  position:absolute;
  width:8px;
  height:8px;
  right:4px;
  bottom:4px;
  border-radius:50%;
  background:#20a46b;
  box-shadow:0 0 0 3px #101010;
}

.ai-gear{
  display:inline-block;
  animation:autofixSpin 5s linear infinite;
}

.ai-support-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.ai-support-reset{
  background:#1a1a1a;
  color:#ddd;
  border:1px solid #333;
  border-radius:8px;
  min-height:44px;
  padding:0 12px;
  cursor:pointer;
  font-size:12px;
  font-weight:700;
}

.ai-support-reset:hover{
  color:#fff;
  border-color:#555;
}

.ai-support-close{
  background:#222;
  color:#fff;
  border:0;
  border-radius:8px;
  width:44px;
  height:44px;
  cursor:pointer;
  font-size:18px;
}

.ai-support-sub{
  font-size:12px;
  color:#bbb;
  margin-top:2px;
}

.ai-support-log{
  padding:14px;
  overflow:auto;
  background:#121212;
  -webkit-overflow-scrolling:touch;
}

.ai-msg{
  margin:0 0 10px;
  display:flex;
}

.ai-msg.user{
  justify-content:flex-end;
}

.ai-bubble{
  max-width:86%;
  border-radius:10px;
  padding:10px 11px;
  line-height:1.42;
  white-space:pre-wrap;
  word-break:break-word;
}

.ai-msg.bot .ai-bubble{
  background:#fff;
  color:#151515;
}

.ai-bubble-wrap{
  display:flex;
  align-items:flex-start;
  gap:6px;
  max-width:86%;
}

.ai-speak-btn{
  flex-shrink:0;
  width:28px;
  height:28px;
  margin-top:2px;
  border:none;
  border-radius:50%;
  background:#2a2a2a;
  color:#bdbdbd;
  cursor:pointer;
  padding:5px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:color .15s ease, background .15s ease;
}

.ai-speak-btn:hover{
  color:#ffd21f;
  background:#333;
}

.ai-speak-btn.is-speaking{
  color:#ffd21f;
}

.ai-speak-btn svg{
  width:14px;
  height:14px;
  display:block;
}

.ai-bubble-wrap .ai-bubble{
  max-width:100%;
  flex:1;
  min-width:0;
}

.ai-msg.user .ai-bubble{
  background:#ffd21f;
  color:#080808;
  font-weight:800;
}

.ai-support-quick{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  padding:0 14px 10px;
  background:#121212;
}

.ai-chip{
  border:1px solid #3a3a3a;
  background:#1c1c1c;
  color:#fff;
  border-radius:999px;
  padding:10px 12px;
  font-weight:800;
  font-size:12px;
  cursor:pointer;
  min-height:44px;
}

.ai-chip-primary{
  background:#ffd21f;
  color:#080808;
  border-color:#ffd21f;
}

.ai-chip-muted{
  background:#151515;
  color:#aaa;
  border-color:#333;
}

.ai-support-form{
  display:flex;
  align-items:flex-end;
  gap:8px;
  padding:12px calc(12px + env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
  border-top:1px solid #2c2c2c;
  background:#070707;
}

.ai-support-form textarea{
  flex:1;
  min-width:0;
  resize:none;
  min-height:46px;
  max-height:110px;
  border:1px solid #3a3a3a;
  background:#151515;
  color:#fff;
  border-radius:8px;
  padding:11px;
  font:inherit;
  font-size:16px;
}

.ai-mic-btn{
  border:0;
  border-radius:8px;
  background:#2a2a2a;
  color:#bdbdbd;
  min-height:44px;
  width:44px;
  cursor:pointer;
  padding:8px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:color .15s ease, background .15s ease;
}

.ai-mic-btn:hover{
  color:#fff;
  background:#333;
}

.ai-mic-btn.is-recording{
  color:#ff4444;
  background:#2a1515;
  animation:aiMicPulse 1s ease-in-out infinite;
}

.ai-mic-btn svg{
  width:18px;
  height:18px;
  display:block;
}

@keyframes aiMicPulse{
  0%,100%{box-shadow:0 0 0 0 rgba(255,68,68,.45)}
  50%{box-shadow:0 0 0 8px rgba(255,68,68,0)}
}

.ai-send{
  border:0;
  border-radius:8px;
  background:#ffd21f;
  color:#080808;
  font-weight:900;
  padding:0 16px;
  cursor:pointer;
  min-height:44px;
}

.ai-cta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
}

.ai-cta a,
.ai-cta button{
  border:0;
  border-radius:8px;
  background:#ffd21f;
  color:#080808;
  text-decoration:none;
  font-weight:900;
  padding:9px 10px;
  cursor:pointer;
  min-height:44px;
}

.ai-cta .secondary{
  background:#2a2a2a;
  color:#fff;
}

.ai-actions{
  margin:8px 0 0;
  padding-left:18px;
  white-space:normal;
}

.ai-actions li{
  margin:3px 0;
}

.ai-summary{
  margin-top:8px;
  border-top:1px solid #ddd;
  padding-top:8px;
  color:#333;
  font-size:12px;
  white-space:normal;
}

.ai-emergency-lead{
  margin:0 0 8px;
  font-weight:800;
  line-height:1.45;
}

.ai-emergency-steps p{
  margin:0 0 6px;
  line-height:1.45;
}

.ai-emergency-rec{
  margin:10px 0 4px;
  font-weight:800;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:#cfcfcf;
}

.ai-emergency-action{
  margin:8px 0 0;
  line-height:1.45;
  font-size:14px;
}

.ai-emergency-note{
  margin:0 0 8px;
  font-size:13px;
  font-weight:800;
  color:#ffb3ad;
  line-height:1.45;
}

.ai-follow-up{
  margin-top:4px;
}

.ai-urgency{
  display:inline-flex;
  border-radius:999px;
  padding:4px 8px;
  font-size:11px;
  font-weight:900;
  margin-bottom:6px;
  background:#eee;
  color:#111;
}

.ai-urgency.stop_driving_urgent_inspection{
  background:#ffe4e1;
  color:#9d1f18;
}

.ai-urgency.drive_carefully_and_book_service{
  background:#fff0b8;
  color:#111;
}

.ai-dx-card-wrap{
  max-width:100%;
  white-space:normal;
}

.ai-dx-safety{
  display:inline-flex;
  border-radius:8px;
  padding:6px 10px;
  font-size:12px;
  font-weight:900;
  margin-bottom:10px;
}

.ai-dx-safety.ai-safety-green{background:#e7f8ef;color:#0f6b3f}
.ai-dx-safety.ai-safety-yellow{background:#fff4cc;color:#7a5a00}
.ai-dx-safety.ai-safety-red{background:#ffe4e1;color:#9d1f18}

.ai-dx-domain{
  display:inline-flex;
  margin:0 0 8px 6px;
  border-radius:999px;
  padding:4px 8px;
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
  background:#f0f0f0;
  color:#444;
}

.ai-dx-intro{
  margin:0 0 10px;
  line-height:1.45;
  font-size:14px;
}

.ai-dx-section{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid #ececec;
}

.ai-dx-section-title{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:#666;
  margin-bottom:6px;
}

.ai-dx-lead,.ai-dx-recommendation{
  margin:0;
  line-height:1.45;
  font-size:14px;
}

.ai-dx-cause{
  margin:0 0 8px;
  padding:8px;
  border-radius:8px;
  background:#f7f7f7;
}

.ai-dx-cause-head{
  font-weight:800;
  font-size:13px;
  margin-bottom:4px;
}

.ai-dx-cause-evidence,.ai-dx-cause-confirm{
  margin:0 0 4px;
  font-size:12px;
  line-height:1.4;
  color:#444;
}

.ai-dx-list{margin:0;padding-left:18px}
.ai-dx-otofix{margin:0;line-height:1.45;font-size:14px;font-weight:800;color:#111}
.ai-dx-disclaimer{margin:10px 0 0;font-size:11px;color:#777;line-height:1.35}
.ai-dx-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.ai-dx-chips .ai-chip{font-size:11px;min-height:36px;padding:8px 10px}

.ai-typing-dots{
  display:inline-flex;
  align-items:center;
  gap:5px;
  min-height:1.2em;
  padding:2px 0;
}

.ai-typing-dots span{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#8a8a8a;
  animation:aiTypingDot 1.2s infinite ease-in-out;
}

.ai-typing-dots span:nth-child(2){
  animation-delay:.15s;
}

.ai-typing-dots span:nth-child(3){
  animation-delay:.3s;
}

@keyframes aiTypingDot{
  0%,80%,100%{transform:scale(.65);opacity:.45}
  40%{transform:scale(1);opacity:1}
}

@keyframes autofixPulse{
  0%{transform:scale(.9);opacity:.75}
  70%,100%{transform:scale(1.35);opacity:0}
}

@keyframes autofixSpin{
  to{transform:rotate(360deg)}
}

.ai-brand-icon{
  display:block;
  width:78%;
  height:78%;
  object-fit:contain;
  position:relative;
  z-index:1;
}

.ai-mini-logo .ai-brand-icon{
  width:88%;
  height:88%;
}

@media (min-width:769px){
  .ai-support-panel{
    left:auto;
    right:18px;
    bottom:76px;
    width:min(390px, calc(100vw - 24px));
    border-radius:10px;
    height:min(640px, calc(100vh - 100px));
    max-height:calc(100vh - 100px);
    box-shadow:0 24px 80px #0008;
  }

  .ai-support-launcher{
    right:18px;
    bottom:18px;
  }
}

@media (max-width:768px){
  body.ai-chat-open .hero-actions,
  body.ai-chat-open .save-bar{
    margin-bottom:72px;
  }

  .ai-support-panel.open{
    left:0;
    right:0;
    bottom:0;
    width:100%;
    max-width:none;
    height:100dvh;
    max-height:100dvh;
    border-radius:0;
    border-left:0;
    border-right:0;
    border-bottom:0;
    grid-template-rows:auto minmax(0,1fr) auto auto auto;
  }

  .ai-support-head{
    padding:max(10px,env(safe-area-inset-top)) 14px 10px;
  }

  .ai-support-avatar,
  .ai-mini-logo{
    width:34px;
    height:34px;
    flex-shrink:0;
  }

  .ai-brand-icon{
    width:22px;
    height:22px;
    max-width:22px;
    max-height:22px;
  }

  .ai-support-log{
    min-height:0;
    padding:12px 14px;
  }

  .ai-support-quick{
    flex-wrap:nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
    gap:8px;
    padding:0 14px 10px;
  }

  .ai-support-quick::-webkit-scrollbar{
    display:none;
  }

  .ai-chip{
    flex:0 0 auto;
    white-space:nowrap;
    font-size:13px;
    padding:10px 14px;
  }

  .ai-support-legal{
    flex-wrap:nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
    gap:10px 14px;
    padding:8px 14px max(10px,env(safe-area-inset-bottom));
  }

  .ai-support-legal::-webkit-scrollbar{
    display:none;
  }

  .ai-support-legal a{
    flex:0 0 auto;
    white-space:nowrap;
    font-size:12px;
    padding:4px 0;
  }

  .ai-support-form textarea{
    font-size:16px;
  }

  .ai-support-launcher{
    bottom:max(14px,env(safe-area-inset-bottom));
    z-index:40;
  }

  body.workshop-profile-route .ai-support-launcher,
  html.claim-landing-route .ai-support-launcher{
    bottom:max(14px,env(safe-area-inset-bottom));
  }
}
