/* BioEngix chat button system + App Store extras (2026-10-22)
   One size: 44pt hit area. Icons 20px, 1.8 stroke, secondary colour.
   One primary action per surface (send / continue). */
:root{--mx-hit:44px;--mx-ic:20px;--mx-gap:4px}

/* ---------- answer action row ---------- */
.acts{gap:0;margin:8px 0 0 -12px;align-items:center}
.acts .act{width:var(--mx-hit);height:var(--mx-hit);border-radius:50%;color:var(--text-3);background:transparent;-webkit-tap-highlight-color:transparent}
.acts .act svg{width:var(--mx-ic);height:var(--mx-ic)}
.acts .act:hover{background:var(--hover);color:var(--text-2)}
.acts .act:active{transform:scale(.92)}
.acts .act[aria-pressed="true"]{color:var(--accent)}
.acts .act[aria-pressed="true"] svg path{fill:currentColor;fill-opacity:.16}
.acts .meta{margin-left:6px;font-size:12px;color:var(--text-3)}
.acts .mx-sep{flex:1}

/* ---------- user bubble actions (edit / copy) ---------- */
.turn-u{position:relative}
.turn-u .mx-uacts{display:flex;justify-content:flex-end;gap:0;margin:2px -10px 0 0;opacity:0;transition:opacity .18s}
.turn-u:hover .mx-uacts,.turn-u.mx-show .mx-uacts,.turn-u .mx-uacts:focus-within{opacity:1}
@media (pointer:coarse){.turn-u .mx-uacts{display:none}.turn-u.mx-show .mx-uacts{display:flex}}
.mx-uacts button{width:var(--mx-hit);height:var(--mx-hit);border:0;border-radius:50%;background:transparent;color:var(--text-3);display:grid;place-items:center;cursor:pointer}
.mx-uacts button svg{width:18px;height:18px}

/* ---------- citation chips ---------- */
.cite{min-width:22px;height:22px;padding:0 6px;font-size:12px;font-weight:700;background:var(--accent-soft);color:var(--accent);transition:background .15s,color .15s}
.cite::before{width:44px;height:44px}

/* ---------- suggestion + follow-up chips ---------- */
.follows{gap:8px}
.follows .pill,.mx-ex .pill{min-height:var(--mx-hit);padding:0 16px;font-size:15px;color:var(--text-1);border-radius:22px}
.mx-scanpill{display:inline-flex;align-items:center;gap:8px}
.mx-scanpill svg{width:20px;height:20px;color:var(--accent)}

/* ---------- composer ---------- */
@media (max-width:767px){
  .composer{gap:0;padding:4px 4px 4px 2px}
  .composer .icon-btn{width:var(--mx-hit);height:var(--mx-hit);color:var(--text-2);border-radius:50%}
  .composer .icon-btn svg{width:22px;height:22px}
  .composer .send{width:36px;height:36px;margin:4px;position:relative}
  .composer .send::before{content:"";position:absolute;inset:-4px}
  .composer .send svg{width:20px;height:20px}
  .composer .send:disabled{opacity:1;background:var(--hover);color:var(--text-3)}
  /* app: empty composer shows scan + mic; typing swaps them for send (one primary action) */
  body.mx-native .composer textarea:placeholder-shown~.tools .send:not(:focus){display:none}
  body.mx-native.asking .composer .send{display:grid!important}
  body.mx-native.asking .composer .mn-tool{display:none}
}

/* ---------- sheet (menus, reasons) ---------- */
.mx-scrim{position:fixed;inset:0;z-index:80;background:rgb(10 14 28/.28);opacity:0;transition:opacity .22s}
.mx-scrim.in{opacity:1}
.mx-sheet{position:fixed;z-index:81;left:50%;bottom:max(12px,env(safe-area-inset-bottom));width:min(420px,calc(100vw - 24px));transform:translate(-50%,24px);opacity:0;transition:transform .32s cubic-bezier(.22,.9,.24,1),opacity .2s;border-radius:26px;padding:8px;color:var(--text-1);max-height:80dvh;overflow:auto}
.mx-sheet.in{transform:translate(-50%,0);opacity:1}
.mx-sheet h3{margin:8px 12px 4px;font-size:13px;font-weight:600;color:var(--text-3);text-transform:none}
.mx-sheet .mx-item{display:flex;align-items:center;gap:14px;width:100%;min-height:50px;padding:0 14px;border:0;border-radius:16px;background:transparent;color:inherit;font-size:16px;text-align:left;cursor:pointer}
.mx-sheet .mx-item:hover,.mx-sheet .mx-item:active{background:var(--hover)}
.mx-sheet .mx-item svg{width:22px;height:22px;color:var(--text-2);flex:none}
.mx-sheet .mx-item.danger{color:var(--err,#c62828)}
.mx-sheet .mx-item.danger svg{color:currentColor}
.mx-sheet .mx-item[aria-checked="true"]{background:var(--accent-soft)}
.mx-sheet .mx-item[aria-checked="true"]::after{content:"✓";margin-left:auto;color:var(--accent);font-weight:700}
.mx-sheet textarea,.mx-sheet input{width:100%;box-sizing:border-box;margin:6px 0;min-height:44px;padding:10px 14px;border-radius:14px;border:1px solid var(--line);background:var(--surface);color:var(--text-1);font:inherit;font-size:16px}
.mx-sheet .mx-actions{display:flex;gap:8px;padding:8px 6px 4px}
.mx-sheet .mx-actions .btn{flex:1;min-height:var(--mx-hit)}
.mx-sheet .mx-pad{padding:4px 8px}

/* ---------- edit chip above composer ---------- */
.mx-editbar{display:flex;align-items:center;gap:8px;max-width:var(--col);margin:0 auto 6px;padding:0 6px 0 14px;min-height:36px;border-radius:18px;font-size:13px;color:var(--text-2)}
.mx-editbar b{font-weight:600;color:var(--accent)}
.mx-editbar span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mx-editbar button{width:var(--mx-hit);height:36px;border:0;background:transparent;color:var(--text-3);cursor:pointer;display:grid;place-items:center}
.mx-editbar svg{width:16px;height:16px}

/* ---------- safety note under electrical/safety answers ---------- */
.mx-safety{display:flex;gap:8px;align-items:flex-start;margin:10px 0 0;padding:8px 12px;border-radius:14px;background:rgb(230 150 20/.10);color:var(--text-2);font-size:13px;line-height:1.45}
.mx-safety svg{width:16px;height:16px;flex:none;margin-top:2px;color:#b26a00}
html[data-theme="dark"] .mx-safety svg{color:#ffb74d}

/* ---------- doc meta in source panel ---------- */
.mx-docmeta{display:block;margin-top:3px;font-size:12px;color:var(--text-3)}
.mx-docmeta b{font-weight:600;color:var(--text-2)}

/* ---------- offline banner + queue ---------- */
.mx-offline{position:fixed;z-index:60;left:50%;top:calc(env(safe-area-inset-top) + 64px);transform:translate(-50%,-12px);opacity:0;visibility:hidden;transition:transform .32s cubic-bezier(.22,.9,.24,1),opacity .2s,visibility 0s .32s;display:flex;align-items:center;gap:8px;padding:8px 14px;border-radius:999px;font-size:13px;font-weight:600;color:var(--text-1);pointer-events:none}
.mx-offline.in{transform:translate(-50%,0);opacity:1;visibility:visible;transition:transform .32s cubic-bezier(.22,.9,.24,1),opacity .2s}
.mx-offline i{width:8px;height:8px;border-radius:50%;background:#e0a100}
.turn-u .mx-queued{display:block;text-align:right;font-size:12px;color:var(--text-3);margin-top:4px}

/* ---------- chats: pins + folders ---------- */
.mx-folders{display:flex;gap:6px;overflow-x:auto;padding:8px 2px 2px;scrollbar-width:none;flex:none}
.mx-folders::-webkit-scrollbar{display:none}
.mx-folders button{flex:none;min-height:36px;padding:0 14px;border-radius:18px;border:1px solid var(--line);background:transparent;color:var(--text-2);font-size:14px;font-weight:500;cursor:pointer;white-space:nowrap}
.mx-folders button[aria-pressed="true"]{background:var(--accent-soft);border-color:transparent;color:var(--accent);font-weight:650}
@media (max-width:767px){.mx-folders button{min-height:40px;font-size:15px}}
.hist-item .mx-pin{flex:none;width:14px;height:14px;color:var(--text-3);margin-left:-2px}
.hist-item .mx-fold{flex:none;margin-left:auto;font-size:11.5px;color:var(--text-3);padding-left:6px;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-side="rail"] .mx-folders{display:none}

/* ---------- onboarding / consent ---------- */
.mx-ob{position:fixed;inset:0;z-index:90;display:grid;place-items:center;padding:max(20px,env(safe-area-inset-top)) 16px max(20px,env(safe-area-inset-bottom));background:var(--bg-mesh,none),var(--bg,#eaecf7)}
.mx-ob-card{width:min(440px,100%);border-radius:32px;padding:28px 22px 18px;display:flex;flex-direction:column;gap:14px;max-height:100%;overflow:auto}
.mx-ob-ic{width:64px;height:64px;border-radius:20px;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent)}
.mx-ob-ic svg{width:34px;height:34px}
.mx-ob h2{margin:0;font-size:26px;line-height:1.2;letter-spacing:-.01em}
.mx-ob p{margin:0;font-size:16px;line-height:1.5;color:var(--text-2)}
.mx-ob ul{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:10px}
.mx-ob li{display:flex;gap:12px;align-items:flex-start;font-size:15px;line-height:1.45;color:var(--text-1)}
.mx-ob li svg{width:22px;height:22px;flex:none;color:var(--accent);margin-top:1px}
.mx-ob .mx-fine{font-size:13px;color:var(--text-3)}
.mx-ob .mx-fine a{color:var(--accent)}
.mx-ob-dots{display:flex;gap:6px;justify-content:center;padding-top:4px}
.mx-ob-dots i{width:7px;height:7px;border-radius:50%;background:var(--line)}
.mx-ob-dots i.on{background:var(--accent);width:20px;border-radius:4px}
.mx-ob-nav{display:flex;gap:10px;margin-top:6px}
.mx-ob-nav .btn{flex:1;min-height:50px;font-size:16px}
.mx-check{display:flex;gap:12px;align-items:flex-start;font-size:15px;line-height:1.4;cursor:pointer;padding:10px 12px;border-radius:16px;background:var(--hover)}
.mx-check input{width:22px;height:22px;margin:0;flex:none;accent-color:var(--accent)}

/* ---------- settings info block ---------- */
.mx-setinfo{margin:10px 0 0;padding:12px 14px;border-radius:16px;background:var(--hover);font-size:13.5px;line-height:1.5;color:var(--text-2)}
.mx-setinfo b{color:var(--text-1)}
.mx-setinfo ul{margin:6px 0 0;padding-left:18px}
.mx-setinfo .btn{margin-top:10px;min-height:40px}

@media (prefers-reduced-motion:reduce){.mx-sheet,.mx-scrim,.mx-offline{transition:none}}
@media (prefers-contrast:more){.acts .act,.composer .icon-btn,.mx-uacts button{color:var(--text-1)}.cite{outline:1px solid currentColor}}

/* empty chat: examples + scan pill only for users without chats (the regular home stays clean) */
body.mx-fresh[data-view="home"] .sugg{display:grid}
body.mx-fresh[data-view="home"] .sugg>button:nth-child(n+4){display:none}
html[data-kb="1"] body.mx-fresh[data-view="home"] .sugg{display:none}
.sugg .mx-scanpill{flex-direction:row!important;align-items:center!important;gap:10px!important;min-height:44px!important;color:var(--accent)!important;font-weight:600}
.sugg .mx-scanpill svg{width:20px;height:20px;flex:none}
.mx-ob h2:focus,.mx-ob [tabindex="-1"]:focus{outline:none}
/* ---- mx2: quick search palette, theme button, try link (2026-10-23) ---- */
.mx-pal-wrap{position:fixed;inset:0;z-index:calc(var(--z-pop,80) + 5);display:flex;justify-content:center;align-items:flex-start;padding:min(14vh,120px) 16px 16px;background:rgba(10,14,30,.22)}
html[data-theme="dark"] .mx-pal-wrap{background:rgba(0,0,0,.45)}
.mx-pal{width:min(640px,100%);max-height:min(70vh,560px);display:flex;flex-direction:column;border-radius:22px;overflow:hidden}
.mx-pal-bar{display:flex;align-items:center;gap:10px;padding:6px 14px;border-bottom:1px solid var(--line);min-height:56px}
.mx-pal-bar svg{width:20px;height:20px;color:var(--text-3);flex:none}
.mx-pal-bar input{flex:1;min-width:0;border:0;background:transparent;color:var(--text-1);font:inherit;font-size:17px;outline:none;min-height:44px}
.mx-pal-bar input::-webkit-search-cancel-button{display:none}
.mx-pal kbd{font:600 11px/1 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--text-3);border:1px solid var(--line);border-radius:6px;padding:4px 6px;flex:none}
.mx-pal-list{overflow:auto;padding:6px;overscroll-behavior:contain}
.mx-pal-g{font-size:12px;font-weight:650;color:var(--text-3);padding:10px 12px 4px;text-transform:none}
.mx-pal-it{display:flex;align-items:center;gap:12px;width:100%;min-height:44px;padding:6px 12px;border:0;border-radius:12px;background:transparent;color:var(--text-1);font:inherit;text-align:left;cursor:pointer}
.mx-pal-it>svg{width:20px;height:20px;color:var(--text-3);flex:none}
.mx-pal-it.on{background:var(--accent-soft,rgba(35,95,180,.1))}.mx-pal-it.on>svg{color:var(--accent)}
.mx-pal-tx{flex:1;min-width:0;display:flex;flex-direction:column}.mx-pal-tx b{font-weight:500;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mx-pal-tx small{font-size:12.5px;color:var(--text-3)}
.mx-pal-empty{padding:22px;text-align:center;color:var(--text-3)}
@media (max-width:767px){.mx-pal-wrap{padding-top:max(12px,env(safe-area-inset-top))}.mx-pal{max-height:calc(100dvh - 24px)}}
#mxTheme svg{width:20px;height:20px}
.mx-try{display:flex;align-items:center;justify-content:center;gap:8px;min-height:48px;margin:14px 0 4px;border-radius:999px;color:var(--accent);font-weight:650;text-decoration:none}
.mx-try svg{width:18px;height:18px}

.mx-blk-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 0}
.mx-blk-row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mx-check.mx-terms a{color:var(--accent)}
