/* URX LABS — Support Chat widget (all English). Dark panel, red URX accent. */
#urx-chat-btn{position:fixed;right:18px;bottom:18px;z-index:9998;display:flex;align-items:center;justify-content:center;width:56px;height:56px;background:#6b7280;color:#fff;border:0;border-radius:50%;padding:0;font-size:0;cursor:pointer;box-shadow:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:center;background-size:26px 26px}
#urx-chat-btn:hover{background-color:#5b6470}
#urx-chat-btn .urx-dot{display:none}
#urx-chat-badge{position:absolute;top:-6px;right:-6px;min-width:20px;height:20px;border-radius:999px;background:#111;color:#fff;font:700 11px/20px -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;text-align:center;padding:0 5px;display:none}
#urx-chat-panel{position:fixed;right:18px;bottom:82px;z-index:9999;width:min(360px,calc(100vw - 24px));height:min(560px,calc(100vh - 110px));background:#14161f;color:#f2f3f7;border:1px solid #2a2e3d;border-radius:16px;box-shadow:0 18px 50px rgba(0,0,0,.5);display:none;flex-direction:column;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif}
#urx-chat-panel.open{display:flex}
.urx-ch-head{background:#e5322d;color:#fff;padding:14px 16px;display:flex;align-items:center;gap:10px}
.urx-ch-head .urx-ch-ava{width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.22);display:flex;align-items:center;justify-content:center;flex:none}
.urx-ch-head b{font-size:15px;display:block}
.urx-ch-head small{font-size:12px;opacity:.92;display:block}
.urx-ch-head .urx-ch-x{margin-left:auto;background:transparent;border:0;color:#fff;font-size:20px;cursor:pointer;line-height:1;padding:4px}
#urx-chat-msgs{flex:1;overflow-y:auto;padding:14px 12px;display:flex;flex-direction:column;gap:8px}
.urx-msg{max-width:82%;padding:9px 12px;border-radius:14px;font-size:14px;line-height:1.45;white-space:pre-wrap;word-break:break-word}
.urx-msg small{display:block;font-size:11px;opacity:.65;margin-top:4px}
.urx-msg.me{align-self:flex-end;background:#e5322d;color:#fff;border-bottom-right-radius:4px}
.urx-msg.them{align-self:flex-start;background:#232635;color:#f2f3f7;border-bottom-left-radius:4px}
.urx-msg.them .urx-who{display:block;font-size:11px;font-weight:700;color:#ff8a84;margin-bottom:3px}
.urx-ch-input{display:flex;gap:8px;padding:10px 12px;border-top:1px solid #2a2e3d;background:#171924}
.urx-ch-input input{flex:1;min-width:0;background:#232635;border:1px solid #2a2e3d;color:#f2f3f7;border-radius:999px;padding:10px 14px;font-size:14px;outline:none}
.urx-ch-input input:focus{border-color:#e5322d}
.urx-ch-input button{background:#e5322d;color:#fff;border:0;border-radius:50%;width:40px;height:40px;flex:none;cursor:pointer;display:flex;align-items:center;justify-content:center}
.urx-ch-input button:disabled{opacity:.5;cursor:default}
/* Topic quick-reply chips — shown only on a first-time / empty chat.
   They sit in the CENTRE of the messages area: the div lives inside
   #urx-chat-msgs (a flex column) and margin:auto centres it in the
   empty middle of the panel, exactly where the user drew the box. */
.urx-ch-topics{display:flex;flex-wrap:wrap;gap:8px;padding:10px 6px;justify-content:center;align-content:center;margin:auto;max-width:280px}
.urx-topic{background:transparent;border:1px solid #e5322d;color:#ff8a84;border-radius:999px;padding:7px 12px;font-size:13px;cursor:pointer;font-family:inherit}
.urx-topic:hover{background:#e5322d;color:#fff}
/* Delete-for-me: tiny Delete button, shown only after tapping your own
   message bubble (tap again to disarm). Deleting hides the message from
   YOUR side only; the admin still sees it, marked "Deleted by customer". */
.urx-del{display:block;margin:6px 0 0 auto;background:transparent;border:1px solid rgba(255,255,255,.45);color:#fff;border-radius:999px;padding:3px 10px;font-size:11px;cursor:pointer;font-family:inherit;opacity:.9}
@media (max-width:480px){#urx-chat-btn{right:12px;bottom:12px}#urx-chat-panel{right:12px;bottom:70px}}

/* ---- Admin Support Chat panel (all English) — FULL SIMPLE, WhatsApp-style ---- */
#adm-chat-pane .ahead{flex-wrap:wrap;row-gap:8px}
.chat-admin-wrap{display:grid;grid-template-columns:320px minmax(0,1fr);gap:16px;align-items:start}
.chat-admin-inbox .list>div{transition:background .15s}
/* WhatsApp-style chat list row: avatar circle, ticket + time, last message + unread badge */
.wa-row{display:flex;gap:12px;padding:12px 8px;border-bottom:1px solid var(--line,#2a2e3d);cursor:pointer;align-items:center;min-width:0}
.wa-row:hover,.wa-row.sel{background:var(--paper,#1c1f2b)}
.wa-ava{width:44px;height:44px;flex:none;border-radius:50%;background:#e5322d;color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:17px}
.wa-mid{flex:1;min-width:0}
.wa-top{display:flex;gap:6px;align-items:baseline;font-size:14px}
.wa-top b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wa-type{font-size:12px;color:var(--ink-3,#9aa0b4);flex:none}
.wa-time{margin-left:auto;font-size:12px;color:var(--ink-3,#9aa0b4);flex:none}
.wa-bot{display:flex;gap:8px;margin-top:3px;align-items:center}
.wa-last{flex:1;min-width:0;font-size:13px;color:var(--ink-2,#c9cddb);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wa-badge{flex:none;min-width:20px;height:20px;border-radius:999px;background:#e5322d;color:#fff;font-size:11px;font-weight:700;text-align:center;line-height:20px;padding:0 6px}
.chat-admin-conv-empty{color:var(--ink-2,#9aa0b4);padding:24px 8px;text-align:center;font-size:14px}
.chat-admin-back{display:none;margin-bottom:10px}
.chat-conv-head{display:flex;gap:8px;align-items:center;margin-bottom:10px}
.chat-conv-head .wa-ava{width:36px;height:36px;font-size:15px}
.chat-conv-head .wa-back-btn{background:transparent!important;border:0!important;box-shadow:none!important;font-size:22px;padding:2px 6px;line-height:1;flex:none;color:inherit}
.chat-conv-title{flex:1;min-width:0;display:flex;flex-direction:column}
.chat-conv-title b{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}
.chat-conv-title small{font-size:12px;color:var(--ink-3,#9aa0b4)}
.chat-more-btn{margin-left:auto;background:transparent;border:0;font-size:22px;cursor:pointer;color:inherit;padding:4px 10px;line-height:1;flex:none}
.chat-more{border:1px solid var(--line,#2a2e3d);border-radius:10px;padding:10px 12px;margin-bottom:10px;background:var(--paper,#1c1f2b);display:flex;flex-direction:column;gap:8px}
.chat-more select{width:100%;padding:8px 10px;border:1px solid var(--line,#2a2e3d);border-radius:8px;font-size:13px;background:var(--paper,#1c1f2b);color:inherit;box-sizing:border-box}
/* Chosen-topic chip in the admin conversation: what the customer came
   about, shown right under the slim header, above the messages. */
.chat-topic-chip{display:inline-flex;margin:10px 12px 0;padding:5px 12px;border:1px solid #e5322d;border-radius:999px;color:#ff8a84;font-size:12.5px;background:transparent;width:max-content;max-width:calc(100% - 24px)}
.chat-more-row{display:flex;gap:8px;flex-wrap:wrap}
.chat-more textarea{width:100%;min-height:48px;padding:8px 10px;border:1px solid var(--line,#2a2e3d);border-radius:8px;font-size:13px;box-sizing:border-box;background:var(--paper,#1c1f2b);color:inherit}
.chat-more small{font-size:12px;color:var(--ink-2,#9aa0b4);line-height:1.6}
.chat-msgs{border:1px solid var(--line,#2a2e3d);border-radius:12px;padding:12px;max-height:420px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;margin-bottom:10px;text-align:left}
/* WhatsApp-style bubbles: text left-aligned, time small bottom-right
   INSIDE the bubble (tucked at the end of the last line). */
.wa-bubble{max-width:80%;padding:8px 12px 7px;border-radius:12px;font-size:14px;line-height:1.45;white-space:pre-wrap;word-break:break-word;text-align:left;display:flow-root}
.wa-bubble.me{align-self:flex-end;background:#e5322d;color:#fff;border-bottom-right-radius:4px}
.wa-bubble.them{align-self:flex-start;background:var(--paper,#1c1f2b);border-bottom-left-radius:4px}
.wa-btime{float:right;font-size:11px;opacity:.75;margin:7px 0 0 10px;line-height:1}
/* "Deleted by customer" marker in admin: the customer removed this message
   from THEIR side only — the admin still sees the full text, marked. */
.wa-deleted{display:block;font-size:11px;font-style:italic;color:#ff8a84;opacity:.9;margin-top:4px}
.wa-date-chip{align-self:center;background:var(--paper,#1c1f2b);border:1px solid var(--line,#2a2e3d);border-radius:8px;padding:4px 12px;font-size:12px;color:var(--ink-2,#c9cddb);margin:2px 0}
.chat-reply-row{display:flex;gap:8px;align-items:center}
.wa-send-btn{flex:none;width:44px;height:44px;border-radius:50%;border:0;background:#e5322d;color:#fff;font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.chat-reply-row input{flex:1;min-width:0}
@media (max-width:760px){
  .chat-admin-wrap{grid-template-columns:minmax(0,1fr);gap:0}
  .chat-admin-wrap:not(.conv-open) .chat-admin-conv{display:none}
  .chat-admin-wrap.conv-open .chat-admin-inbox{display:none}
  .chat-admin-back{display:inline-block}
  .chat-msgs{max-height:52vh}
  .chat-reply-row .btn{flex:none}
  #adm-chat-pane .ahead>div:last-child{flex-wrap:wrap}
}

/* ---- Admin chat conversation as a separate full-screen page ---- */
/* List mode (no chat open): single full-width column, no conversation. */
body:not(.chat-page) .chat-admin-wrap:not(.conv-open){display:block}
body:not(.chat-page) .chat-admin-wrap:not(.conv-open) .chat-admin-conv{display:none}
body:not(.chat-page) .chat-admin-wrap:not(.conv-open) .chat-admin-inbox{max-width:720px}
/* Page mode: hide all admin chrome, the conversation fills the screen. */
body.chat-page{overflow:hidden}
body.chat-page #urx-chat-btn,body.chat-page #urx-chat-panel{display:none!important}
body.chat-page #adm-app .atop,body.chat-page #adm-app .atabs{display:none}
body.chat-page #adm-chat-pane{position:fixed;inset:0;z-index:9999;background:var(--bg);display:block!important;overflow:hidden;padding:0}
body.chat-page #chat-admin-root{height:100%}
body.chat-page .chat-admin-wrap{display:block;height:100%}
body.chat-page .chat-admin-conv{display:flex;flex-direction:column;height:100dvh}
body.chat-page .chat-conv-head{position:sticky;top:0;z-index:2;background:var(--bg);padding:8px 10px;margin-bottom:0;border-bottom:1px solid var(--line)}
body.chat-page .chat-admin-back{display:inline-block;margin-bottom:0}
body.chat-page .chat-msgs{flex:1;min-height:0;max-height:none;border:0;border-radius:0;margin-bottom:0}
body.chat-page .chat-more{margin:10px 12px 0}
body.chat-page .chat-reply-row{padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--line);background:var(--bg)}
