.mgs-chat{position:fixed;inset:0;z-index:120;pointer-events:none}

.mgs-chat__launcher{position:fixed;z-index:0;pointer-events:auto;display:inline-flex;align-items:center;gap:.45rem;right:max(16px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));min-height:40px;padding:.42rem .8rem .42rem .58rem;background:var(--metal);color:#fff;border:1px solid rgba(255,255,255,.16);border-radius:999px;box-shadow:var(--shadow-lg);font-family:var(--font-sans);font-size:.67rem;line-height:1;text-transform:uppercase;letter-spacing:.05em;font-weight:800;cursor:pointer;transition:transform .2s ease,background .2s ease,box-shadow .2s ease}
.mgs-chat__launcher:hover{background:var(--color-brand-hover);transform:translateY(-2px)}
.mgs-chat__launcher-icon{position:relative;flex:0 0 auto;width:17px;height:15px}
.mgs-chat__launcher-icon::before{content:"";position:absolute;left:1px;top:1px;width:14px;height:11px;border:2px solid currentColor;border-radius:4px}
.mgs-chat__launcher-icon::after{content:"";position:absolute;left:4px;bottom:-1px;width:0;height:0;border:4px solid transparent;border-top:0;border-bottom-color:currentColor;transform:rotate(38deg)}
.mgs-chat__launcher-dot{position:absolute;top:4px;right:4px;width:8px;height:8px;border-radius:50%;background:var(--color-success);border:2px solid #fff;animation:mgsPulse 2s ease-in-out infinite}
@keyframes mgsPulse{0%,100%{box-shadow:0 0 0 0 rgba(34,197,94,.45)}50%{box-shadow:0 0 0 6px rgba(34,197,94,0)}}

.mgs-chat__panel{position:fixed;z-index:1;pointer-events:auto;right:max(16px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));width:min(26rem,calc(100vw - 1.5rem));height:min(80vh,40rem);display:flex;flex-direction:column;background:var(--paper);color:var(--ink);border:1px solid var(--line);border-radius:var(--radius-lg,16px);box-shadow:var(--shadow-xl);overflow:hidden;font-family:var(--font-sans);animation:mgsPanelIn .22s ease-out}
.mgs-chat__panel[hidden]{display:none}
@keyframes mgsPanelIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}

/* Turnstile mounts here (inside the panel), never on the launcher button. */
.mgs-chat__verify{flex:0 0 auto;display:flex;justify-content:center;padding:0 1rem .55rem}
.mgs-chat__verify:empty{display:none}

.mgs-chat__header{flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.85rem 1rem;background:var(--ink);color:#fff}
.mgs-chat__title{font-size:.92rem;font-weight:800;letter-spacing:.02em}
.mgs-chat__close{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:32px;height:32px;border:0;border-radius:50%;background:transparent;color:#fff;cursor:pointer;transition:background .15s ease}
.mgs-chat__close:hover{background:rgba(255,255,255,.15)}

.mgs-chat__body{flex:1 1 auto;min-height:0;overflow-y:auto;padding:1rem 1rem .5rem;display:flex;flex-direction:column;scroll-behavior:smooth}
.mgs-chat__messages{display:flex;flex-direction:column;gap:.6rem}
.mgs-chat__quick{display:flex;flex-direction:column;gap:.5rem;padding-top:.6rem}

.mgs-chat__msg{max-width:85%;padding:.65rem .85rem;border-radius:var(--radius-md,12px);font-size:.92rem;line-height:1.45;word-wrap:break-word;overflow-wrap:anywhere}
.mgs-chat__msg--assistant{align-self:flex-start;background:var(--warm-white);border:1px solid var(--line);color:var(--ink);border-bottom-left-radius:4px}
.mgs-chat__msg--user{align-self:flex-end;background:var(--metal);color:#fff;border-bottom-right-radius:4px}
.mgs-chat__error{align-self:center;color:var(--color-error);font-size:.85rem;text-align:center;line-height:1.4}
.mgs-chat__typing{align-self:flex-start;font-style:italic;color:var(--color-ink-muted);font-size:.85rem}
.mgs-chat__emergency{align-self:stretch;padding:.75rem .9rem;background:var(--color-error-light);border-left:3px solid var(--color-error);border-radius:var(--radius-sm,8px);color:var(--ink);font-size:.9rem;line-height:1.55}
.mgs-chat__emergency a{color:var(--color-brand);font-weight:800;text-decoration:underline}
.mgs-chat__emergency strong{color:var(--color-error)}

.mgs-chat__quick-btn{display:block;width:100%;text-align:left;padding:.6rem .85rem;background:var(--paper);border:1px solid var(--color-brand-light);border-radius:var(--radius-md,12px);color:var(--ink);font-family:var(--font-sans);font-size:.85rem;line-height:1.35;cursor:pointer;transition:background .15s ease,border-color .15s ease}
.mgs-chat__quick-btn:hover{background:var(--color-brand-light);border-color:var(--metal)}

.mgs-chat__composer{flex:0 0 auto;display:flex;align-items:flex-end;gap:.6rem;padding:.7rem 1rem;border-top:1px solid var(--line);background:var(--paper)}
.mgs-chat__composer .visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.mgs-chat__input{flex:1 1 auto;min-height:44px;max-height:120px;padding:.65rem .85rem;background:var(--input-bg);border:1px solid var(--input-border);border-radius:var(--radius-md,12px);color:var(--ink);font-family:var(--font-sans);font-size:.92rem;line-height:1.4;resize:none;outline:none;transition:border-color .15s ease,box-shadow .15s ease}
.mgs-chat__input:focus{border-color:var(--input-border-focus);box-shadow:0 0 0 3px var(--color-brand-light)}
.mgs-chat__input::placeholder{color:var(--input-placeholder)}
.mgs-chat__input:disabled{background:var(--color-surface-hover);cursor:not-allowed}
.mgs-chat__send{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border:0;border-radius:50%;background:var(--metal);color:#fff;cursor:pointer;transition:background .15s ease,transform .15s ease}
.mgs-chat__send:hover{background:var(--color-brand-hover);transform:translateY(-1px)}
.mgs-chat__send:disabled{background:var(--color-disabled);cursor:not-allowed;transform:none}

.mgs-chat__footer{flex:0 0 auto;display:flex;justify-content:space-between;gap:.75rem;padding:.6rem 1rem;background:var(--warm-white);font-size:.8rem}
.mgs-chat__footer a{color:var(--color-brand);font-weight:800;text-decoration:none}
.mgs-chat__footer a:hover{text-decoration:underline}

.quote-wizard{display:block}

.quote-wizard__head{margin-bottom:1.25rem}
.quote-wizard__eyebrow{display:inline-block;margin:0 0 .5rem;color:var(--metal);font-size:.68rem;line-height:1.3;text-transform:uppercase;letter-spacing:.12em;font-weight:850}
.quote-wizard .quote-wizard__title{position:static;width:auto;height:auto;padding:0;margin:0 0 .35rem;overflow:visible;clip:auto;clip-path:none;white-space:normal;border:0;color:var(--ink);font-size:clamp(1.35rem,2.4vw,1.7rem);line-height:1.2;font-weight:850}
.quote-wizard__subtitle{margin:0;color:var(--color-ink-muted);font-size:.95rem;line-height:1.45}

.quote-wizard__progress{display:flex;align-items:center;list-style:none;margin:0 0 1.6rem;padding:0}
.quote-wizard__dot{position:relative;flex:0 0 auto;width:10px;height:10px;padding:0;margin:0;border:0;border-radius:50%;background:var(--line);cursor:default;transition:background .2s ease,transform .2s ease,box-shadow .2s ease}
.quote-wizard__dot::after{content:"";position:absolute;top:50%;left:10px;width:20px;height:2px;background:var(--line);transform:translateY(-50%);transition:background .2s ease}
.quote-wizard__dot:last-child::after{display:none}
.quote-wizard__dot.is-done{background:var(--metal);cursor:pointer}
.quote-wizard__dot.is-done::after{background:var(--metal)}
.quote-wizard__dot.is-active{background:var(--metal);transform:scale(1.25);box-shadow:0 0 0 4px var(--color-brand-light)}

.quote-wizard__step{animation:mgsStepIn .22s ease-out}
.quote-wizard__step[hidden]{display:none}
@keyframes mgsStepIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

.quote-wizard__error{margin:0 0 1rem;padding:.75rem .9rem;background:var(--color-error-light);border:1px solid var(--color-error);border-left-width:3px;border-radius:var(--radius-sm,8px);color:#7f1d1d;font-size:.9rem;font-weight:650;line-height:1.45}
.quote-wizard__error[hidden]{display:none}

.quote-wizard__cards{display:grid;grid-template-columns:repeat(2,1fr);gap:.8rem}
.quote-wizard__card{position:relative;display:flex;flex-direction:column;gap:.3rem;text-align:left;padding:1rem 1.1rem;background:var(--paper);border:1px solid var(--line);border-radius:var(--radius-md,12px);color:var(--ink);font-family:var(--font-sans);cursor:pointer;transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease}
.quote-wizard__card:hover{border-color:var(--metal);box-shadow:var(--shadow-card-hover);transform:translateY(-2px)}
.quote-wizard__card.is-selected{background:var(--color-brand-light);border-color:var(--metal);box-shadow:inset 0 0 0 1px var(--metal)}
.quote-wizard__card.is-selected::after{content:"";position:absolute;top:.6rem;right:.6rem;width:18px;height:18px;border-radius:50%;background:var(--metal) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat}
.quote-wizard__card-title{font-size:.95rem;font-weight:800;color:var(--ink);line-height:1.3}
.quote-wizard__card-desc{font-size:.82rem;color:var(--color-ink-muted);line-height:1.4}

.quote-wizard__option-list{display:grid;gap:.6rem}
.quote-wizard__option{display:flex;align-items:center;width:100%;min-height:46px;padding:.7rem .95rem;background:var(--paper);border:1px solid var(--line);border-radius:var(--radius-sm,8px);color:var(--ink);font-family:var(--font-sans);font-size:.9rem;font-weight:650;text-align:left;cursor:pointer;transition:background .18s ease,border-color .18s ease,color .18s ease}
.quote-wizard__option:hover{border-color:var(--metal)}
.quote-wizard__option.is-selected{background:var(--metal);border-color:var(--metal);color:#fff}

.quote-wizard__field{display:grid;gap:.4rem;margin-bottom:1.1rem}
.quote-wizard__field-label{display:block;color:var(--color-ink-muted);font-size:.7rem;text-transform:uppercase;letter-spacing:.075em;font-weight:800;line-height:1.3}
.quote-wizard__input:focus-visible{outline:3px solid var(--color-brand-focus);outline-offset:2px}
.quote-wizard__hint{margin-top:.15rem;color:var(--color-ink-muted);font-size:.82rem;line-height:1.45}

.quote-wizard__grid{display:grid;grid-template-columns:1fr 1fr;gap:0 1.1rem}

.quote-wizard__photos{margin-top:1.2rem}
.quote-wizard__drop{display:flex;align-items:center;justify-content:center;width:100%;min-height:52px;padding:.7rem;background:var(--paper);border:1.5px dashed var(--line);border-radius:var(--radius-md,12px);color:var(--ink);font-family:var(--font-sans);font-size:.85rem;font-weight:750;cursor:pointer;transition:border-color .18s ease,background .18s ease}
.quote-wizard__drop:hover{border-color:var(--metal);background:var(--color-brand-light)}
.quote-wizard__drop:disabled{opacity:.6;cursor:not-allowed}
.quote-wizard__photo-list{display:grid;gap:.55rem;margin-top:.8rem}
.quote-wizard__photo{display:flex;align-items:center;gap:.7rem;padding:.55rem .7rem;background:var(--warm-white);border:1px solid var(--line);border-radius:var(--radius-sm,8px)}
.quote-wizard__photo-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.85rem;font-weight:650;color:var(--ink)}
.quote-wizard__photo-status{flex:0 0 auto;font-size:.75rem}
.quote-wizard__photo.is-uploading .quote-wizard__photo-status{color:var(--color-ink-muted);font-style:italic}
.quote-wizard__photo.is-done .quote-wizard__photo-status{color:var(--color-success);font-weight:750}
.quote-wizard__photo-img{flex:0 0 auto;width:42px;height:42px;object-fit:cover;border:1px solid var(--line);border-radius:var(--radius-sm,8px)}
.quote-wizard__photo-remove{flex:0 0 auto;padding:.25rem .35rem;background:none;border:0;color:var(--color-error);font-family:var(--font-sans);font-size:.78rem;font-weight:750;text-decoration:underline;cursor:pointer}

.quote-wizard__summary{margin-bottom:1.2rem;border:1px solid var(--line);border-radius:var(--radius-md,12px);overflow:hidden}
.quote-wizard__summary-row{display:flex;justify-content:space-between;gap:1rem;padding:.7rem .9rem;background:var(--paper)}
.quote-wizard__summary-row + .quote-wizard__summary-row{border-top:1px solid var(--line)}
.quote-wizard__summary-label{flex:0 0 auto;padding-top:.2rem;color:var(--color-ink-muted);font-size:.68rem;text-transform:uppercase;letter-spacing:.07em;font-weight:800}
.quote-wizard__summary-value{flex:1 1 auto;text-align:right;color:var(--ink);font-size:.9rem;font-weight:650;line-height:1.4;word-break:break-word}
.quote-wizard__consent{display:flex!important;align-items:flex-start;gap:.7rem;padding:1rem .9rem;cursor:pointer;color:var(--color-ink)!important;text-transform:none!important;letter-spacing:0!important;font-weight:500!important;font-size:.85rem;line-height:1.45}
.quote-wizard__consent input{flex:0 0 auto;width:18px;height:18px;margin-top:.15rem;accent-color:var(--metal)}
.quote-wizard__notice.is-emergency{margin:0 0 1rem;padding:.8rem .95rem;background:var(--color-error-light);border-left:3px solid var(--color-error);border-radius:var(--radius-sm,8px);color:var(--ink);font-size:.88rem;line-height:1.55}
.quote-wizard__notice a{color:var(--color-brand);font-weight:800;text-decoration:underline}

.quote-wizard__turnstile{min-height:65px;margin:.5rem 0 .25rem}
.quote-wizard__turnstile:empty{display:none}

.quote-wizard__nav{display:flex;align-items:center;justify-content:flex-end;gap:.75rem;margin-top:1.6rem;flex-wrap:wrap}
.quote-wizard__back,.quote-wizard__next,.quote-wizard__submit{display:inline-flex;align-items:center;justify-content:center;gap:.6rem;min-height:48px;padding:.75rem 1.15rem;border-radius:var(--radius-sm,8px);font-family:var(--font-sans);font-size:.72rem;line-height:1;text-transform:uppercase;letter-spacing:.09em;font-weight:830;cursor:pointer;transition:background .2s ease,color .2s ease,border-color .2s ease,transform .2s ease}
.quote-wizard__back{background:var(--paper);border:1px solid var(--line);color:var(--ink)}
.quote-wizard__back:hover{border-color:var(--metal);color:var(--metal)}
.quote-wizard__next,.quote-wizard__submit{background:var(--metal);border:1px solid var(--metal);color:#fff}
.quote-wizard__next:hover,.quote-wizard__submit:hover{background:var(--color-brand-hover);border-color:var(--color-brand-hover);transform:translateY(-2px)}
.quote-wizard__back:disabled,.quote-wizard__next:disabled,.quote-wizard__submit:disabled{opacity:.55;cursor:not-allowed;transform:none}
.quote-wizard__back[hidden],.quote-wizard__next[hidden],.quote-wizard__submit[hidden]{display:none}

.quote-wizard__original[hidden]{display:none}

.quote-wizard__card:focus-visible,.quote-wizard__option:focus-visible,.quote-wizard__back:focus-visible,.quote-wizard__next:focus-visible,.quote-wizard__submit:focus-visible,.quote-wizard__drop:focus-visible,.quote-wizard__photo-remove:focus-visible,.quote-wizard__dot:focus-visible{outline:3px solid var(--color-brand-focus);outline-offset:2px}
.mgs-chat__launcher:focus-visible,.mgs-chat__close:focus-visible,.mgs-chat__send:focus-visible,.mgs-chat__quick-btn:focus-visible{outline:3px solid var(--color-brand-focus);outline-offset:2px}

@media (max-width:590px){
  .mgs-chat__launcher{right:max(16px,env(safe-area-inset-right));bottom:calc(max(14px,env(safe-area-inset-bottom)) + 68px)}
  .mgs-chat__panel{right:0;bottom:0;left:0;top:0;width:auto;height:100dvh;height:100vh;border-radius:0;border-left:0;border-right:0;border-bottom:0;animation:mgsPanelInUp .22s ease-out}
  @keyframes mgsPanelInUp{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:none}}
  .quote-wizard__cards{grid-template-columns:1fr}
  .quote-wizard__grid{grid-template-columns:1fr}
}

@media print{.mgs-chat{display:none}}

@media (prefers-reduced-motion:reduce){
  .mgs-chat__launcher,.mgs-chat__panel,.mgs-chat__send,.mgs-chat__quick-btn,.quote-wizard__card,.quote-wizard__option,.quote-wizard__back,.quote-wizard__next,.quote-wizard__submit,.quote-wizard__dot,.quote-wizard__step{transition:none;animation:none;transform:none}
  .mgs-chat__launcher-dot{animation:none}
}
