/* MAS 351 – chat-style fact-find */
.masbox{max-width:880px}
.mas-head{display:flex;align-items:center;gap:12px;padding:0 0 14px;margin:0 0 12px;border-bottom:1px solid #f0e1e3}
.mas-title{flex:1;min-width:0}
.mas-avatar{position:relative;flex:none;width:44px;height:44px;border-radius:12px;background:linear-gradient(135deg,#b51f2b,#ff535d);color:#fff;font-weight:800;font-size:13px;display:flex;align-items:center;justify-content:center;letter-spacing:.5px}
.mas-avatar::after{content:"";position:absolute;right:-3px;bottom:-3px;width:12px;height:12px;border-radius:50%;background:#22c55e;border:2px solid #fff}
.mas-head strong{display:block;font-size:15px;color:#202124}
.mas-head span{font-size:12px;color:#6b7280}
.mas-count{flex:none;font-size:12px;font-weight:700;color:#b51f2b;background:#fbecee;border-radius:30px;padding:5px 11px}
.mas-track{height:6px;border-radius:6px;background:#f1e3e5;overflow:hidden;margin:0 0 14px}
.mas-track i{display:block;height:100%;width:0;border-radius:6px;background:linear-gradient(90deg,#b51f2b,#ff535d);background-size:200% 100%;transition:width .6s cubic-bezier(.2,.7,.2,1)}
.masbox .masnote{font-size:13px;margin:0 0 4px}
.masbox .credit-links{font-size:13px;margin:0 0 14px}

.mas-chat{display:flex;flex-direction:column;gap:8px;max-height:430px;overflow-y:auto;padding:16px;margin:0 0 14px;background:#f7f8fa;border:1px solid #eceef1;border-radius:14px;scroll-behavior:smooth}
.mas-msg{max-width:82%;padding:10px 14px;border-radius:16px;font-size:14px;line-height:1.45;overflow-wrap:anywhere}
.mas-msg.bot{align-self:flex-start;background:#fff;border:1px solid #e7e8ec;border-radius:16px 16px 16px 4px;color:#374151}
.mas-msg.bot.small{font-size:12.5px;color:#6b7280;padding:7px 12px}
.mas-msg.bot.current strong{display:block;font-size:17px;line-height:1.35;color:#202124;margin-bottom:3px}
.mas-msg.bot.current span{display:block;font-size:13px;color:#6b7280}
.mas-msg.you{align-self:flex-end;background:#b51f2b;color:#fff;border:0;border-radius:16px 16px 4px 16px;font:inherit;font-size:14px;font-weight:600;cursor:pointer;text-align:right}
.mas-msg.you:hover,.mas-msg.you:focus-visible{background:#8e1720;outline:2px solid #ff535d;outline-offset:2px}
.mas-typing{align-self:flex-start;display:flex;align-items:center;gap:5px;padding:12px 16px;background:#fff;border:1px solid #e7e8ec;border-radius:16px 16px 16px 4px}
.mas-typing i{width:7px;height:7px;border-radius:50%;background:#b51f2b;opacity:.35;animation:mas-type 1.1s infinite}
.mas-typing i:nth-child(2){animation-delay:.15s}.mas-typing i:nth-child(3){animation-delay:.3s}

.mas-answer{transition:opacity .25s}
.mas-answer.waiting{opacity:.35;pointer-events:none}
.mas-chips{display:flex;flex-wrap:wrap;gap:8px}
.mas-chips .chip{font:inherit;font-size:14px;font-weight:600;padding:10px 16px;border-radius:30px;border:1.5px solid #e2c4c8;background:#fff;color:#202124;cursor:pointer;transition:background .2s,border-color .2s,color .2s,transform .2s}
.mas-chips .chip:hover{border-color:#b51f2b;color:#b51f2b;transform:translateY(-1px)}
.mas-chips .chip[aria-pressed="true"]{background:#b51f2b;border-color:#b51f2b;color:#fff}
.mas-chips .chip:focus-visible{outline:3px solid #ff535d;outline-offset:2px}
.masbox textarea,.mas-money input,.mas-answer input{display:block;width:100%;padding:13px 14px;border:1px solid #cfd5dc;border-radius:10px;font:inherit;font-size:16px;color:#202124;background:#fff;transition:border-color .2s,box-shadow .2s}
.masbox textarea:focus,.mas-answer input:focus{outline:none;border-color:#b51f2b;box-shadow:0 0 0 4px rgba(181,31,43,.12)}
.mas-money{position:relative}
.mas-money span{position:absolute;left:14px;top:50%;transform:translateY(-50%);font-weight:700;color:#6b7280;pointer-events:none}
.mas-money input{padding-left:30px!important;font-weight:600}
.mas-sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.mas-err{min-height:1.3em;margin:8px 0 0;font-size:13px;font-weight:600;color:#b51f2b}
.masbox .mas-actions{margin-top:10px}
#mas-next[hidden]{display:none}

#mas-result h3{margin:4px 0 6px;color:#202124}
#mas-result h4{margin:20px 0 8px;font-size:15px;color:#202124}
#mas-result h4 small{font-weight:400;color:#6b7280}
.mas-checklist{display:grid;gap:6px}
.mas-checklist label{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border:1px solid #eceef1;border-radius:10px;font-size:14px;cursor:pointer;transition:background .2s,border-color .2s}
.mas-checklist label:has(input:checked){background:#f2faf5;border-color:#bfe3cc;color:#4b5563;text-decoration:line-through}
.mas-checklist input{accent-color:#1f8a4c;width:18px;height:18px;margin-top:2px;flex:none}
.mas-review{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);margin:0;border-top:1px solid #eceef1}
.mas-review dt,.mas-review dd{margin:0;padding:9px 4px;border-bottom:1px solid #eceef1;font-size:13.5px}
.mas-review dt{color:#6b7280}
.mas-editone{font:inherit;font-weight:700;color:#202124;background:none;border:0;padding:0;cursor:pointer;text-align:left;text-decoration:underline dotted #b51f2b;text-underline-offset:3px}
.mas-editone:hover{color:#b51f2b}
.mas-warn{margin:18px 0 6px;padding:12px 14px;border-left:3px solid #b51f2b;background:#fbf3f4;font-size:13px}

/* Motion (only with .m351, i.e. not when reduced motion is requested) */
.m351 .mas-msg.new{animation:mas-in .45s cubic-bezier(.2,.7,.2,1) both}
.m351 .mas-msg.you.new{animation-name:mas-in-r}
.m351 .mas-chips .chip{animation:mas-in .4s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i,0)*45ms)}
.m351 .mas-answer.shake{animation:mas-shake .4s}
.m351 #mas-result.show{animation:m351-rise .7s cubic-bezier(.2,.7,.2,1) both}
.m351 #mas-result.show .mas-checklist label{animation:mas-in .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(.2s + var(--i,0)*50ms)}
.m351 .mas-track i{animation:m351-shimmer 2.4s linear infinite}
@keyframes mas-type{0%,60%,100%{opacity:.3;transform:none}30%{opacity:1;transform:translateY(-4px)}}
@keyframes mas-in{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
@keyframes mas-in-r{from{opacity:0;transform:translateX(16px) scale(.96)}to{opacity:1;transform:none}}
@keyframes mas-shake{0%,100%{transform:none}25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}

@media(max-width:600px){.mas-msg{max-width:92%}.mas-chat{max-height:360px;padding:12px}.mas-review{grid-template-columns:1fr}.mas-review dt{border-bottom:0;padding-bottom:0}.mas-count{display:none}}
@media print{#mas-result .mas-actions,.mas-warn{display:none!important}.mas-checklist label{border:0;padding:2px 0}}
.masbox .mas-checklist label{display:flex;margin:0;font-weight:500;color:#202124}
.masbox .mas-checklist input{display:inline-block;width:18px;height:18px;padding:0;margin:2px 0 0}
.mas-chat{max-height:min(380px,46vh)}
