/* AMxIM (team messenger) — scoped to #amxc-root so it never touches dashboard
   styles. Colours come from AMxIM's own theme (set by chat.js as --c-*
   variables on the root); the default "Dashboard" theme matches AMxCRM. */

#amxc-root { --c-radius: 14px; --c-fs: 15px; --c-pad: 8px; font-size: var(--c-fs); line-height: 1.4; color: var(--c-text);
  font-family: 'Rajdhani', -apple-system, sans-serif; font-weight: 500; }
#amxc-root input, #amxc-root textarea, #amxc-root select { font-family: inherit; font-weight: 500; }
#amxc-root * { box-sizing: border-box; }
#amxc-root [hidden] { display: none !important; }
#amxc-root button { font: inherit; color: inherit; }
#amxc-root.size-s { --c-fs: 14px; } #amxc-root.size-l { --c-fs: 16.5px; } #amxc-root.size-xl { --c-fs: 18px; }
#amxc-root.dense { --c-pad: 4px; }
#amxc-root ::-webkit-scrollbar { width: 8px; height: 8px; }
#amxc-root ::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 4px; }
#amxc-root * { scrollbar-color: var(--c-border) transparent; scrollbar-width: thin; }

/* ---------- dock: homebar + chat window + tabs, along the bottom ---------- */
.amxc-dock { position: fixed; bottom: 16px; z-index: 1060; display: flex; align-items: flex-end; gap: 12px; pointer-events: none; }
#amxc-root.dock-right .amxc-dock { right: 16px; flex-direction: row-reverse; }
#amxc-root.dock-left .amxc-dock { left: 16px; flex-direction: row; }
.amxc-dock > * { pointer-events: auto; }
.amxc-card { position: relative; display: flex; flex-direction: column; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--c-radius);
  box-shadow: 0 16px 44px rgba(0,0,0,.42); overflow: hidden; animation: amxc-pop .16s ease; }
.amxc-home { width: 330px; }
.amxc-home .amxc-head { background: var(--c-panel); }
.amxc-win { width: 370px; }
@keyframes amxc-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.amxc-grip-top { position: absolute; left: 30%; right: 30%; top: 0; height: 7px; cursor: ns-resize; z-index: 3; }
.amxc-grip-top::after { content: ''; position: absolute; left: 50%; top: 2px; width: 36px; height: 3px; margin-left: -18px; border-radius: 2px; background: var(--c-border); opacity: 0; transition: opacity .15s; }
.amxc-home:hover .amxc-grip-top::after { opacity: 1; }
.amxc-grip-corner { position: absolute; top: 0; width: 16px; height: 16px; z-index: 3; }
#amxc-root.dock-right .amxc-grip-corner { left: 0; cursor: nwse-resize; }
#amxc-root.dock-left .amxc-grip-corner { right: 0; cursor: nesw-resize; }
.amxc-grip-corner::before { content: ''; position: absolute; top: 4px; width: 7px; height: 7px; border-top: 2px solid var(--c-border); }
#amxc-root.dock-right .amxc-grip-corner::before { left: 4px; border-left: 2px solid var(--c-border); border-top-left-radius: 3px; }
#amxc-root.dock-left .amxc-grip-corner::before { right: 4px; border-right: 2px solid var(--c-border); border-top-right-radius: 3px; }
.amxc-grip-corner:hover::before { border-color: var(--c-accent); }

.amxc-launcher { position: relative; width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--c-accent); color: var(--c-accent-text); box-shadow: 0 6px 22px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; transition: transform .15s ease; animation: amxc-pop .16s ease; }
.amxc-launcher:hover { transform: translateY(-2px) scale(1.04); }
.amxc-launcher svg { width: 26px; height: 26px; }
.amxc-badge { position: absolute; top: -4px; right: -4px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: #E5484D; color: #fff; font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--c-bg); }
.amxc-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--c-accent); color: var(--c-accent-text); font-size: .7em; font-weight: 700; }

/* tabs: chats you've opened, waiting along the bottom */
.amxc-tabs { display: flex; gap: 8px; align-items: flex-end; }
#amxc-root.dock-right .amxc-tabs { flex-direction: row-reverse; }
.amxc-tab { display: flex; align-items: center; gap: 8px; width: 178px; height: 44px; padding: 0 6px 0 8px; border-radius: 22px; background: var(--c-panel); border: 1px solid var(--c-border);
  box-shadow: 0 8px 22px rgba(0,0,0,.32); cursor: pointer; color: var(--c-text); animation: amxc-pop .16s ease; }
.amxc-tab:hover { border-color: var(--c-accent); }
.amxc-tab .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9em; }
.amxc-tab.unread .name { font-weight: 700; }
.amxc-tab .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--c-accent); color: var(--c-accent-text); font-size: .72em; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.amxc-tab .count.mention { background: #E5484D; color: #fff; }
.amxc-tab .x { width: 24px; height: 24px; border: none; background: none; border-radius: 50%; color: var(--c-dim); cursor: pointer; font-size: 17px; line-height: 1; flex-shrink: 0; }
.amxc-tab .x:hover { background: var(--c-hover); color: var(--c-text); }
.amxc-tab.more { width: auto; padding: 0 16px; font-weight: 700; justify-content: center; }

/* ---------- expanded: one large two-pane view ---------- */
.amxc-backdrop { position: fixed; inset: 0; z-index: 1055; background: rgba(0,0,0,.45); }
.amxc-big { position: fixed; z-index: 1060; display: flex; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--c-radius); box-shadow: 0 24px 60px rgba(0,0,0,.5); overflow: hidden; animation: amxc-pop .16s ease; }
.amxc-big.max { border-radius: 0; border: none; }
.amxc-big .amxc-head { cursor: grab; }
.amxc-big .amxc-head:active { cursor: grabbing; }
.amxc-big.max .amxc-head { cursor: default; }
.amxc-big.snap-hint { outline: 3px solid var(--c-accent); outline-offset: -3px; }
.amxc-rz { position: absolute; z-index: 5; }
.amxc-rz.n, .amxc-rz.s { left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.amxc-rz.n { top: -3px; } .amxc-rz.s { bottom: -3px; }
.amxc-rz.e, .amxc-rz.w { top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.amxc-rz.e { right: -3px; } .amxc-rz.w { left: -3px; }
.amxc-rz.ne, .amxc-rz.nw, .amxc-rz.se, .amxc-rz.sw { width: 14px; height: 14px; }
.amxc-rz.ne { top: -3px; right: -3px; cursor: nesw-resize; } .amxc-rz.sw { bottom: -3px; left: -3px; cursor: nesw-resize; }
.amxc-rz.nw { top: -3px; left: -3px; cursor: nwse-resize; } .amxc-rz.se { bottom: -3px; right: -3px; cursor: nwse-resize; }
.amxc-big-list { width: 310px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--c-border); background: var(--c-panel); min-height: 0; }
.amxc-big-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.amxc-big-side { width: 370px; flex-shrink: 0; display: flex; flex-direction: column; border-left: 1px solid var(--c-border); min-height: 0; }

.amxc-head { display: flex; align-items: center; gap: 6px; padding: 9px 8px 9px 12px; background: var(--c-panel); border-bottom: 1px solid var(--c-border); user-select: none; flex-shrink: 0; }
.amxc-title { flex: 1; min-width: 0; font-weight: 700; font-size: 1.05em; display: flex; align-items: center; gap: 8px; }
.amxc-title .sub { font-weight: 400; color: var(--c-dim); font-size: .8em; }
.amxc-title .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-icon-btn { flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--c-dim); }
.amxc-icon-btn:hover { background: var(--c-hover); color: var(--c-text); }
.amxc-icon-btn.on { color: var(--c-accent); }
.amxc-icon-btn svg { width: 18px; height: 18px; }
.amxc-pane { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }

/* ---------- conversation list ---------- */
.amxc-search { margin: 10px 12px 6px; display: flex; align-items: center; gap: 8px; background: var(--c-surface); border-radius: 10px; padding: 0 10px; }
.amxc-search svg { width: 16px; height: 16px; color: var(--c-dim); flex-shrink: 0; }
.amxc-search input { flex: 1; border: none; background: transparent; outline: none; padding: 9px 0; color: var(--c-text); font: inherit; }
.amxc-list { flex: 1; overflow-y: auto; padding: 4px 6px 10px; }
.amxc-section { font-size: .74em; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-dim); padding: 10px 10px 4px; }
.amxc-conv { display: flex; align-items: center; gap: 10px; padding: calc(var(--c-pad) + 2px) 8px; border-radius: 10px; cursor: pointer; position: relative; }
.amxc-conv:hover { background: var(--c-hover); }
.amxc-conv.active { background: var(--c-active); }
.amxc-conv .meta { flex: 1; min-width: 0; }
.amxc-conv .row1 { display: flex; align-items: baseline; gap: 6px; }
.amxc-conv .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-conv .time { font-size: .76em; color: var(--c-dim); flex-shrink: 0; }
.amxc-conv .preview { font-size: .86em; color: var(--c-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.amxc-conv.unread .name, .amxc-conv.unread .preview { font-weight: 700; color: var(--c-text); }
.amxc-conv .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--c-accent); color: var(--c-accent-text); font-size: .74em; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.amxc-conv .count.mention { background: #E5484D; color: #fff; }
.amxc-conv .count.dot { min-width: 10px; width: 10px; height: 10px; padding: 0; }
.amxc-conv .flags { display: flex; gap: 3px; color: var(--c-dim); }
.amxc-conv .flags svg { width: 13px; height: 13px; }
.amxc-conv .more { opacity: 0; }
.amxc-conv:hover .more, .amxc-conv .more:focus { opacity: 1; }
.amxc-empty { text-align: center; color: var(--c-dim); padding: 30px 18px; font-size: .92em; }
.amxc-empty button { margin-top: 12px; }

/* ---------- avatars ---------- */
.amxc-av { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8em; color: #fff; flex-shrink: 0; letter-spacing: .02em; position: relative; }
.amxc-av.sm { width: 28px; height: 28px; font-size: .7em; }
.amxc-av.xs { width: 26px; height: 26px; font-size: .64em; }
.amxc-av.group { border-radius: 11px; }

/* ---------- messages ---------- */
.amxc-pins { display: flex; align-items: center; gap: 8px; padding: 7px 14px; background: var(--c-panel); border-bottom: 1px solid var(--c-border); font-size: .86em; cursor: pointer; color: var(--c-dim); flex-shrink: 0; }
.amxc-pins:hover { color: var(--c-text); }
.amxc-pins svg { width: 14px; height: 14px; color: var(--c-accent); flex-shrink: 0; }
.amxc-pins .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-msgs { flex: 1; overflow-y: auto; padding: 10px 12px 6px; position: relative; }
.amxc-older { display: block; margin: 4px auto 10px; }
.amxc-date { text-align: center; margin: 14px 0 8px; }
.amxc-date span { font-size: .74em; font-weight: 700; color: var(--c-dim); background: var(--c-surface); padding: 3px 10px; border-radius: 10px; letter-spacing: .02em; }
.amxc-sys { text-align: center; font-size: .8em; color: var(--c-dim); margin: 6px 20px; }
.amxc-msg { display: flex; gap: 8px; margin-top: calc(var(--c-pad) + 2px); position: relative; }
.amxc-msg.cont { margin-top: 2px; }
.amxc-msg.mine { flex-direction: row-reverse; }
.amxc-msg .gutter { width: 28px; flex-shrink: 0; }
.amxc-msg .col { max-width: 78%; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.amxc-msg.mine .col { align-items: flex-end; }
.amxc-msg .who { font-size: .76em; font-weight: 600; color: var(--c-dim); margin: 0 10px 2px; }
.amxc-bubble { background: var(--c-surface); color: var(--c-text); padding: 7px 11px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; position: relative; }
.amxc-msg.mine .amxc-bubble { background: var(--c-mine); color: var(--c-mine-text); }
.amxc-msg.mention-me .amxc-bubble { box-shadow: inset 3px 0 0 var(--c-accent); }
.amxc-bubble.big-emoji { background: transparent !important; font-size: 2.2em; padding: 0 4px; line-height: 1.15; }
.amxc-bubble.deleted { background: transparent !important; border: 1px dashed var(--c-border); color: var(--c-dim) !important; font-style: italic; }
.amxc-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.amxc-bubble code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: rgba(127,127,127,.18); padding: 1px 5px; border-radius: 5px; }
.amxc-bubble pre { margin: 4px 0; background: rgba(0,0,0,.22); padding: 8px 10px; border-radius: 8px; overflow-x: auto; white-space: pre; }
.amxc-bubble pre code { background: none; padding: 0; }
.amxc-bubble blockquote { margin: 2px 0; padding-left: 9px; border-left: 3px solid currentColor; opacity: .85; }
.amxc-bubble .mention { font-weight: 700; background: var(--c-mention); border-radius: 5px; padding: 0 3px; }
.amxc-bubble .mention.me { background: var(--c-accent); color: var(--c-accent-text); }
.amxc-msg.mine .amxc-bubble .mention { background: rgba(255,255,255,.22); color: inherit; }
.amxc-stamp { font-size: .7em; color: var(--c-dim); margin: 2px 10px 0; white-space: nowrap; }
.amxc-stamp .pin { color: var(--c-accent); }
.amxc-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 4px 0; }
.amxc-react { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 12px; border: 1px solid var(--c-border); background: var(--c-panel); cursor: pointer; font-size: .86em; }
.amxc-react.mine { border-color: var(--c-accent); background: var(--c-mention); }
.amxc-react .n { font-size: .85em; font-weight: 600; color: var(--c-dim); }
.amxc-thread-link { margin: 3px 8px 0; font-size: .8em; font-weight: 600; color: var(--c-accent); cursor: pointer; background: none; border: none; padding: 0; }
.amxc-thread-link:hover { text-decoration: underline; }
.amxc-actions { position: absolute; top: -14px; display: none; gap: 2px; background: var(--c-panel); border: 1px solid var(--c-border); border-radius: 10px; padding: 2px; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 2; }
.amxc-msg:not(.mine) .amxc-actions { right: 8px; }
.amxc-msg.mine .amxc-actions { left: 8px; }
.amxc-msg:hover .amxc-actions, .amxc-msg.show-actions .amxc-actions { display: flex; }
.amxc-actions button { width: 28px; height: 28px; border: none; background: none; border-radius: 7px; cursor: pointer; color: var(--c-dim); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.amxc-actions button:hover { background: var(--c-hover); color: var(--c-text); }
.amxc-actions svg { width: 16px; height: 16px; }
.amxc-newpill { position: sticky; bottom: 6px; margin: 0 auto; display: block; padding: 5px 14px; border-radius: 14px; border: none; background: var(--c-accent); color: var(--c-accent-text); font-size: .82em; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.amxc-thread-parent { border-bottom: 1px solid var(--c-border); padding-bottom: 8px; margin-bottom: 4px; }

/* ---------- composer ---------- */
.amxc-composer { border-top: 1px solid var(--c-border); background: var(--c-panel); padding: 6px 10px 10px; flex-shrink: 0; position: relative; }
.amxc-editing { display: flex; align-items: center; justify-content: space-between; font-size: .8em; color: var(--c-accent); font-weight: 600; padding: 2px 4px 6px; }
.amxc-tools { display: flex; gap: 2px; margin-bottom: 4px; flex-wrap: wrap; }
.amxc-tools button { width: 30px; height: 28px; border: none; background: none; border-radius: 7px; cursor: pointer; color: var(--c-dim); font-size: 13px; display: flex; align-items: center; justify-content: center; }
.amxc-tools button:hover { background: var(--c-hover); color: var(--c-text); }
.amxc-tools svg { width: 16px; height: 16px; }
.amxc-input-row { display: flex; align-items: flex-end; gap: 8px; }
.amxc-input { flex: 1; resize: none; border: 1px solid var(--c-border); background: var(--c-bg); color: var(--c-text); border-radius: 12px; padding: 9px 12px; font: inherit; line-height: 1.4; max-height: 40vh; min-height: 40px; outline: none; }
.amxc-input:focus { border-color: var(--c-accent); }
.amxc-send { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--c-accent); color: var(--c-accent-text); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.amxc-send:disabled { opacity: .4; cursor: default; }
.amxc-send svg { width: 18px; height: 18px; }
.amxc-hint { font-size: .7em; color: var(--c-dim); margin-top: 4px; }

/* ---------- popovers (emoji, mentions, menus) ---------- */
.amxc-pop { position: fixed; z-index: 1080; background: var(--c-panel); border: 1px solid var(--c-border); border-radius: 12px; box-shadow: 0 12px 34px rgba(0,0,0,.4); color: var(--c-text); font-size: var(--c-fs); }
.amxc-menu { padding: 5px; min-width: 190px; }
.amxc-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: .92em; }
.amxc-menu button:hover { background: var(--c-hover); }
.amxc-menu button.danger { color: #E5484D; }
.amxc-menu svg { width: 15px; height: 15px; color: var(--c-dim); }
.amxc-menu hr { border: none; border-top: 1px solid var(--c-border); margin: 4px 2px; }
.amxc-emoji { width: 316px; padding: 8px; }
.amxc-emoji .tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); padding-bottom: 6px; margin-bottom: 6px; }
.amxc-emoji .tabs button { flex: 1; border: none; background: none; border-radius: 7px; padding: 4px 0; cursor: pointer; font-size: 17px; opacity: .55; }
.amxc-emoji .tabs button.on { opacity: 1; background: var(--c-hover); }
.amxc-emoji .grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 210px; overflow-y: auto; }
.amxc-emoji .grid button { border: none; background: none; font-size: 21px; padding: 3px 0; border-radius: 7px; cursor: pointer; }
.amxc-emoji .grid button:hover { background: var(--c-hover); }
.amxc-quick { display: flex; gap: 2px; padding: 4px; }
.amxc-quick button { border: none; background: none; font-size: 20px; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; }
.amxc-quick button:hover { background: var(--c-hover); transform: scale(1.12); }
.amxc-mentions { min-width: 220px; max-height: 220px; overflow-y: auto; padding: 4px; }
.amxc-mentions button { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; padding: 6px 8px; border-radius: 8px; cursor: pointer; text-align: left; }
.amxc-mentions button.sel, .amxc-mentions button:hover { background: var(--c-hover); }
.amxc-mentions .sub { font-size: .78em; color: var(--c-dim); }
.amxc-mentions .none { padding: 8px 10px; font-size: .85em; color: var(--c-dim); }

/* ---------- forms (new chat, settings, admin) ---------- */
.amxc-form { flex: 1; overflow-y: auto; padding: 12px 16px 18px; }
.amxc-form h4 { margin: 18px 0 8px; font-size: .78em; letter-spacing: .07em; text-transform: uppercase; color: var(--c-dim); }
.amxc-form h4:first-child { margin-top: 4px; }
.amxc-field { display: block; margin-bottom: 10px; }
.amxc-field > span { display: block; font-size: .82em; font-weight: 600; color: var(--c-dim); margin-bottom: 4px; }
.amxc-text { width: 100%; border: 1px solid var(--c-border); background: var(--c-bg); color: var(--c-text); border-radius: 9px; padding: 8px 11px; font: inherit; outline: none; }
.amxc-text:focus { border-color: var(--c-accent); }
.amxc-btn { border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text); border-radius: 9px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: .92em; }
.amxc-btn:hover { border-color: var(--c-accent); }
.amxc-btn.primary { background: var(--c-accent); color: var(--c-accent-text); border-color: var(--c-accent); }
.amxc-btn.primary:disabled { opacity: .45; cursor: default; }
.amxc-btn.danger { color: #E5484D; }
.amxc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.amxc-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--c-mention); border: 1px solid var(--c-accent); border-radius: 14px; padding: 3px 4px 3px 10px; font-size: .86em; }
.amxc-chip button { border: none; background: none; cursor: pointer; color: var(--c-dim); font-size: 15px; line-height: 1; padding: 0 4px; }
.amxc-results { border: 1px solid var(--c-border); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.amxc-results button { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none; padding: 8px 10px; cursor: pointer; text-align: left; border-bottom: 1px solid var(--c-border); }
.amxc-results button:last-child { border-bottom: none; }
.amxc-results button:hover { background: var(--c-hover); }
.amxc-results .sub, .amxc-member .sub { font-size: .78em; color: var(--c-dim); }
.amxc-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; cursor: pointer; font-size: .93em; }
.amxc-toggle small { display: block; color: var(--c-dim); font-size: .82em; }
.amxc-switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.amxc-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.amxc-switch i { position: absolute; inset: 0; background: var(--c-border); border-radius: 11px; transition: background .15s; }
.amxc-switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.amxc-switch input:checked + i { background: var(--c-accent); }
.amxc-switch input:checked + i::after { transform: translateX(16px); background: var(--c-accent-text); }
.amxc-switch input:focus-visible + i { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.amxc-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.amxc-theme { border: 2px solid var(--c-border); border-radius: 10px; padding: 6px; cursor: pointer; background: none; text-align: left; font-size: .8em; font-weight: 600; }
.amxc-theme.on { border-color: var(--c-accent); }
.amxc-theme .sw { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin-bottom: 5px; }
.amxc-theme .sw i { flex: 1; }
.amxc-seg { display: inline-flex; border: 1px solid var(--c-border); border-radius: 9px; overflow: hidden; }
.amxc-seg button { border: none; background: none; padding: 6px 12px; cursor: pointer; font-size: .86em; }
.amxc-seg button.on { background: var(--c-accent); color: var(--c-accent-text); }
.amxc-member { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.amxc-member .meta { flex: 1; min-width: 0; }
.amxc-note { font-size: .82em; color: var(--c-dim); margin: 4px 0 10px; }
.amxc-err { color: #E5484D; font-size: .86em; margin: 6px 0; }

/* ---------- toasts ---------- */
.amxc-toasts { position: fixed; right: 16px; bottom: 90px; z-index: 1070; display: flex; flex-direction: column-reverse; gap: 10px; width: 330px; max-width: calc(100vw - 30px); }
.amxc-toast { display: flex; gap: 10px; padding: 11px 12px; background: var(--c-panel); color: var(--c-text); border: 1px solid var(--c-border); border-left: 4px solid var(--c-accent); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.4); cursor: pointer; animation: amxc-in .2s ease; font-size: var(--c-fs); }
.amxc-toast .meta { flex: 1; min-width: 0; }
.amxc-toast .t1 { font-weight: 700; font-size: .92em; }
.amxc-toast .t2 { font-size: .86em; color: var(--c-dim); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.amxc-toast .x { border: none; background: none; color: var(--c-dim); cursor: pointer; font-size: 17px; line-height: 1; align-self: flex-start; }
@keyframes amxc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#amxc-root.dock-left .amxc-toasts { right: auto; left: 16px; }

/* ---------- Neon: glowing, like the dashboard's dark theme ---------- */
#amxc-root.neon .amxc-card, #amxc-root.neon .amxc-big, #amxc-root.neon .amxc-tab { border-color: var(--c-accent); box-shadow: 0 0 16px var(--c-glow), 0 16px 44px rgba(0,0,0,.45); }
#amxc-root.neon .amxc-title, #amxc-root.neon .amxc-section { text-shadow: 0 0 8px var(--c-glow); }
#amxc-root.neon .amxc-title { color: var(--c-accent); }
#amxc-root.neon .amxc-msg.mine .amxc-bubble { border: 1px solid var(--c-accent); box-shadow: 0 0 10px var(--c-glow); }
#amxc-root.neon .amxc-msg:not(.mine) .amxc-bubble:not(.deleted):not(.big-emoji) { border: 1px solid var(--c-border); }
#amxc-root.neon .amxc-launcher, #amxc-root.neon .amxc-send, #amxc-root.neon .amxc-btn.primary { box-shadow: 0 0 14px var(--c-glow); }
#amxc-root.neon .amxc-input:focus, #amxc-root.neon .amxc-text:focus { box-shadow: 0 0 10px var(--c-glow); }
#amxc-root.neon .amxc-conv.active { box-shadow: inset 3px 0 0 var(--c-accent); }

@media (max-width: 640px) {
  .amxc-dock { left: 0 !important; right: 0 !important; bottom: 0; justify-content: flex-end; }
  .amxc-home, .amxc-win { width: 100vw !important; height: 100vh !important; border-radius: 0; position: fixed; inset: 0; }
  .amxc-tabs, .amxc-grip-top, .amxc-grip-corner { display: none; }
  .amxc-big-list { width: 40%; } .amxc-big-side { display: none; }
}
@media (prefers-reduced-motion: reduce) { #amxc-root *, #amxc-root *::before, #amxc-root *::after { animation: none !important; transition: none !important; } }

/* ---------- profiles: photos, presence dots, status ---------- */
.amxc-av img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.amxc-av.xl { width: 72px; height: 72px; font-size: 1.4em; }
.amxc-dot { position: absolute; right: -1px; bottom: -1px; width: 31%; height: 31%; min-width: 9px; min-height: 9px; border-radius: 50%; border: 2px solid var(--c-panel); }
.amxc-av[data-profile], .amxc-msg .who[data-profile] { cursor: pointer; }
.amxc-msg .who[data-profile]:hover { text-decoration: underline; }
.amxc-me { border: none; background: none; padding: 0; cursor: pointer; border-radius: 50%; flex-shrink: 0; }
.amxc-me:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.amxc-profile-top { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.amxc-profile-name { font-weight: 700; font-size: 1.1em; }
.amxc-statuses { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.amxc-status { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--c-border); border-radius: 9px; background: var(--c-bg); cursor: pointer; text-align: left; font-size: .88em; }
.amxc-status span { font-size: 1.15em; }
.amxc-status.on { border-color: var(--c-accent); background: var(--c-mention); }
.amxc-custom-status { display: flex; gap: 8px; margin-top: 8px; }
.amxc-profilepop { padding: 16px; width: 240px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.amxc-profilepop .name { font-weight: 700; margin-top: 6px; }
.amxc-profilepop .sub { font-size: .8em; color: var(--c-dim); }
.amxc-profilepop .status { font-size: .88em; margin: 4px 0; }
.amxc-profilepop .amxc-btn { margin-top: 8px; width: 100%; }

/* ---------- attachments ---------- */
.amxc-atts { display: flex; flex-direction: column; gap: 4px; margin-top: 3px; max-width: 100%; }
.amxc-msg.mine .amxc-atts { align-items: flex-end; }
.amxc-imgs { display: grid; gap: 4px; max-width: 260px; }
.amxc-imgs.n1 { grid-template-columns: 1fr; } .amxc-imgs.n2 { grid-template-columns: 1fr 1fr; } .amxc-imgs.n3 { grid-template-columns: 1fr 1fr 1fr; }
.amxc-img { border: none; padding: 0; background: var(--c-surface); border-radius: 12px; overflow: hidden; cursor: zoom-in; display: block; }
.amxc-imgs.n1 .amxc-img img { max-height: 240px; width: 100%; object-fit: cover; display: block; }
.amxc-imgs:not(.n1) .amxc-img, .amxc-gallery .amxc-img { aspect-ratio: 1; }
.amxc-imgs:not(.n1) .amxc-img img, .amxc-gallery .amxc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.amxc-filecard { display: flex; align-items: center; gap: 10px; padding: 7px 6px 7px 10px; border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-panel); width: 260px; max-width: 100%; }
.amxc-filecard.wide { width: 100%; margin-bottom: 6px; }
.amxc-filecard .meta { flex: 1; min-width: 0; }
.amxc-filecard .name { font-size: .88em; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-filecard .sub { font-size: .76em; color: var(--c-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-fileicon { width: 34px; height: 34px; border-radius: 9px; background: var(--c-mention); color: var(--c-accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.amxc-fileicon svg { width: 18px; height: 18px; }
.amxc-fileicon.sm { width: 26px; height: 26px; }
.amxc-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.amxc-pending { display: flex; flex-wrap: wrap; gap: 6px; }
.amxc-pending:not(:empty) { margin-bottom: 6px; }
.amxc-chipfile { display: flex; align-items: center; gap: 6px; max-width: 210px; padding: 3px 4px 3px 3px; border: 1px solid var(--c-border); border-radius: 9px; background: var(--c-bg); font-size: .8em; }
.amxc-chipfile img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.amxc-chipfile .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-chipfile .sz { color: var(--c-dim); flex-shrink: 0; }
.amxc-chipfile button { border: none; background: none; color: var(--c-dim); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; }
.amxc-chipfile.err { border-color: #E5484D; }
.amxc-dropzone { position: relative; }
.amxc-dropzone.dragging::after { content: 'Drop files to attach'; position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  background: var(--c-mention); border: 2px dashed var(--c-accent); border-radius: inherit; font-weight: 700; color: var(--c-text); pointer-events: none; }
.amxc-lightbox { position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,.86); display: flex; align-items: center; justify-content: center; }
.amxc-lightbox img { max-width: 92vw; max-height: 84vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.amxc-lightbox .bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 4px; padding: 10px 14px; color: #fff; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.amxc-lightbox .bar .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.amxc-lightbox .amxc-icon-btn { color: #fff; }
.amxc-lightbox .amxc-icon-btn:hover { background: rgba(255,255,255,.15); }
.amxc-lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: none; background: rgba(255,255,255,.14); color: #fff; font-size: 30px; cursor: pointer; }
.amxc-lightbox .nav:hover { background: rgba(255,255,255,.26); }
.amxc-lightbox .prev { left: 18px; } .amxc-lightbox .next { right: 18px; }

/* ---------- search results / jump ---------- */
.amxc-found .preview { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.amxc-found mark { background: var(--c-mention); color: var(--c-text); border-radius: 3px; padding: 0 1px; font-weight: 700; }
.amxc-found .sub { font-weight: 400; color: var(--c-dim); }
.amxc-latest { flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; border: none; border-bottom: 1px solid var(--c-border); background: var(--c-mention); color: var(--c-text); padding: 6px; font-size: .82em; font-weight: 600; cursor: pointer; }
.amxc-latest svg { width: 14px; height: 14px; }
.amxc-msg.flash .amxc-bubble, .amxc-msg.flash .amxc-atts { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: 16px; transition: outline-color .6s; }

/* ---------- motion: things animate when they appear, never on re-render ---------- */
.amxc-viewwrap { display: contents; }
.amxc-viewwrap > * { animation: amxc-fade .14s ease; }
@keyframes amxc-fade { from { opacity: 0; } to { opacity: 1; } }
.amxc-msg.in { animation: amxc-in .2s ease; }
.amxc-ghost { animation: amxc-out .16s ease forwards !important; }
@keyframes amxc-out { to { opacity: 0; transform: translateY(16px) scale(.96); } }
.amxc-conv, .amxc-tab, .amxc-icon-btn, .amxc-btn, .amxc-status, .amxc-theme { transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease; }

/* ---------- tabs: drag to reorder ---------- */
.amxc-tab { touch-action: pan-y; user-select: none; }
.amxc-tabs.sorting .amxc-tab:not(.dragging) { transition: transform .16s ease; }
.amxc-tab.dragging { position: relative; z-index: 3; cursor: grabbing; box-shadow: 0 14px 32px rgba(0,0,0,.45); border-color: var(--c-accent); }

/* ---------- brand, presence ---------- */
.amxc-dot.off { background: var(--c-panel) !important; box-shadow: inset 0 0 0 2px #8D8D8D; }
.amxc-dot.inline { position: relative; display: inline-block; right: auto; bottom: auto; width: 10px; height: 10px; min-width: 0; min-height: 0; margin-right: 6px; vertical-align: -1px; border: none; }
/* Photos sit on the panel colour, not the initials colour (that fringed the edges). */
.amxc-av.photo { background: var(--c-surface); }
.amxc-av.photo img { box-shadow: 0 0 0 1px rgba(0,0,0,.08); }

/* ---------- "AMxIM" always carries its chat bubble ----------
   Any <span class="amxim-name">AMxIM</span> — in AMxIM or on dashboard,
   ticket and client pages. The bubble sits snug against the "M", as tall as
   the capitals, its tail on the baseline, in the accent colour. */
.amxim-name { white-space: nowrap; }
.amxim-name::after { content: ''; display: inline-block; width: 1.04em; height: 1.04em; margin-left: -.06em; vertical-align: baseline; transform: translateY(.07em);
  background-color: var(--c-accent, var(--teal)); -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.6'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M21%2012a8%208%200%200%201-11.6%207.1L4%2020.5l1.4-4.6A8%208%200%201%201%2021%2012z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.6'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M21%2012a8%208%200%200%201-11.6%207.1L4%2020.5l1.4-4.6A8%208%200%201%201%2021%2012z'/%3E%3C/svg%3E") center / contain no-repeat; }
/* The app wordmark: engraved lettering (a drop-shadow on the whole word, bubble included). */
.amxc-brand { font-weight: 700; letter-spacing: .5px; font-size: 1.12em; color: var(--c-text); min-width: 0;
  filter: drop-shadow(0 -1px 0 rgba(0,0,0,.65)) drop-shadow(0 1px 0 rgba(255,255,255,.09)); }
#amxc-root:not(.dark) .amxc-brand { filter: drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 rgba(0,0,0,.16)); }
#amxc-root.neon .amxc-brand { filter: drop-shadow(0 0 6px var(--c-glow)) drop-shadow(0 -1px 0 rgba(0,0,0,.5)); }
#amxc-root.neon .amxc-pill { text-shadow: 0 0 10px var(--c-glow); }

/* ---------- expanded view: app header + "you" card ---------- */
.amxc-apphead { padding: 12px 10px 10px 14px; }
.amxc-mecard { display: flex; align-items: center; gap: 11px; margin: 10px 10px 2px; padding: 9px 10px; border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-bg); cursor: pointer; text-align: left; color: var(--c-text); flex-shrink: 0; }
.amxc-mecard:hover { border-color: var(--c-accent); }
.amxc-mecard .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.amxc-mecard .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-mecard .st { font-size: .8em; color: var(--c-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-mecard .st em { font-style: normal; color: var(--c-accent); }
.amxc-mecard > svg { width: 15px; height: 15px; color: var(--c-dim); flex-shrink: 0; }
.amxc-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.amxc-swatches .lbl { font-size: .8em; color: var(--c-dim); margin-right: 2px; }
.amxc-swatches .sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--c-panel); box-shadow: 0 0 0 1px var(--c-border); cursor: pointer; padding: 0; position: relative; }
.amxc-swatches .sw.on { box-shadow: 0 0 0 2px var(--c-accent); }
.amxc-swatches .sw.any { background: conic-gradient(#E5484D, #F5B400, #30A46C, #0090FF, #8E4EC6, #D6409F, #E5484D); overflow: hidden; }
.amxc-swatches .sw.any input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* ---------- AMxCRM links: TID / CID chips ---------- */
.amxc-ref { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; vertical-align: middle; margin: 1px 0; padding: 1px 8px 1px 6px; border-radius: 8px;
  border: 1px solid var(--c-border, var(--border)); background: var(--c-panel, var(--panel-bg)); color: var(--c-text, var(--text)) !important; text-decoration: none !important; font-size: .9em; line-height: 1.5; }
.amxc-ref:hover { border-color: var(--c-accent, var(--teal)); }
.amxc-ref svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--c-accent, var(--teal)); }
.amxc-ref b { font-weight: 700; white-space: nowrap; }
.amxc-ref .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; opacity: .85; }
.amxc-ref .st { font-size: .78em; font-weight: 700; padding: 0 6px; border-radius: 6px; white-space: nowrap; background: rgba(140,140,140,.18); }
.amxc-ref .st.ok { background: rgba(48,164,108,.2); color: #2E9E68; } .amxc-ref .st.go { background: rgba(0,144,255,.18); color: #1A7FD6; }
.amxc-ref .st.sig { background: rgba(142,78,198,.18); color: #8E4EC6; } .amxc-ref .st.wait { background: rgba(245,180,0,.2); color: #B07F00; }
.amxc-ref .st.hold { background: rgba(229,72,77,.16); color: #D43F44; }
.amxc-ref.gone { opacity: .6; } .amxc-ref.gone b { text-decoration: line-through; }
.amxc-msg.mine .amxc-bubble .amxc-ref { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: inherit !important; }
.amxc-msg.mine .amxc-bubble .amxc-ref svg { color: inherit; }
.amxc-msg.mine .amxc-bubble .amxc-ref .st { background: rgba(255,255,255,.22); color: inherit; }
.amxc-fileicon.ticket, .amxc-fileicon.client { background: var(--c-mention); color: var(--c-accent); }
.amxc-crmrow .amxc-icon-btn { flex-shrink: 0; }
.amxc-refpick { width: 330px; padding: 8px; }
.amxc-refpick .res { max-height: 260px; overflow-y: auto; }
.amxc-refpick .res button { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; padding: 6px 8px; border-radius: 8px; cursor: pointer; text-align: left; font-size: .9em; }
.amxc-refpick .res button.sel, .amxc-refpick .res button:hover { background: var(--c-hover); }
.amxc-refpick .meta { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amxc-refpick .sub { display: block; font-size: .8em; color: var(--c-dim); overflow: hidden; text-overflow: ellipsis; }

/* ---------- share sheet ---------- */
.amxc-share-wrap { position: fixed; inset: 0; z-index: 1090; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; animation: amxc-fade .14s ease; }
.amxc-share { width: 440px; max-width: 100%; max-height: min(640px, 90vh); }
.amxc-share .amxc-list { flex: 1; min-height: 120px; overflow-y: auto; padding: 0 8px 8px; }
.amxc-share textarea { resize: vertical; min-height: 44px; }
.amxc-share-ref { margin-bottom: 8px; }
.amxc-share .amxc-conv { cursor: default; }
.amxc-share .amxc-btn { padding: 4px 14px; flex-shrink: 0; }
.amxc-sent { display: inline-flex; align-items: center; gap: 4px; color: #30A46C; font-size: .85em; font-weight: 700; flex-shrink: 0; }
.amxc-sent svg { width: 14px; height: 14px; }

/* ---------- neon: glow everywhere the accent shows ---------- */
#amxc-root.neon .amxc-ref { border-color: var(--c-accent); box-shadow: 0 0 8px var(--c-glow); }

#amxc-root.neon .amxc-conv.active, #amxc-root.neon .amxc-tab.unread { box-shadow: inset 3px 0 0 var(--c-accent), 0 0 12px var(--c-glow); }
#amxc-root.neon .amxc-dot { box-shadow: 0 0 6px currentColor; }

/* ---------- AMxIM mentions on ticket / client pages (dashboard styles) ---------- */
.amxim-mention { cursor: pointer; border-radius: 8px; transition: background-color .12s ease; }
.amxim-mention:hover { background: var(--tint); }
.amxim-mention-body { white-space: pre-wrap; word-break: break-word; }
.amxim-mention-body .mention { color: var(--teal); font-weight: 600; }
.amxim-mention-body a { color: var(--teal); }
.amxim-mention-foot { padding: 10px 0 2px; }
.amxim-share-btn { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.amxim-share-btn:hover { border-color: var(--teal); color: var(--teal); }
