/* OMS redesign — FACTORY SHELL: top bar, Messages sheet, notifications popover.
 *
 * The factory twin of oms-rd-admin.css Part 6 (#rd-admin-topbar, #msgDrawer.rd,
 * .rd-notif-dd). Same measurements and tokens; the selectors are the factory's
 * own (#fx-topbar, #fxm) so nothing here touches the admin portal, and the ids
 * out-rank the head <style> block and oms-mobile.css without !important.
 * Paired with /js/oms-rdf-shell.js, which builds #fxm and fills the labels.
 * No remote assets. No !important.
 */

/* ======================================================================
   1. TOP BAR
   ====================================================================== */
#fx-topbar.rd.rd-atb { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 10px; height: 60px; margin: -24px -24px 22px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 14px; }
#fx-topbar .rd-atb-spacer { flex: 1 1 0; min-width: 0; }
#fx-topbar .rd-atb-search { position: relative; flex: 1 1 auto; max-width: 540px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--sunk); color: var(--muted); transition: border-color .12s, background .12s, box-shadow .12s; }
#fx-topbar .rd-atb-search:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
#fx-topbar .rd-atb-search > svg { width: 16px; height: 16px; flex: none; }
#fx-topbar .rd-atb-search input[type="search"] { flex: 1; min-width: 0; width: auto; height: 36px; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; font-family: inherit; font-size: 13.5px; color: var(--ink); }
#fx-topbar .rd-atb-search input[type="search"]::placeholder { color: var(--muted); }
#fx-topbar .rd-atb-search .kbd { margin-left: 0; flex: none; height: 20px; line-height: 18px; color: var(--muted); font-weight: 700; }
#fx-topbar .rd-atb-search:focus-within .kbd { display: none; }
#fx-topbar .rd-atb-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: min(380px, calc(var(--rd-vw, 100vw) - 32px)); max-height: min(calc(var(--rd-vh, 100vh) * .7), 540px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px -12px rgba(27,32,82,.3); padding: 6px; z-index: 5; }
#fx-topbar .rd-atb-results[hidden] { display: none; }
#fx-topbar .rd-atb-gl { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 10px 4px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
#fx-topbar .rd-atb-gl span { letter-spacing: 0; text-transform: none; font-weight: 600; }
#fx-topbar .rd-atb-hit { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-family: inherit; color: var(--ink); cursor: pointer; }
#fx-topbar .rd-atb-hit.on, #fx-topbar .rd-atb-hit:hover { background: var(--accent-soft); }
#fx-topbar .rd-atb-hit-t { font-size: 13.5px; font-weight: 800; white-space: nowrap; }
#fx-topbar .rd-atb-hit-s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#fx-topbar .rd-atb-hit-tag { height: 20px; font-size: 11px; padding: 0 7px; }
#fx-topbar .rd-atb-none { padding: 14px 12px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
#fx-topbar .rd-atb-none span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
#fx-topbar .rd-atb-ib { flex: none; cursor: pointer; color: var(--ink-2); }
#fx-topbar .rd-atb-ib:hover { background: var(--sunk); color: var(--ink); }
#fx-topbar .rd-atb-ib.has-unread { color: var(--accent); border-color: #C9CEF9; }
#fx-topbar .rd-atb-count { position: absolute; top: -6px; right: -6px; left: auto; margin: 0; min-width: 18px; width: auto; height: 18px; padding: 0 5px; border-radius: 9px; background: #E0364C; color: #fff; border: 2px solid #fff; font-size: 10px; font-weight: 800; line-height: 14px; text-align: center; box-sizing: border-box; pointer-events: none; }
#fx-topbar .rd-atb-msgwrap { position: relative; flex: none; padding: 8px 0; margin: -8px 0; }
/* Language switch — the one control admin does not have. A quiet pill that
   reads as "the other language", in that language. */
#fx-topbar .fx-atb-lang { flex: none; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-2); font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
#fx-topbar .fx-atb-lang:hover { background: var(--sunk); color: var(--ink); }

/* Message peek under the Messages button. */
#fx-topbar .fx-peek { position: absolute; top: 100%; right: -8px; width: 340px; max-width: calc(var(--rd-vw, 100vw) - 24px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px -12px rgba(27,32,82,.3); z-index: 5; overflow: hidden; display: none; }
#fx-topbar .fx-peek.show { display: block; }
#fx-topbar .fx-peek-head { padding: 10px 14px 6px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; color: var(--muted); }
#fx-topbar .fx-peek-none { padding: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
#fx-topbar .fx-peek-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
#fx-topbar .fx-peek-item:hover { background: var(--sunk); }
#fx-topbar .fx-peek-item .fxm-av { width: 30px; height: 30px; font-size: 10.5px; }
#fx-topbar .fx-peek-main { flex: 1; min-width: 0; }
#fx-topbar .fx-peek-name { font-size: 13px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fx-topbar .fx-peek-name span { margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
#fx-topbar .fx-peek-body { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fx-topbar .fx-peek-body b { font-weight: 700; }
#fx-topbar .fx-peek-foot { padding: 8px 14px; border-top: 1px solid var(--line); background: var(--sunk); font-size: 11.5px; color: var(--muted); text-align: center; font-weight: 600; cursor: pointer; }
#fx-topbar .fxm-av, #fx-topbar .fxm-ub { box-sizing: border-box; }

/* The merchant scope strip now sits under the bar instead of at the very top. */
#fx-topbar + #merchant-scope-bar { top: 60px; margin: -22px -24px 20px; }

/* The sidebar header no longer carries the bell. */
.sidebar .sidebar-logo { min-height: 32px; }

/* The PO workspace prints without the chrome. */
@media print { #fx-topbar, #fxm, #fxm-overlay { display: none; } }

/* ======================================================================
   2. NOTIFICATIONS POPOVER (#fnotif-dropdown, built by the page)
   ====================================================================== */
#fnotif-dropdown.rd.rd-notif-dd { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px -12px rgba(27,32,82,.32); font-size: 14px; }
#fnotif-dropdown .rd-notif-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none; }
#fnotif-dropdown .rd-notif-head b { font-size: 15px; font-weight: 800; }
#fnotif-dropdown .rd-notif-head span { font-size: 12px; color: var(--muted); font-weight: 600; }
#fnotif-dropdown .rd-notif-list { flex: 1; overflow-y: auto; max-height: 460px; }
#fnotif-dropdown .rd-notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
#fnotif-dropdown .rd-notif-item:last-child { border-bottom: 0; }
#fnotif-dropdown .rd-notif-item:hover { background: var(--sunk); }
#fnotif-dropdown .rd-notif-item.unread { background: #F7F8FF; }
#fnotif-dropdown .rd-notif-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; background: transparent; }
#fnotif-dropdown .rd-notif-item.unread .rd-notif-dot { background: var(--accent); }
#fnotif-dropdown .rd-notif-main { min-width: 0; flex: 1; }
#fnotif-dropdown .rd-notif-t { font-size: 13px; font-weight: 700; color: var(--ink); }
#fnotif-dropdown .rd-notif-m { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
#fnotif-dropdown .rd-notif-time { font-size: 11.5px; color: var(--muted); margin-top: 4px; font-weight: 600; }
#fnotif-dropdown .rd-notif-empty { padding: 40px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ======================================================================
   3. MESSAGES SHEET (#fxm)
   z: overlay 9100, sheet 9200, ticket dialog 9500 — the same slots the old
   drawer used, under ui-dialogs (100000) and the onboarding tour (99000).
   ====================================================================== */
#fxm-overlay { position: fixed; inset: 0; z-index: 9100; background: rgba(20,24,45,.38); display: none; }
#fxm-overlay.open { display: block; }
#fxm { position: fixed; top: 0; right: 0; z-index: 9200; width: 480px; max-width: var(--rd-vw, 100vw); height: var(--rd-vh, 100vh); height: var(--rd-dvh, 100dvh); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border-left: 1px solid var(--line); font-size: 14px; transform: translateX(100%); visibility: hidden; transition: transform .25s ease, width .2s ease, visibility 0s linear .25s; }
#fxm.open { transform: translateX(0); visibility: visible; transition: transform .25s ease, width .2s ease, visibility 0s; box-shadow: -18px 0 44px -20px rgba(27,32,82,.35); }
#fxm.wide { width: min(1080px, calc(var(--rd-vw, 100vw) - 40px)); }
#fxm [hidden] { display: none; }
#fxm button { font-family: inherit; }

/* Header */
#fxm .fxm-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
#fxm .fxm-hrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
#fxm .fxm-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
#fxm .fxm-tools { display: flex; align-items: center; gap: 6px; }
#fxm .fxm-hbtn, #fxm-ticket .fxm-hbtn { width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--ink-2); padding: 0; }
#fxm .fxm-hbtn:hover, #fxm-ticket .fxm-hbtn:hover { background: var(--sunk); color: var(--ink); }
#fxm .fxm-hbtn svg, #fxm-ticket .fxm-hbtn svg { width: 16px; height: 16px; }
#fxm .fxm-widebtn .fxm-wide-off { display: none; }
#fxm.wide .fxm-widebtn .fxm-wide-on { display: none; }
#fxm.wide .fxm-widebtn .fxm-wide-off { display: block; }
#fxm.wide .fxm-widebtn { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
#fxm .fxm-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: #E8EAF2; }
#fxm .fxm-tab { flex: 1 1 0; min-width: 0; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; cursor: pointer; box-shadow: none; transition: background .12s, color .12s; }
#fxm .fxm-tab:hover { color: var(--ink); }
#fxm .fxm-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20,24,60,.14); }
#fxm .fxm-tb { display: none; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: #E0364C; color: #fff; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center; }
#fxm .fxm-tb.on { display: inline-block; }
#fxm .fxm-search { margin-top: 10px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--sunk); color: var(--muted); }
#fxm .fxm-search:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
#fxm .fxm-search svg { width: 15px; height: 15px; flex: none; }
#fxm .fxm-search input { flex: 1; min-width: 0; width: auto; height: 34px; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; font-family: inherit; font-size: 13px; color: var(--ink); }

/* Tab bodies: list pane + thread pane (+ the empty pane in two-pane mode) */
#fxm .fxm-body-tab { position: relative; flex: 1 1 0; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
#fxm .fxm-body-tab[hidden] { display: none; }
#fxm .fxm-list, #fxm .fxm-thread { flex: 1 1 0; display: flex; flex-direction: column; overflow: hidden; min-height: 0; min-width: 0; }
#fxm .fxm-list[hidden], #fxm .fxm-thread[hidden] { display: none; }
#fxm .fxm-rows, #fxm .fxm-reqs { flex: 1; overflow-y: auto; min-height: 0; }
#fxm .fxm-reqs { padding: 12px 14px; }
#fxm .fxm-empty { padding: 48px 24px; color: var(--muted); font-size: 13px; text-align: center; line-height: 1.5; }
#fxm .fxm-emptypane { display: none; }
#fxm.wide .fxm-body-tab { flex-direction: row; }
#fxm.wide #fxm-body-requests { flex-direction: column; }
#fxm.wide #fxm-body-requests .fxm-reqs { max-width: 760px; width: 100%; margin: 0 auto; }
#fxm.wide .fxm-list { flex: 0 0 360px; border-right: 1px solid var(--line); }
#fxm.wide .fxm-back { display: none; }
#fxm.wide .fxm-body-tab:not(.has-thread) .fxm-emptypane { display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; background: var(--sunk); color: var(--muted); text-align: center; font-size: 13px; }
#fxm .fxm-emptypane svg { width: 34px; height: 34px; opacity: .55; margin-bottom: 4px; }
#fxm .fxm-emptypane b { font-size: 14px; color: var(--ink); font-weight: 800; }

/* All / Unread */
#fxm .fxm-seg { display: flex; gap: 2px; margin: 10px 18px; padding: 3px; border-radius: 9px; background: #E8EAF2; flex: none; align-self: flex-start; }
#fxm .fxm-seg button { height: 26px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 700; cursor: pointer; }
#fxm .fxm-seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20,24,60,.14); }

/* List rows (shared shape with the peek) */
.fxm-av { width: 36px; height: 36px; border-radius: 50%; background: #3A418A; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; letter-spacing: .02em; }
.fxm-av.m { background: #3A418A; }
.fxm-av.sup { background: var(--accent-soft); color: var(--accent); }
.fxm-av.req { background: var(--warn-soft); color: var(--warn); border-radius: 10px; }
.fxm-av svg { width: 18px; height: 18px; }
.fxm-ub { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; flex: none; }
#fxm .fxm-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; transition: background .12s; }
#fxm .fxm-item:hover { background: var(--sunk); }
#fxm .fxm-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
#fxm .fxm-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#fxm .fxm-ib { flex: 1; min-width: 0; }
#fxm .fxm-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
#fxm .fxm-name { font-size: 13.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#fxm .fxm-time { margin-left: auto; padding-left: 6px; flex: none; font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
#fxm .fxm-ctx { margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fxm .fxm-row2 { display: flex; align-items: center; gap: 8px; margin-top: 3px; min-width: 0; }
#fxm .fxm-prev { flex: 1; min-width: 0; margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fxm .fxm-prev b { color: var(--ink-2); font-weight: 700; }
#fxm .unread .fxm-name { font-weight: 800; }
#fxm .unread .fxm-prev { color: var(--ink-2); }
#fxm .unread .fxm-time { color: var(--accent); }
.fxm-kind { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; flex: none; background: var(--sunk); color: var(--ink-2); }
.fxm-kind.po, .fxm-kind.acc { background: var(--accent-soft); color: #2A37B8; }
.fxm-kind.ok { background: var(--ok-soft); color: var(--ok); }
.fxm-kind.warn { background: var(--warn-soft); color: var(--warn); }
.fxm-kind.bad { background: var(--bad-soft, #FDE7EA); color: var(--bad); }
.fxm-kind.grp { background: #F1ECFE; color: #6D28D9; }
.fxm-kind.mute { background: var(--sunk); color: var(--muted); }
#fxm .fxm-newbtn { margin: 12px 18px 10px; height: 36px; padding: 0 12px; border: 1px dashed var(--line-2); border-radius: 9px; background: var(--surface); color: var(--accent); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; flex: none; }
#fxm .fxm-newbtn:hover { background: var(--accent-soft); border-color: #C9CEF9; }
#fxm .fxm-newbtn svg { width: 15px; height: 15px; }

/* Thread */
#fxm .fxm-thead { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 14px 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
#fxm .fxm-back { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); padding: 0; cursor: pointer; }
#fxm .fxm-back:hover { background: var(--sunk); color: var(--ink); }
#fxm .fxm-back svg { width: 16px; height: 16px; }
#fxm .fxm-tav { width: 34px; height: 34px; border-radius: 50%; background: #3A418A; color: #fff; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; flex: none; }
#fxm .fxm-tav:empty { display: none; }
#fxm .fxm-tav.sup { background: var(--accent-soft); color: var(--accent); }
#fxm .fxm-tav.sup svg { width: 18px; height: 18px; }
#fxm .fxm-ttl { flex: 1; min-width: 0; }
#fxm .fxm-tname { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14.5px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fxm .fxm-tsub { margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fxm .fxm-openrec { flex: none; gap: 5px; }
#fxm .fxm-openrec svg { width: 13px; height: 13px; }
#fxm .fxm-msgs { position: relative; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; justify-content: flex-start; gap: 10px; padding: 16px 18px 10px; background: var(--surface); }
#fxm .fxm-msgs > :first-child { margin-top: auto; }
#fxm .fxm-day { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
#fxm .fxm-day::before, #fxm .fxm-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#fxm .fxm-bw { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
#fxm .fxm-bw.mine { flex-direction: row-reverse; }
#fxm .fxm-bav { width: 28px; height: 28px; border-radius: 50%; background: #3A418A; color: #fff; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; flex: none; margin-bottom: 18px; }
#fxm .fxm-bav.sys { background: #B4B8CC; }
#fxm .fxm-bav.sup { background: var(--accent-soft); color: var(--accent); }
#fxm .fxm-bav.sup svg { width: 15px; height: 15px; }
#fxm .fxm-b { position: relative; max-width: 78%; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
#fxm .fxm-bw.mine .fxm-b { align-items: flex-end; }
#fxm.wide .fxm-b { max-width: 68%; }
#fxm .fxm-meta { display: flex; align-items: baseline; gap: 6px; margin: 0 4px 3px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
#fxm .fxm-meta b { color: var(--ink-2); font-weight: 700; }
#fxm .fxm-body { max-width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; background: var(--sunk); color: var(--ink); font-size: 13.5px; line-height: 1.5; word-break: break-word; overflow-wrap: anywhere; }
#fxm .fxm-body .omstr-main { white-space: pre-wrap; }
#fxm .fxm-bw.mine .fxm-body { background: var(--accent); border-color: var(--accent); color: #fff; border-radius: 12px 12px 4px 12px; }
#fxm .fxm-b.deleted .fxm-body, #fxm .fxm-bw.mine .fxm-b.deleted .fxm-body { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); }
#fxm .fxm-bw.system { justify-content: center; }
#fxm .fxm-bw.system .fxm-bav { display: none; }
#fxm .fxm-bw.system .fxm-b { max-width: 90%; align-items: center; }
#fxm .fxm-bw.system .fxm-meta b { display: none; }
#fxm .fxm-bw.system .fxm-body { background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--ink-2); text-align: center; }
/* OMSTranslate inside a bubble: reader's language on top, original one click below. */
#fxm .omstr-note { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-2); font-size: 11.5px; color: var(--muted); opacity: 1; }
#fxm .omstr-link { color: var(--accent); font-weight: 700; opacity: 1; text-decoration: none; background: none; border: 0; padding: 0; margin-left: 6px; cursor: pointer; font-size: inherit; }
#fxm .omstr-link:hover { text-decoration: underline; }
#fxm .omstr-alt { margin-top: 6px; padding: 4px 0 4px 8px; border-left: 2px solid var(--line-2); color: var(--ink-2); opacity: 1; white-space: pre-wrap; }
#fxm .fxm-bw.mine .omstr-note { border-top-color: rgba(255,255,255,.35); color: rgba(255,255,255,.85); }
#fxm .fxm-bw.mine .omstr-link { color: #fff; text-decoration: underline; }
#fxm .fxm-bw.mine .omstr-alt { border-left-color: rgba(255,255,255,.5); color: rgba(255,255,255,.92); }
/* Hover toolbar (own messages: delete) */
#fxm .fxm-acts { position: absolute; top: -12px; right: 4px; z-index: 2; display: flex; gap: 1px; padding: 3px; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 6px 18px -8px rgba(27,32,82,.35); opacity: 0; pointer-events: none; transition: opacity .12s; }
#fxm .fxm-bw.mine .fxm-acts { right: auto; left: 4px; }
#fxm .fxm-bw:hover .fxm-acts, #fxm .fxm-bw:focus-within .fxm-acts { opacity: 1; pointer-events: auto; }
#fxm .fxm-act { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
#fxm .fxm-act svg { width: 14px; height: 14px; }
#fxm .fxm-act.danger:hover { background: var(--bad-soft, #FDE7EA); color: var(--bad); }
@media (hover: none) { #fxm .fxm-acts { position: static; opacity: 1; pointer-events: auto; box-shadow: none; margin-top: 4px; background: transparent; border-color: transparent; } }
/* Attachments */
#fxm .fxm-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#fxm .fxm-body > .fxm-atts:first-child { margin-top: 0; }
#fxm .fxm-att { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; text-decoration: none; }
#fxm a.fxm-att:hover { border-color: var(--line-2); color: var(--ink); }
#fxm .fxm-att svg { width: 13px; height: 13px; flex: none; }
#fxm .fxm-att-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
#fxm .fxm-bw.mine .fxm-att { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.32); color: #fff; }
#fxm .fxm-att.pending { background: var(--accent-soft); border-color: transparent; color: #2A37B8; padding-right: 4px; }
#fxm .fxm-att-x { width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 0; }
#fxm .fxm-att-x:hover { background: rgba(42,55,184,.12); }
/* Composer */
#fxm .fxm-composer { padding: 10px 14px 14px; border-top: 1px solid var(--line); background: var(--surface); flex: none; }
#fxm .fxm-cbox { border: 1px solid var(--line-2); border-radius: 12px; background: #fff; transition: border-color .12s, box-shadow .12s; }
#fxm .fxm-cbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#fxm .fxm-input, #fxm .fxm-input:focus { display: block; width: 100%; min-height: 44px; max-height: 160px; margin: 0; padding: 10px 12px 4px; border: 0; border-radius: 12px 12px 0 0; background: transparent; box-shadow: none; outline: none; resize: none; font-family: inherit; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
#fxm .fxm-strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 10px 2px; }
#fxm .fxm-strip[hidden] { display: none; }
#fxm .fxm-crow { display: flex; align-items: center; gap: 2px; margin: 0; padding: 4px 6px 6px; }
#fxm .fxm-ibtn { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; flex: none; }
#fxm .fxm-ibtn:hover { background: var(--sunk); color: var(--ink); }
#fxm .fxm-ibtn svg { width: 17px; height: 17px; }
#fxm .fxm-hint { flex: 1; min-width: 0; padding: 0 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fxm .fxm-send { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid var(--accent); border-radius: 9px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; flex: none; white-space: nowrap; }
#fxm .fxm-send:hover { background: #2F3FD0; border-color: #2F3FD0; }
#fxm .fxm-send svg { width: 14px; height: 14px; }

/* Order-date request cards */
#fxm .fxr-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 10px; overflow: hidden; }
#fxm .fxr-card.open { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(20,24,60,.05); }
#fxm .fxr-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; cursor: pointer; }
#fxm .fxr-head:hover { background: var(--sunk); }
#fxm .fxr-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
#fxm .fxr-terms { padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 600; line-height: 1.45; }
#fxm .fxr-lbl { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: -6px; }
#fxm .fxr-date, #fxm .fxr-qty, #fxm .fxr-reply input { height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font-family: inherit; font-size: 13px; color: var(--ink); }
#fxm .fxr-date { align-self: flex-start; }
#fxm .fxr-qty { width: 84px; text-align: right; }
#fxm .fxr-items { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
#fxm .fxr-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; font-size: 12.5px; border-bottom: 1px solid var(--line); }
#fxm .fxr-item:last-child { border-bottom: 0; }
#fxm .fxr-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#fxm .fxr-note { padding: 8px 10px; border-radius: 8px; background: var(--sunk); font-size: 12.5px; }
#fxm .fxr-msgs { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
#fxm .fxr-msg { font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
#fxm .fxr-msg b { color: var(--ink); margin-right: 4px; }
#fxm .fxr-msg.mine b { color: var(--accent); }
#fxm .fxr-msg.muted { color: var(--muted); }
#fxm .fxr-reply { display: flex; gap: 6px; }
#fxm .fxr-reply input { flex: 1; min-width: 0; }
#fxm .fxr-reply input:focus, #fxm .fxr-date:focus, #fxm .fxr-qty:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#fxm .fxr-acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* New support ticket dialog */
#fxm-ticket { position: fixed; inset: 0; z-index: 9500; display: flex; align-items: center; justify-content: center; background: rgba(20,24,45,.45); }
#fxm-ticket[hidden] { display: none; }
#fxm-ticket .fxm-mcard { width: min(480px, calc(var(--rd-vw, 100vw) - 32px)); max-height: min(calc(var(--rd-vh, 100vh) * .8), 640px); overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 30px 80px -20px rgba(20,24,45,.45); font-size: 14px; }
#fxm-ticket .fxm-mhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
#fxm-ticket .fxm-mtitle { font-size: 17px; font-weight: 800; color: var(--ink); }
#fxm-ticket .fxm-msub { margin-top: 2px; font-size: 13px; color: var(--muted); }
#fxm-ticket .fxm-mlbl { display: block; margin: 4px 0 -6px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
#fxm-ticket .fxm-minput { display: block; width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; font-family: inherit; font-size: 13.5px; color: var(--ink); resize: vertical; }
#fxm-ticket .fxm-minput:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#fxm-ticket .fxm-mfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* The retired right-edge launcher and the old sheet: Messages lives in the top bar. */
body #fmsgTriggerWrap { display: none; }

/* ======================================================================
   4. SMALL SCREENS — same breakpoints as admin's top bar and sheet.
   ====================================================================== */
@media (max-width: 900px) {
    #fx-topbar.rd.rd-atb { margin: -16px -16px 16px; padding: 0 12px; height: 56px; gap: 8px; }
    #fx-topbar + #merchant-scope-bar { top: 56px; margin: -16px -16px 16px; }
    #fx-topbar .rd-atb-search .kbd { display: none; }
    #fxm, #fxm.wide { width: 100%; }
    #fxm .fxm-widebtn { display: none; }
    #fxm .fxm-hint { display: none; }
    #fxm .fxm-crow .fxm-send { margin-left: auto; }
}
@media (max-width: 520px) {
    #fx-topbar .rd-atb-search input[type="search"]::placeholder { color: transparent; }
    #fx-topbar .rd-atb-results { position: fixed; top: 60px; left: 12px; right: 12px; min-width: 0; }
    #fx-topbar .fx-peek.show { display: none; }
    #fx-topbar .fx-atb-lang { padding: 0 8px; }
}

/* Merchant scope: one slim row under the top bar, not a full-width form block. */
#fx-topbar + #merchant-scope-bar[style*="flex"], #fx-topbar + #merchant-scope-bar:not([style*="none"]) {
    display: flex !important; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 8px 24px; background: #fff; border-bottom: 1px solid #E4E7EF;
}
#fx-topbar + #merchant-scope-bar .msb-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #62678A; margin: 0; }
#fx-topbar + #merchant-scope-bar #merchant-scope-select { width: auto; min-width: 220px; max-width: 360px; height: 34px; padding: 0 30px 0 10px; border-radius: 9px; border: 1px solid #D3D7E4; font-size: 13.5px; font-weight: 600; margin: 0; }
#fx-topbar + #merchant-scope-bar .msb-hint { font-size: 12.5px; color: #62678A; margin: 0; }

/* ======================================================================
   r5 — Messages as a message centre (oms-rdf-shell.js): filter bar with
   Mark all read, row star / mark-read, Draft tag, search highlight, header
   star, "New" divider, "Seen", jump-to-latest, shortcuts popover, skeletons.
   Same look as admin's oms-rd-msgcentre.css.
   ====================================================================== */
#fxm.wide { width: min(1320px, calc(var(--rd-vw, 100vw) - 32px)); }
#fxm.wide .fxm-list { flex: 0 0 380px; }
#fxm .fxm-thread { position: relative; }
#fxm .fxm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); flex: none; min-width: 0; }
#fxm .fxm-bar .fxm-seg { margin: 0; flex: 0 1 auto; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
#fxm .fxm-bar .fxm-seg::-webkit-scrollbar { display: none; }
#fxm .fxm-bar .fxm-seg button { padding: 0 10px; white-space: nowrap; flex: none; }
#fxm .fxm-bar .fxm-newbtn { margin: 0; flex: 1 1 auto; }
#fxm .fxm-markall { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--accent); font-family: inherit; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; }
#fxm .fxm-markall svg { width: 15px; height: 15px; }
#fxm .fxm-markall:hover:not(:disabled) { background: var(--accent-soft); border-color: #C9CEF9; }
#fxm .fxm-markall:disabled { color: var(--muted); opacity: .55; cursor: default; }
@media (max-width: 560px) { #fxm .fxm-markall span { display: none; } #fxm .fxm-markall { width: 32px; padding: 0; justify-content: center; } }
#fxm .fxm-rbtn { width: 26px; height: 26px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s; }
#fxm .fxm-rbtn svg { width: 15px; height: 15px; }
#fxm .fxm-item:hover .fxm-rbtn, #fxm .fxm-rbtn:focus-visible { opacity: 1; }
#fxm .fxm-rbtn:hover { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line-2); }
#fxm .fxm-star.on { opacity: 1; color: #D9A21B; }
#fxm .fxm-star.on svg, #fxm .fxm-hstar.on svg { fill: #F5C451; }
#fxm .fxm-hstar.on { color: #D9A21B; background: #FFFBEB; }
#fxm .fxm-item.starred { background: linear-gradient(90deg, #FFFBEB, transparent 60%); }
#fxm .fxm-item.starred.active { background: var(--accent-soft); }
@media (hover: none) { #fxm .fxm-rbtn { opacity: .7; } }
#fxm .fxm-dtag { display: inline-block; margin-right: 2px; padding: 0 5px; border-radius: 4px; background: var(--bad-soft, #FDE7EA); color: var(--bad); font-size: 10.5px; font-weight: 800; font-style: normal; }
#fxm mark.fxm-hl { background: #FFE58A; color: inherit; border-radius: 3px; padding: 0 1px; }
#fxm .fxm-empty .btn { margin-top: 10px; }
#fxm .fxm-newdiv { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--bad); }
#fxm .fxm-newdiv::before, #fxm .fxm-newdiv::after { content: ""; flex: 1; height: 1px; background: #F3B6BF; }
#fxm .fxm-seen { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--ok); font-weight: 700; }
#fxm .fxm-seen svg { width: 13px; height: 13px; }
#fxm .fxm-jump { position: absolute; right: 22px; bottom: 118px; z-index: 4; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink-2); font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 22px -10px rgba(27,32,82,.45); }
#fxm .fxm-jump[hidden] { display: none; }
#fxm .fxm-jump svg { width: 14px; height: 14px; }
#fxm .fxm-head { position: relative; }
#fxm .fxm-kbd { position: absolute; top: 52px; right: 18px; z-index: 20; width: 300px; max-width: calc(100% - 36px); padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px -12px rgba(27,32,82,.32); font-size: 12.5px; color: var(--ink-2); }
#fxm .fxm-kbd[hidden] { display: none; }
#fxm .fxm-kbd-h { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; color: var(--muted); margin: 2px 0 8px; }
#fxm .fxm-kbd-r { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
#fxm .fxm-kbd-r > span { flex: 0 0 96px; display: flex; gap: 4px; }
#fxm .fxm-kbd-r em { font-style: normal; }
#fxm .fxm-kbd kbd { display: inline-block; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--sunk); font-family: inherit; font-size: 11px; font-weight: 800; line-height: 19px; text-align: center; color: var(--ink); }
#fxm .fxm-skrow { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
#fxm .fxm-skrow > div { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 3px; }
#fxm .fxm-sk { display: block; background: linear-gradient(90deg, #EEF0F6 25%, #F6F7FB 50%, #EEF0F6 75%); background-size: 200% 100%; animation: fxmShim 1.2s linear infinite; }
#fxm .fxm-sk.av { width: 36px; height: 36px; border-radius: 50%; flex: none; }
#fxm .fxm-sk.l { height: 10px; border-radius: 5px; }
#fxm .fxm-skel.th { display: flex; flex-direction: column; gap: 12px; padding: 8px 0; }
#fxm .fxm-sk.b { height: 38px; border-radius: 12px; }
#fxm .fxm-sk.b.r { align-self: flex-end; }
#fxm .fxm-sk.w40 { width: 40%; } #fxm .fxm-sk.w50 { width: 50%; } #fxm .fxm-sk.w60 { width: 60%; } #fxm .fxm-sk.w75 { width: 75%; } #fxm .fxm-sk.w90 { width: 90%; }
@keyframes fxmShim { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { #fxm .fxm-sk { animation: none; } }
