/* MatthewMail chat 2 add-on "media2" (chat-media2.js): albums, document scanner, document preview, every chat's media + storage.
   Uses only the chat's own colour tokens (chat.css :root .mx, dark + light), so both themes follow by themselves. */

/* ---------- shared bits */
.mx .mf-sheet { gap: 0; }
.mx .mf-sheet .mf-head { flex: none; padding: 0 2px; }
.mx .mf-sheet .mf-head h2 { margin-bottom: 6px; }
.mx .mf-sheet .mf-head .lead { margin-bottom: 12px; }
.mx .mf-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 2px 12px; }
.mx .mf-foot { flex: none; padding: 10px 2px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.mx .mf-foot .mx-acts { margin-top: 4px; }
.mx .mf-sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: .88em; }
.mx .mf-linkbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: 10px; color: inherit; font-weight: 700; font-size: .84em; }
.mx .mf-linkbtn:hover { background: var(--quote-theirs); }
.mx .mf-linkbtn .mx-ic { width: 18px; height: 18px; }
.mx .wide { width: 100%; }
.mx .mf-tawrap { flex: none; width: 100%; border-radius: 14px; background: var(--raised); border: 1.5px solid var(--line-2); padding: 0; margin-bottom: 12px; overflow: hidden; }
.mx .mf-tawrap:focus-within { border-color: var(--ember); }
.mx .mf-tawrap .mx-ta, .mx .mf-tawrap .mx-tamirror { min-height: 50px; padding: 13px 14px 12px; font-size: 1em; line-height: 1.35; }
.mx .mf-tawrap .mx-ta { resize: none; max-height: 150px; }
.mx .mf-seg { margin: 4px 0 12px; overflow-x: auto; scrollbar-width: none; }
.mx .mf-seg::-webkit-scrollbar { display: none; }
.mx .mf-seg button { white-space: nowrap; padding: 0 12px; }
.mx .mf-dnote { margin: 6px 4px 10px; color: var(--text-2); font-size: .84em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mx .mf-dnote .mx-ic { width: 17px; height: 17px; }
.mx .mf-dnote.top { margin: 14px 16px 14px; }
.mx .mf-mh { margin: 18px 6px 8px; font-size: .78em; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.mx .mf-mh:first-child { margin-top: 4px; }
.mx .mf-busy { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: inherit; font-weight: 700; }
.mx .mf-sheet, .mx .mf-viewer { position: relative; }
.mx .mf-bar[hidden] { display: none; }
.mx .mf-bar { width: min(280px, 80%); height: 6px; border-radius: 3px; background: var(--steel); overflow: hidden; }
.mx .mf-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mine-a), var(--ember)); border-radius: 3px; transition: width .2s; }
.mx .mf-spin { width: 34px; height: 34px; border-radius: 50%; border: 3.5px solid var(--steel); border-top-color: var(--ember); animation: mfspin .8s linear infinite; flex: none; }
@keyframes mfspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mx .mf-spin { animation-duration: 2.4s; } }
.mx .mf-dload { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 40px 10px; color: var(--text-2); font-weight: 700; }
.mx .mx-ic.pl { position: absolute; }

/* ---------- C-05 album composer */
.mx .mf-acomp { display: flex; flex-direction: column; gap: 8px; }
.mx .mf-aitem { display: grid; grid-template-columns: 22px 76px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; border-radius: 16px; background: var(--raised); border: 1.5px solid transparent; }
.mx .mf-aitem.drag { opacity: .5; border-color: var(--ember); }
.mx .mf-aitem .n { font-weight: 800; color: var(--text-3); text-align: center; font-size: .84em; font-variant-numeric: tabular-nums; }
.mx .mf-aitem .th { position: relative; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; background: var(--steel); }
.mx .mf-aitem .th img, .mx .mf-aitem .th video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mx .mf-aitem .cap { min-width: 0; }
.mx .mf-aitem .cap .mf-tawrap { margin: 0 0 4px; background: var(--surface); }
.mx .mf-aitem .cap .mf-tawrap .mx-ta, .mx .mf-aitem .cap .mf-tawrap .mx-tamirror { min-height: 44px; padding: 10px 12px 9px; font-size: .92em; }
.mx .mf-aitem .meta { font-size: .74em; color: var(--text-3); padding-left: 4px; }
.mx .mf-aitem .ops { display: flex; flex-direction: column; }
.mx .mf-aitem .ops .mx-ib { width: 38px; height: 34px; border-radius: 10px; }
.mx .mf-aitem .ops .mx-ib .mx-ic { width: 19px; height: 19px; }
.mx .mf-aitem .ops .mx-ib[disabled] { opacity: .28; }
@media (min-width: 560px) { .mx .mf-aitem { grid-template-columns: 22px 96px minmax(0, 1fr) auto; } .mx .mf-aitem .th { width: 96px; height: 96px; } }
.mx .vb { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; pointer-events: none; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.mx .vb .mx-ic { width: 18px; height: 18px; margin-left: 2px; }
.mx .mf-addmore { margin-top: 10px; }
.mx .mf-asum { font-size: .84em; color: var(--text-2); font-weight: 650; padding: 0 4px; }

/* ---------- C-05 album card in the chat */
.mx .mx-b.card.ext:has(> .mf-album) { padding: 4px; }
.mx .mf-album { width: min(330px, 68vw); display: flex; flex-direction: column; gap: 4px; }
.mx .mf-atitle { font-weight: 800; padding: 6px 8px 2px; font-size: .98em; overflow-wrap: anywhere; }
.mx .mf-mosaic { display: grid; gap: 3px; border-radius: 16px; overflow: hidden; aspect-ratio: 1 / 1; }
.mx .mf-mosaic.n1 { grid-template-columns: 1fr; aspect-ratio: 4 / 5; }
.mx .mf-mosaic.n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1.3; }
.mx .mf-mosaic.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.mx .mf-mosaic.n3 .t0 { grid-row: span 2; }
.mx .mf-mosaic.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mx .mf-mosaic.n5 { grid-template-columns: repeat(6, 1fr); grid-template-rows: 1.25fr 1fr; }
.mx .mf-mosaic.n5 .t0, .mx .mf-mosaic.n5 .t1 { grid-column: span 3; }
.mx .mf-mosaic.n5 .t2, .mx .mf-mosaic.n5 .t3, .mx .mf-mosaic.n5 .t4 { grid-column: span 2; }
.mx .mf-mt { position: relative; display: block; min-width: 0; min-height: 0; padding: 0; overflow: hidden; background: var(--steel); cursor: zoom-in; }
.mx .mf-mt img, .mx .mf-mt video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.mx .mf-mt:hover img, .mx .mf-mt:hover video { transform: scale(1.03); }
.mx .mf-mt .more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .52); color: #fff; font-size: 1.6em; font-weight: 800; letter-spacing: .02em; }
.mx .mf-mt:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.mx .mf-afoot { display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 8px; font-size: .8em; font-weight: 650; opacity: .88; }
.mx .mf-afoot > .mx-ic { width: 17px; height: 17px; flex: none; }
.mx .mf-afoot .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx .mx-row.mine .mf-afoot, .mx .mx-row.mine .mf-atitle { color: var(--mine-text); }
.mx .mx-row.mine .mf-linkbtn:hover { background: var(--quote-mine); }

/* ---------- the full-screen viewer */
.mx .mx-layer.full:has(> .mf-viewer) { padding: 0; background: #000; }
.mx .mx-sheet.full.mf-viewer { max-width: none; width: 100%; height: 100%; max-height: 100%; border-radius: 0; padding: 0; background: #000; color: #fff; overflow: hidden; animation: mxfade .14s ease-out; }
.mx .mf-viewer > .mx-grab { display: none; }
.mx .mf-vbar { position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: flex; align-items: center; gap: 6px; padding: calc(6px + env(safe-area-inset-top)) 8px 18px; background: linear-gradient(rgba(0, 0, 0, .78), rgba(0, 0, 0, 0)); }
.mx .mf-vbar .mx-ib { color: #fff; }
.mx .mf-vbar .mx-ib:hover { background: rgba(255, 255, 255, .14); }
.mx .mf-vtitle { flex: 1; min-width: 0; line-height: 1.25; }
.mx .mf-vtitle .t { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx .mf-vtitle .s { font-size: .78em; opacity: .74; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx .mf-vstage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.mx .mf-viewer:has(.mf-vstrip) .mf-vstage { bottom: calc(72px + env(safe-area-inset-bottom)); }
.mx .mf-vstage img { width: 100%; height: 100%; object-fit: contain; transform-origin: center; will-change: transform; -webkit-user-drag: none; }
.mx .mf-vstage video { width: 100%; height: 100%; max-height: calc(100% - 120px); object-fit: contain; }
.mx .mf-vaudio, .mx .mf-vdoc { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; text-align: center; }
.mx .mf-vaudio > .mx-ic, .mx .mf-vdoc > .mx-ic { width: 64px; height: 64px; color: var(--ember); }
.mx .mf-vcap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 34px 18px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .8) 46%); font-size: 1.02em; line-height: 1.4; text-align: center; overflow-wrap: anywhere; max-height: 40%; overflow-y: auto; }
.mx .mf-vstrip ~ .mf-vcap, .mx .mf-vcap:has(~ .mf-vstrip) { bottom: calc(72px + env(safe-area-inset-bottom)); padding-bottom: 10px; }
.mx .mf-vstrip { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; gap: 6px; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); overflow-x: auto; scrollbar-width: none; justify-content: safe center; background: rgba(0, 0, 0, .6); }
.mx .mf-vstrip::-webkit-scrollbar { display: none; }
.mx .mf-vthumb { position: relative; flex: none; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; opacity: .55; border: 2px solid transparent; display: grid; place-items: center; background: #222; color: #fff; }
.mx .mf-vthumb img, .mx .mf-vthumb video { width: 100%; height: 100%; object-fit: cover; }
.mx .mf-vthumb .mx-ic.pl { width: 18px; height: 18px; filter: drop-shadow(0 1px 2px #000); }
.mx .mf-vthumb.on { opacity: 1; border-color: #fff; }
.mx .mf-vnav { position: absolute; top: 50%; z-index: 3; transform: translateY(-50%); display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; }
.mx .mf-vnav:hover { background: rgba(255, 255, 255, .18); }
.mx .mf-vnav.prev { left: 14px; }
.mx .mf-vnav.next { right: 14px; }
@media (pointer: coarse) { .mx .mf-vnav { display: none; } }

/* ---------- C-07 scanner */
.mx .mf-scansheet { max-width: 900px; }
.mx .mf-cam { position: relative; flex: 1; min-height: 0; border-radius: 18px; overflow: hidden; background: #000; display: grid; place-items: center; }
.mx .mf-cam video { width: 100%; height: 100%; object-fit: contain; }
.mx .mf-cam .mf-ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mx .mf-cmsg { position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); text-align: center; color: #fff; font-weight: 700; line-height: 1.4; }
.mx .mf-cbar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 14px 0 6px; }
.mx .mf-cbar > :first-child { justify-self: start; }
.mx .mf-cbar > :last-child { justify-self: end; }
.mx .mf-cbar .mx-btn { min-height: 44px; padding: 0 14px; font-size: .9em; }
.mx .mf-shutter { width: 74px; height: 74px; border-radius: 50%; border: 4px solid var(--text); display: grid; place-items: center; padding: 0; }
.mx .mf-shutter span { width: 56px; height: 56px; border-radius: 50%; background: var(--ember); transition: transform .1s; }
.mx .mf-shutter:active span { transform: scale(.9); }
.mx .mf-shutter[disabled] { opacity: .4; }
.mx .mf-cstrip { flex: none; display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
.mx .mf-cstrip:empty { display: none; }
.mx .mf-cth { position: relative; flex: none; width: 50px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--steel); border: 1.5px solid var(--line-2); }
.mx .mf-cth img { width: 100%; height: 100%; object-fit: cover; }
.mx .mf-cth b { position: absolute; right: 3px; bottom: 3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--ember); color: #fff; font-size: .66em; display: grid; place-items: center; padding: 0 4px; }
.mx .mf-adj { position: relative; flex: 1; min-height: 220px; border-radius: 18px; overflow: hidden; background: #0c0c0e; touch-action: none; }
.mx .mf-adjimg { position: absolute; }
.mx .mf-adjsvg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.mx .mf-adjsvg polygon { fill: none; stroke: #FF3B4E; stroke-width: 2.5; stroke-linejoin: round; }
.mx .mf-adjsvg .shade { fill: rgba(0, 0, 0, .52); }
.mx .mf-adjimg { transition: transform .2s; }
.mx .mf-hd { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; padding: 0; touch-action: none; cursor: grab; background: transparent; }
.mx .mf-hd::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #fff; border: 3px solid #FF3B4E; box-shadow: 0 1px 6px rgba(0, 0, 0, .55); transition: transform .1s; }
.mx .mf-hd.drag::after, .mx .mf-hd:focus-visible::after { transform: scale(1.3); }
.mx .mf-hd:focus-visible { outline: none; }
.mx .mf-loupe { position: absolute; z-index: 4; width: 120px; height: 120px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .6); pointer-events: none; background: #000; }
.mx .mf-adjtools { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 0 2px; }
.mx .mf-adjtools button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 62px; padding: 6px 2px; border-radius: 14px; background: var(--raised); font-size: .74em; font-weight: 750; line-height: 1.1; text-align: center; }
.mx .mf-adjtools button:hover { background: var(--steel); }
.mx .mf-adjtools button .mx-ic { color: var(--ember); width: 22px; height: 22px; }
.mx .mf-adjtools button.on { box-shadow: inset 0 0 0 2px var(--ember); }
.mx .mf-scansheet .mf-seg { flex: none; margin: 10px 0 4px; }
.mx .mf-scansheet > .mx-acts { flex: none; }
.mx .mf-rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.mx .mf-rpage { display: flex; flex-direction: column; gap: 6px; }
.mx .mf-rpage .pv { display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line-2), 0 4px 14px rgba(0, 0, 0, .25); }
.mx .mf-rpage .pv img { width: 100%; height: 100%; object-fit: contain; }
.mx .mf-rpage .ro { display: flex; align-items: center; gap: 0; }
.mx .mf-rpage .ro b { flex: 1; font-size: .82em; padding-left: 4px; }
.mx .mf-rpage .ro .mx-ib { width: 34px; height: 34px; border-radius: 10px; }
.mx .mf-rpage .ro .mx-ib .mx-ic { width: 18px; height: 18px; }
.mx .mf-rpage .ro .mx-ib[disabled] { opacity: .28; }
.mx .mf-opt { margin-top: 12px; }

/* ---------- C-07 scan card in the chat */
.mx .mf-scan { display: flex; gap: 12px; align-items: stretch; width: min(330px, 70vw); padding: 2px; }
.mx .mf-sth { position: relative; flex: none; width: 84px; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: #fff; color: #555; display: grid; place-items: center; padding: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.mx .mf-sth img { width: 100%; height: 100%; object-fit: contain; object-position: top; background: #fff; }
.mx .mf-sth .pg { position: absolute; left: 4px; right: 4px; bottom: 4px; border-radius: 6px; background: rgba(0, 0, 0, .66); color: #fff; font-size: .62em; font-weight: 750; padding: 2px 0; text-align: center; }
.mx .mf-sinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 2px 0; }
.mx .mf-sinfo .kick { display: flex; align-items: center; gap: 5px; font-size: .7em; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; opacity: .78; }
.mx .mf-sinfo .kick .mx-ic { width: 15px; height: 15px; }
.mx .mf-sinfo .nm { font-weight: 800; overflow-wrap: anywhere; line-height: 1.25; }
.mx .mf-sinfo .sub { font-size: .76em; opacity: .78; }
.mx .mf-sact { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.mx .mf-sact .mx-ib, .mx .mf-dca .mx-ib { width: 40px; height: 40px; color: inherit; }
.mx .mf-sact .mx-ib .mx-ic, .mx .mf-dca .mx-ib .mx-ic { width: 20px; height: 20px; }
.mx .mx-row.mine .mf-scan .mx-btn.red, .mx .mx-row.mine .mf-docc .mx-btn.red { background: #fff; color: var(--mine-c); box-shadow: none; }

/* ---------- C-08 document card (replaces chat.js's plain file chip for documents) */
.mx a.mx-file.mf-replaced { display: none; }
.mx .mf-docc { display: flex; align-items: center; gap: 4px; width: min(330px, 70vw); padding: 4px 0 4px 2px; }
.mx .mf-docc > .mf-dth { margin-right: 8px; }
.mx .mf-dth { position: relative; flex: none; width: 58px; height: 72px; border-radius: 10px; display: grid; place-items: center; padding: 0; color: #fff; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.mx .mf-dth .mx-ic { width: 26px; height: 26px; margin-bottom: 12px; }
.mx .mf-dth .x { position: absolute; left: 0; right: 0; bottom: 6px; font-size: .6em; font-weight: 850; letter-spacing: .05em; text-align: center; }
.mx .mf-dth.pic { background: #fff !important; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.mx .mf-dth.pic img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.mx .tone-pdf { background: linear-gradient(160deg, #E5383B, #A4161A); }
.mx .tone-word { background: linear-gradient(160deg, #2F6FE4, #1B4AA8); }
.mx .tone-excel { background: linear-gradient(160deg, #23A35A, #127238); }
.mx .tone-ppt { background: linear-gradient(160deg, #F07833, #C4471A); }
.mx .tone-text { background: linear-gradient(160deg, #6A6E7A, #464954); }
.mx .tone-other { background: linear-gradient(160deg, #5B5E69, #393B44); }
.mx .tone-voice { background: linear-gradient(160deg, var(--mine-a), var(--mine-c)); }
.mx .tone-link { background: linear-gradient(160deg, #3D7BD8, #2552A0); }
.mx .mf-dci { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 0; text-align: left; color: inherit; }
.mx .mf-dci .go { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: .74em; font-weight: 800; opacity: .9; }
.mx .mf-dci .go .mx-ic { width: 16px; height: 16px; }
.mx .mf-dci:hover .nm { text-decoration: underline; }
.mx .mf-docc .mf-dl { width: 42px; height: 42px; color: inherit; flex: none; }
.mx .mf-docc .mf-dl .mx-ic { width: 21px; height: 21px; }
.mx .mf-docc .mf-dl:hover { background: var(--quote-theirs); }
.mx .mx-row.mine .mf-docc .mf-dl:hover { background: var(--quote-mine); }
.mx .mf-dci .nm { font-weight: 750; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; overflow-wrap: anywhere; }
.mx .mf-dci .sub { font-size: .76em; opacity: .78; }
.mx .mf-dca { display: flex; flex-direction: column; align-items: center; gap: 2px; }

/* ---------- C-08 document viewer */
.mx .mf-docsheet { max-width: 1060px; padding-left: 0; padding-right: 0; padding-bottom: 0; overflow: hidden; }
.mx .mf-docsheet > .mx-grab { display: none; }
.mx .mf-dbar { position: relative; background: var(--surface); padding: 0 8px 8px; border-bottom: 1px solid var(--line); color: var(--text); }
.mx .mf-dbar .mx-ib { color: var(--text); }
.mx .mf-dbar .mx-ib:hover { background: var(--steel); }
@media (max-width: 480px) { .mx .mf-dbar .mx-ib { width: 42px; height: 42px; } .mx .mf-dtools .mx-ib .mx-ic { width: 21px; height: 21px; } }
.mx .mf-dpage { position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4; padding: 6px 14px; border-radius: 999px; background: rgba(20, 20, 24, .82); color: #fff; font-size: .8em; font-weight: 750; font-variant-numeric: tabular-nums; pointer-events: none; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.mx .mf-dtools { display: flex; }
.mx .mf-dbody { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; background: var(--bg); outline: none; padding-bottom: env(safe-area-inset-bottom); }
.mx .mf-pdfpages { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 14px 12px 24px; min-width: min-content; }
.mx .mf-pdfpage { position: relative; flex: none; background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); overflow: hidden; transition: box-shadow .3s; }
.mx .mf-pdfpage canvas { display: block; width: 100%; height: 100%; }
.mx .mf-pdfpage .pn { position: absolute; right: 8px; bottom: 6px; font-size: .7em; font-weight: 750; color: #fff; background: rgba(0, 0, 0, .5); border-radius: 8px; padding: 1px 7px; }
.mx .mf-pdfpage.flash { box-shadow: 0 0 0 4px var(--ember), 0 2px 10px rgba(0, 0, 0, .35); }
.mx .mf-dfind { flex: none; padding: 10px 12px 6px; border-bottom: 1px solid var(--line); background: var(--surface); max-height: 46%; overflow-y: auto; }
.mx .mf-dfind .mx-in { margin-bottom: 6px; }
.mx .mf-dres { display: flex; flex-direction: column; gap: 2px; }
.mx .mf-dhit { display: flex; gap: 10px; align-items: baseline; text-align: left; width: 100%; padding: 8px 10px; border-radius: 10px; font-size: .86em; }
.mx .mf-dhit:hover { background: var(--raised); }
.mx .mf-dhit b { flex: none; color: var(--ember); font-size: .9em; }
.mx .mf-dhit span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx .mf-dhit.none { color: var(--text-2); }
.mx .mf-dnone { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 56px 24px; color: var(--text); }
.mx .mf-dnone > .mx-ic { width: 56px; height: 56px; color: var(--text-3); }
.mx .mf-dnone p { margin: 0 0 8px; color: var(--text-2); font-size: .9em; }
.mx .mf-docxwrap { padding: 16px 12px 28px; display: flex; justify-content: center; }
.mx .mf-docx { width: min(816px, 100%); background: #fff; color: #1d1d22; border-radius: 6px; box-shadow: 0 2px 12px rgba(0, 0, 0, .35); padding: clamp(18px, 6vw, 64px); font-family: 'Atkinson Next', 'Atkinson Hyperlegible', Georgia, serif; font-size: .95em; line-height: 1.55; overflow-wrap: anywhere; }
.mx .mf-docx h1 { font-size: 1.7em; margin: 0 0 .5em; }
.mx .mf-docx h2 { font-size: 1.35em; margin: 1em 0 .4em; color: #8E0B1F; }
.mx .mf-docx h3 { font-size: 1.15em; margin: 1em 0 .35em; }
.mx .mf-docx h4 { font-size: 1em; margin: .9em 0 .3em; }
.mx .mf-docx p { margin: 0 0 .7em; white-space: pre-wrap; }
.mx .mf-docx ul { margin: 0 0 .8em 1.2em; padding: 0; }
.mx .mf-docx li { margin: .15em 0; white-space: pre-wrap; }
.mx .mf-docx a { color: #1B4AA8; }
.mx .mf-dimg { max-width: 100%; height: auto; border-radius: 4px; margin: 6px 0; display: block; }
.mx .mf-tscroll { overflow-x: auto; max-width: 100%; margin: 0 0 1em; }
.mx .mf-dtbl { border-collapse: collapse; min-width: 100%; font-size: .92em; }
.mx .mf-dtbl td { border: 1px solid #c9ccd3; padding: 6px 8px; vertical-align: top; }
.mx .mf-dtbl td p { margin: 0; }
.mx .mf-xwrap { padding: 10px 10px 24px; }
.mx .mf-xtabs { display: flex; gap: 6px; padding: 10px 10px 0; overflow-x: auto; scrollbar-width: none; }
.mx .mf-xtabs button { flex: none; min-height: 38px; padding: 0 14px; border-radius: 10px 10px 0 0; background: var(--raised); color: var(--text-2); font-weight: 700; font-size: .86em; border-bottom: 3px solid transparent; }
.mx .mf-xtabs button.on { background: var(--surface); color: var(--text); border-bottom-color: #23A35A; }
.mx .mf-xtbl { border-collapse: separate; border-spacing: 0; font-size: .82em; font-variant-numeric: tabular-nums; background: var(--surface); color: var(--text); }
.mx .mf-xtbl th, .mx .mf-xtbl td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 9px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.mx .mf-xtbl th { position: sticky; top: 0; background: var(--steel); font-weight: 750; color: var(--text-2); z-index: 1; }
.mx .mf-xtbl th.rh { position: sticky; left: 0; z-index: 2; text-align: right; min-width: 38px; }
.mx .mf-xtbl tr:first-child th.rh { z-index: 3; }
.mx .mf-xtbl td.num { text-align: right; }
.mx .mf-xwrap .mf-tscroll { max-height: calc(100vh - 220px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.mx .mf-deck { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 0 12px 28px; }
.mx .mf-slide { position: relative; width: min(860px, 100%); aspect-ratio: 16 / 9; background: #fff; color: #1d1d22; border-radius: 8px; box-shadow: 0 2px 12px rgba(0, 0, 0, .35); padding: clamp(14px, 4vw, 40px); overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
.mx .mf-slide h3 { margin: 0 0 .3em; font-size: clamp(1em, 3.2vw, 1.6em); color: #C4471A; overflow-wrap: anywhere; }
.mx .mf-slide ul { margin: 0 0 0 1.1em; padding: 0; font-size: clamp(.78em, 2.2vw, 1em); line-height: 1.4; overflow: hidden; }
.mx .mf-slide .mf-dimg { max-height: 46%; width: auto; max-width: 100%; align-self: flex-start; object-fit: contain; min-height: 0; }
.mx .mf-slide .mf-dnote { color: #6a6e7a; }
.mx .mf-slide .sn { position: absolute; right: 10px; bottom: 8px; font-size: .7em; font-weight: 750; color: #fff; background: rgba(0, 0, 0, .45); border-radius: 8px; padding: 1px 7px; }
.mx .mf-dtext { margin: 0; padding: 16px; font-family: ui-monospace, 'Cascadia Mono', Consolas, 'Roboto Mono', monospace; font-size: .8em; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }

/* ---------- C-10 gallery */
.mx .mf-galsheet { max-width: 1100px; }
.mx .mf-ghead { display: flex; align-items: center; gap: 4px; margin: -2px 0 8px; }
.mx .mf-ghead h2 { margin: 0; white-space: nowrap; }
.mx .mf-ghead h2.rn { overflow: hidden; text-overflow: ellipsis; min-width: 0; margin-left: .3em; }
.mx .mf-gfilt { flex: none; display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.mx .mf-gfilt:empty { display: none; }
.mx .mf-gfilt::-webkit-scrollbar { display: none; }
.mx .mf-selw { position: relative; display: flex; align-items: center; flex: 1 1 0; min-width: 0; max-width: 240px; }
.mx .mf-gfilt > .mx-pill { flex: none; height: 42px; min-height: 0; }
.mx .mf-selw > .mx-ic { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--ember); pointer-events: none; }
.mx .mf-sel { appearance: none; -webkit-appearance: none; height: 42px; min-height: 0; width: 100%; min-width: 0; padding: 0 28px 0 36px; border-radius: 999px; background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; border: 1.5px solid var(--line-2); color: var(--text); font: inherit; font-size: .86em; font-weight: 700; text-overflow: ellipsis; }
.mx .mf-sel:focus { border-color: var(--ember); outline: none; }
.mx .mx-pill.on { border-color: var(--ember); background: color-mix(in srgb, var(--ember) 16%, var(--raised)); }
.mx .mf-selbar { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px; border-radius: 14px; background: color-mix(in srgb, var(--ember) 12%, var(--raised)); font-weight: 700; font-size: .9em; }
.mx .mf-selbar .grow { flex: 1; min-width: 0; }
.mx .mf-gscroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 16px; }
.mx .mf-gstatus { color: var(--text-2); text-align: center; padding: 6px; font-weight: 650; }
.mx .mf-gstatus:empty { display: none; }
.mx .mf-sent { height: 1px; }
.mx .mf-ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 3px; border-radius: 14px; overflow: hidden; }
@media (min-width: 700px) { .mx .mf-ggrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.mx .mf-ggrid.mf-gbig { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; border-radius: 0; overflow: visible; }
.mx .mf-ggrid.mf-gbig .mf-gt { border-radius: 12px; }
.mx .mf-ggrid.mf-gsmall { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 4px; margin: 12px 0 6px; border-radius: 10px; }
.mx .mf-gt { position: relative; aspect-ratio: 1 / 1; padding: 0; overflow: hidden; background: var(--steel); display: grid; place-items: center; min-width: 0; }
.mx .mf-gt img, .mx .mf-gt video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mx .mf-gt .mf-fx { width: 56px; height: 56px; }
.mx .mf-gt .ab { position: absolute; right: 5px; top: 5px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(0, 0, 0, .5); color: #fff; }
.mx .mf-gt .ab .mx-ic { width: 15px; height: 15px; }
.mx .mf-gt .sz { position: absolute; left: 5px; bottom: 5px; padding: 2px 7px; border-radius: 8px; background: rgba(0, 0, 0, .66); color: #fff; font-size: 12px; line-height: 1.3; font-weight: 750; }
.mx .mf-gt .ab.n { width: auto; padding: 0 7px; font-size: 12px; font-weight: 800; }
.mx .mf-gt .ck { position: absolute; left: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .3); display: none; place-items: center; color: #fff; }
.mx .mf-gt .ck .mx-ic { width: 16px; height: 16px; opacity: 0; }
.mx .mf-galsheet .mf-selbar:not([hidden]) ~ .mf-gscroll .mf-gt .ck { display: grid; }
.mx .mf-gt.sel .ck { background: var(--ember); border-color: var(--ember); }
.mx .mf-gt.sel .ck .mx-ic { opacity: 1; }
.mx .mf-gt.sel img, .mx .mf-gt.sel video { transform: scale(.86); border-radius: 10px; transition: transform .12s; }
.mx .mf-gt:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.mx .mf-flist { display: flex; flex-direction: column; gap: 0; }
.mx .mf-frow { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 0; border-radius: 14px; }
.mx .mf-frow.sel { background: color-mix(in srgb, var(--ember) 14%, transparent); }
.mx .mf-frow + .mf-frow { border-top: 1px solid var(--line); border-radius: 0; }
.mx .mf-fmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 8px; text-align: left; color: inherit; text-decoration: none; border-radius: 12px; }
.mx .mf-fmain:hover { background: var(--steel); }
.mx .mf-frow > .mf-fx { margin-left: 8px; }
.mx .mf-frow > .grow { flex: 1; min-width: 0; padding: 8px; }
.mx .mf-fx { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; color: #fff; font-size: .62em; font-weight: 850; letter-spacing: .04em; }
.mx .mf-fx .mx-ic { width: 22px; height: 22px; }
.mx .mf-flist .grow, .mx .mf-fmain .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mx .mf-flist .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx .mf-flist .sub { font-size: .76em; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx .mf-aud { width: 100%; height: 40px; margin-top: 6px; }

/* ---------- C-10 storage */
.mx .mf-scard { padding: 14px; margin-bottom: 10px; }
.mx .mf-scard .mx-li { padding: 0; min-height: 0; gap: 12px; }
.mx .mf-scard .mx-li:hover { background: transparent; }
.mx .mf-sbig { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.mx .mf-sbig b { font-size: 1.9em; font-weight: 850; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.mx .mf-sbig span { color: var(--text-2); font-size: .88em; }
.mx .mf-sbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--steel); gap: 2px; }
.mx .mf-sroom .mf-sbar { height: 6px; margin-top: 6px; max-width: 260px; }
.mx .c-photos { background: #3D7BD8; }
.mx .c-videos { background: var(--ember); }
.mx .c-voice { background: #F2B544; }
.mx .c-files { background: #23A35A; }
.mx .mf-slegend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 2px; font-size: .8em; color: var(--text-2); font-weight: 650; }
.mx .mf-slegend span { display: inline-flex; align-items: center; gap: 6px; }
.mx .mf-slegend i { width: 10px; height: 10px; border-radius: 3px; }
.mx .mf-scard .mf-dnote { margin: 10px 0 0; }
.mx .mf-av { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(160deg, var(--mine-a), var(--mine-c)); color: #fff; font-weight: 800; }
.mx .mf-sroom .nm { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx .mf-sroom .val, .mx .mf-scroll .mx-li .val, .mx .mf-glist .mx-li .val { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.mx .mf-glist .mx-pill { margin: 0 0 6px; }
.mx .mf-pwarn { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--ember) 12%, var(--raised)); border: 1.5px solid color-mix(in srgb, var(--ember) 45%, transparent); margin-top: 12px; }
.mx .mf-pwarn > .mx-ic { color: var(--ember); flex: none; margin-top: 2px; }
.mx .mf-pwarn b { display: block; margin-bottom: 4px; }
.mx .mf-pwarn span { color: var(--text-2); font-size: .88em; line-height: 1.4; }
.mx .mf-plan .mx-acts { margin-top: 14px; }

/* ---------- the add-on's toast (chat 2 look, dark + light): above the composer, never over it */
.mx .mf-toast { position: absolute; z-index: 70; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; width: max-content; min-height: 50px; padding: 6px 6px 6px 14px;
  border-radius: 16px; background: var(--raised); color: var(--text); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .12);
  font-size: .9em; font-weight: 650; line-height: 1.3; animation: mftoast .2s cubic-bezier(.2, .8, .2, 1); }
.mx[data-theme="light"] .mf-toast { background: var(--surface); box-shadow: 0 10px 28px rgba(20, 22, 30, .18), 0 0 0 1px rgba(20, 22, 30, .06); }
.mx .mf-toast .lead { flex: none; width: 22px; height: 22px; color: var(--online); }
.mx .mf-toast.bad { border-color: color-mix(in srgb, var(--ember) 55%, var(--line-2)); }
.mx .mf-toast.bad .lead { color: var(--ember); }
.mx .mf-toast .msg { min-width: 0; overflow-wrap: anywhere; }
.mx .mf-toast .x { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--text-2); }
.mx .mf-toast .x:hover { background: var(--steel); color: var(--text); }
.mx .mf-toast .x .mx-ic { width: 18px; height: 18px; }
.mx .mf-toast.out { opacity: 0; transform: translate(-50%, 6px); transition: opacity .18s, transform .18s; }
@keyframes mftoast { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (prefers-reduced-motion: reduce) { .mx .mf-toast { animation: none; } .mx .mf-toast.out { transition: none; } }

/* ---------- narrow phones (360) */
.mx .mf-sinfo .kick { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) {
  .mx .mf-seg button { padding: 0 6px; font-size: .82em; }
  .mx .mf-gfilt .mx-pill { width: 42px; padding: 0; justify-content: center; }
  .mx .mf-gfilt .mx-pill .lbl, .mx .mf-afoot .mf-linkbtn .lbl { display: none; }
  .mx .mf-sth { width: 70px; }
  .mx .mf-scan { gap: 10px; }
}
