/* Shared support conversation and floating host. */
.support-chat { position: relative; display: flex; flex-direction: column; overflow: hidden; color: var(--ink, #213957); font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.chat-heading { flex: none; display: flex; align-items: center; min-height: 62px; padding: 0 23px; border-bottom: 1px solid #e9edf4; background: linear-gradient(110deg, #f7f9ff, #fff); }
.chat-heading h2 { margin: 0; color: #213957; font-size: 14px; font-weight: 600; line-height: 1.4; letter-spacing: -.015em; }
.chat-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 27px 23px; scrollbar-gutter: stable; }
.chat-content::-webkit-scrollbar { width: 6px; }
.chat-content::-webkit-scrollbar-thumb { background: #b3bfd0; border-radius: 3px; }
.chat-content::-webkit-scrollbar-track { background: transparent; }
.chat-bubble { margin-bottom: 20px; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-line; }
.user-bubble { width: fit-content; max-width: 90%; margin-left: auto; padding: 10px 13px; border-radius: 12px 12px 3px 12px; background: #f0f1f3; color: #344357; }
.bot-bubble { padding: 4px 0; color: #455d7d; }
.bot-bubble a { display: block; width: fit-content; margin-top: 10px; color: #2c5ac0; font-size: 12px; font-weight: 600; }
.chat-input-area { background: #fff; flex: none; }
.chat-composer { padding: 19px 21px 16px; border: 0; border-top: 1px solid #e4e9f1; background: #fff; }
.chat-composer:focus-within { border-top-color: #86a9e5; box-shadow: inset 0 1px 0 #86a9e5; }
.chat-composer textarea { display: block; width: 100%; min-height: 54px; resize: none; border: 0; outline: none; padding: 0; background: transparent; color: #213957; font-size: 13px; line-height: 1.6; }
.chat-composer textarea::placeholder { color: #6c7686; opacity: 1; font-weight: 400; }
.chat-composer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-send { margin-left: auto; flex: none; }
.chat-composer .chat-send { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--blue); color: #fff; }
.chat-composer .chat-send svg { width: 20px; height: 20px; }
.chat-composer .chat-send:disabled { cursor: default; color: #879abd; background: #eaf0fa; }
.chat-composer .chat-send:not(:disabled):hover { background: #034ed4; }
.chat-scrim { position: fixed; inset: 0; z-index: 19; background: #08182c52; }
.chat-panel { position: fixed; z-index: 20; right: 20px; bottom: 20px; width: min(400px, calc(100vw - 40px)); height: min(670px, calc(100dvh - 40px)); border: 1px solid #d6e0ef; border-radius: 20px; background: #fff; box-shadow: 0 22px 70px #061e4038; }
.chat-panel .chat-heading { padding-right: 60px; }
.icon-button { display: grid; place-items: center; border: 0; border-radius: 9px; background: #f0f3f9; width: 40px; height: 40px; color: #526480; font-size: 23px; }
.chat-close { background: transparent; position: absolute; top: 11px; right: 11px; }
.chat-close svg { width: 19px; height: 19px; }
body.chat-open { overflow: hidden; }
@media(max-width:500px) {
  .chat-heading { padding-left: 20px; }
  .chat-content { padding: 23px 20px; }
  .chat-composer { padding: 17px 19px 14px; }
  .chat-composer textarea { font-size: 16px; }
  .chat-composer .chat-send { width: 44px; height: 44px; }
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
}

.case-attachment { position: relative; min-width: 0; }
.case-picker summary { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 7px; margin-left: -7px; border-radius: 7px; color: #607694; font-size: 12px; cursor: pointer; list-style: none; }
.case-picker summary::-webkit-details-marker { display: none; }
.case-picker summary:hover { background: #f1f5fb; color: #245fbd; }
.case-attachment svg { width: 17px; height: 17px; flex: none; }
.case-picker-menu { position: absolute; z-index: 5; left: 0; bottom: calc(100% + 12px); width: min(320px,calc(100vw - 100px)); padding: 19px; border: 1px solid #dce4f0; border-radius: 13px; background: #fff; box-shadow: 0 14px 40px #0a254026; }
.case-picker-menu h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.case-picker-menu p { margin: 0 0 15px; color: #657a96; font-size: 12px; line-height: 1.6; }
.case-options button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px; text-align: left; border: 1px solid #e0e8f3; border-radius: 8px; background: #f7f9fd; color: #2d476b; }
.case-options button:hover { border-color: #91b1e1; background: #eff4fe; }
.case-options button > span:first-child { display: grid; gap: 5px; }
.case-options strong { font-size: 12px; font-weight: 600; }
.case-options small { color: #6a7e9b; font-size: 11px; }
.case-chip { display: flex; align-items: center; gap: 7px; max-width: 100%; padding-left: 10px; border: 1px solid #dce7f7; border-radius: 8px; background: #f3f7fe; color: #486995; font-size: 11px; }
.case-chip > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.case-remove { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #667f9f; font-size: 19px; }
.case-remove:hover { background: #e6edf9; }
.message-case { display: block; margin-bottom: 5px; color: #607c9f; font-size: 10px; }
@media(max-width:500px) { .case-picker summary { min-height: 44px; } .case-remove { width: 44px; height: 44px; } }

.chat-attach { display: grid; place-items: center; flex: none; width: 36px; height: 40px; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: #607694; }
.chat-attach:hover { background: #f1f5fb; color: #245fbd; }
.chat-attach svg { width: 20px; height: 20px; }
.chat-file-list { display: grid; gap: 7px; max-height: 142px; overflow-y: auto; margin-bottom: 13px; }
.chat-file-list[hidden], .chat-file-error[hidden], .chat-file-input[hidden] { display: none; }
.chat-file { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px; border: 1px solid #dfe7f3; border-radius: 9px; background: #f7f9fd; white-space: normal; }
.chat-file img, .file-document { width: 42px; height: 42px; flex: none; border-radius: 5px; object-fit: cover; background: #eaf0fb; }
.file-document { display: grid; place-items: center; color: #5879b2; }
.file-document svg { width: 23px; height: 23px; }
.file-info { min-width: 0; display: grid; gap: 4px; flex: 1; }
.file-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 550; color: #344e72; }
.file-info small { font-size: 10px; color: #71849e; }
.chat-file button { display: grid; place-items: center; width: 32px; height: 36px; flex: none; border: 0; border-radius: 6px; background: transparent; color: #6d819e; font-size: 19px; }
.chat-file button:hover { background: #e8eef9; }
.chat-file-error { margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: #a33741; }
.message-files { display: grid; gap: 7px; min-width: 180px; margin-top: 8px; }
.message-files .chat-file img { width: 64px; height: 64px; }
.chat-drop-target { display: none; position: absolute; inset: 8px; z-index: 10; align-items: center; justify-content: center; border: 2px dashed #6693de; border-radius: 12px; background: #eff5ffed; color: #315d9d; font-size: 15px; pointer-events: none; }
.is-dragging .chat-drop-target { display: flex; }
.case-picker-menu { left: -42px; }
@media(max-width:500px) { .chat-composer-bottom { gap: 7px; } .chat-attach { width: 36px; height: 44px; } .chat-file button { width: 44px; height: 44px; } }

.message-text { white-space: pre-wrap; }
.chat-status { font-size: 13px; color: var(--muted, #536985); margin: 20px 0; }
.chat-status:empty { display: none; }
.case-unavailable { display: flex; align-items: center; gap: 7px; color: #75849c; font-size: 11px; }
.case-unavailable svg { width: 16px; height: 16px; }
.chat-ticket { display: block; margin-top: 12px; padding: 0; border: 0; background: none; color: #005bea; font: inherit; font-weight: 600; cursor: pointer; }
.chat-composer textarea:disabled { opacity: .65; }

.chat-ticket-proposal { margin-top: 16px; padding: 14px; border: 1px solid #dce5f3; border-radius: 12px; background: white; }
.chat-ticket-proposal strong, .chat-ticket-proposal small { display: block; }
.chat-ticket-proposal small { color: #64748b; line-height: 1.5; margin-top: 10px; }
.chat-ticket-proposal p, .ticket-thread-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-identity { font-size: 13px; color: #526985; overflow-wrap: anywhere; }
.ticket-login{font-size:13px;color:var(--muted);margin:0 0 24px}.ticket-login a{color:var(--blue);font-weight:600}
.support-chat-notice{font-size:11px;line-height:1.5;color:var(--muted);margin:8px 22px 14px}

.chat-bubble{white-space:normal}.user-bubble .message-text{white-space:pre-wrap}.bot-bubble{background:none;border:0;border-radius:0}.bot-bubble .message-text{white-space:normal}
.message-text p{margin:0 0 12px}.message-text p:last-child{margin-bottom:0}.message-text ul,.message-text ol{margin:12px 0;padding-left:21px}.message-text li+li{margin-top:7px}.message-text h3{font-size:14px;line-height:1.5;margin:18px 0 10px;font-weight:650;color:#203d60}.message-text code{font-size:12px;background:#eff3f8;border-radius:4px;padding:2px 4px}.message-text strong{font-weight:650;color:#263d59}
.case-unavailable{color:#929dad;opacity:.65;cursor:default}.case-unavailable svg{width:17px;height:17px}
.chat-status.is-thinking{color:#586d8c}
.chat-typing-dots{display:inline-flex;align-items:center;gap:4px;height:18px}
.chat-typing-dots span{width:4px;height:4px;border-radius:50%;background:currentColor;animation:chat-dot-bounce 1.2s ease-in-out infinite}
.chat-typing-dots span:nth-child(2){animation-delay:.15s}
.chat-typing-dots span:nth-child(3){animation-delay:.3s}
.message-failed{display:block;margin-top:9px;color:#924444;font-size:11px}.message-enter{animation:message-arrive .24s ease-out both}
@keyframes message-arrive{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:translateY(0)}}
@keyframes chat-dot-bounce{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-4px);opacity:1}}
@media(prefers-reduced-motion:reduce){.message-enter,.chat-typing-dots span{animation:none}}

.chat-contact-field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 13px; font-weight: 600; }
.chat-contact-field input { width: 100%; min-width: 0; border: 1px solid #cbd7e7; border-radius: 8px; background: #fff; color: #102648; padding: 10px 12px; font: inherit; font-size: 16px; }
.chat-contact-field input:focus-visible { outline: 2px solid #005bea; outline-offset: 2px; }
.chat-contact-field input[readonly] { background: #f5f7fb; }
.chat-ticket:disabled { opacity: .6; cursor: wait; }

.chat-fallback { margin: 8px 0; font-size: 13px; }
.chat-fallback a { color: #005bea; text-decoration: underline; }

/* Ticket waits reuse the app's approved CA outline and animation. */
.ticket-loading { --theme-accent: var(--blue); align-items: center; min-height: 320px; gap: 8px; color: var(--muted); font-size: 14px; }
.ticket-reply { display: grid; gap: 12px; margin: 32px 0 24px; padding-top: 28px; border-top: 1px solid var(--line); }
.ticket-reply label { font-size: 18px; font-weight: 650; }
.ticket-reply textarea { width: 100%; min-height: 140px; resize: vertical; padding: 14px 16px; border: 1px solid #bdcce0; border-radius: 12px; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.6; }
.ticket-reply textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ticket-reply textarea[readonly] { background: #f5f7fb; }
.ticket-reply .button { justify-self: start; }
.ticket-reply .button:disabled { opacity: .65; cursor: wait; }
.ticket-reply-status { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
@media(max-width:500px) { .ticket-reply .button { width: 100%; justify-content: center; } }

.tickets-home[hidden] { display: none; }
.chat-composer { cursor: text; }
.chat-tool { position: relative; display: inline-flex; flex: none; }
.chat-tooltip { position: absolute; z-index: 12; left: 0; bottom: calc(100% + 8px); width: max-content; max-width: 180px; padding: 7px 10px; border-radius: 7px; background: #172f4d; color: #fff; font-size: 12px; line-height: 1.4; white-space: nowrap; pointer-events: none; visibility: hidden; opacity: 0; }
.chat-tool:hover .chat-tooltip, .chat-tool:focus-within .chat-tooltip { visibility: visible; opacity: 1; }
.chat-tool .case-unavailable { display: grid; place-items: center; width: 36px; height: 40px; padding: 8px; border: 0; border-radius: 8px; background: transparent; cursor: not-allowed; }
.chat-tool button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media(max-width:500px) { .chat-tool .case-unavailable { height: 44px; } }

/* Standalone component essentials; host styles and CSS variables are optional. */
.support-chat, .support-chat *, .support-chat *::before, .support-chat *::after { box-sizing: border-box; }
.support-chat input, .support-chat textarea, .support-chat button { font-family: inherit; }
.support-chat .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.support-chat .chat-send { background: var(--blue, #1463e5); }
.support-chat .chat-tool button:focus-visible { outline-color: var(--blue, #1463e5); }
.support-chat .chat-tool.tooltip-dismissed .chat-tooltip { visibility: hidden; opacity: 0; }
.support-widget { position: fixed; z-index: 100; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.support-widget-trigger { position: relative; display: grid; place-items: center; width: 56px; height: 56px; margin-left: auto; border: 0; border-radius: 50%; background: var(--blue, #1463e5); color: #fff; box-shadow: 0 8px 28px #0c39725c; cursor: pointer; }
.support-widget-trigger:hover { background: #034ed4; }
.support-widget-trigger:focus-visible { outline: 3px solid #ffcc42; outline-offset: 3px; }
.support-widget-trigger svg { width: 27px; height: 27px; }
.support-widget-count { position: absolute; top: -5px; right: -5px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border: 2px solid #fff; border-radius: 12px; background: #c52542; color: #fff; font-size: 11px; font-weight: 700; }
.support-widget-panel { position: absolute; right: 0; bottom: 70px; width: min(400px, calc(100vw - 40px)); height: min(670px, calc(100dvh - 112px)); border: 1px solid #d6e0ef; border-radius: 20px; overflow: hidden; background: #fff; box-shadow: 0 22px 70px #061e4038; }
.support-widget-panel[hidden] { display: none; }
.support-widget-panel .chat-heading { padding-right: 60px; }
.support-widget-session-error { flex: none; margin: 12px 12px 0; padding: 12px 14px; border: 1px solid #cbd7e7; border-radius: 11px; background: #fff; color: #304b6c; font-size: 13px; line-height: 1.45; }
.support-widget-session-error button { display: inline; padding: 0; border: 0; background: transparent; color: var(--blue, #1463e5); font: inherit; font-weight: 650; text-decoration: underline; cursor: pointer; }
.support-widget-session-error button:focus-visible { outline: 2px solid var(--blue, #1463e5); outline-offset: 2px; }
@media (max-width: 500px) { .support-widget { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); } .support-widget-panel { right: -12px; bottom: 68px; width: 100vw; height: min(620px, calc(100dvh - 88px)); border-radius: 16px 16px 0 0; } }

.support-widget-labelled .support-widget-trigger { display: flex; gap: 9px; width: auto; padding: 0 17px; border-radius: 28px; }
.support-widget-label { font-size: 12px; font-weight: 600; }
@media (max-width: 600px) { .support-widget-labelled .support-widget-trigger { width: 56px; padding: 0; justify-content: center; } .support-widget-label { display: none; } }

.support-widget.support-widget-embedded { position: relative; inset: auto; z-index: auto; height: 100%; }
.support-widget-embedded .support-widget-panel { position: relative; inset: auto; width: 100%; height: 100%; box-shadow: none; }
.support-widget-embedded .chat-heading { padding-right: 23px; }
