:root { color-scheme: light; font: 14px/1.5 Arial, "Microsoft YaHei", "PingFang SC", sans-serif; color: #333; background: #fcfcfc; --blue: #218ac6; --text-blue: #096a9f; --line: #ececec; }
* { box-sizing: border-box; }
body, p, h1 { margin: 0; }
html, body { height: 100%; overflow: hidden; }
button, input, textarea { font: inherit; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid #123c55; outline-offset: 2px; }
input:focus-visible, textarea:focus-visible { outline-offset: -2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.chat-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { background: var(--blue); color: #fff; position: relative; flex-shrink: 0; min-height: 93px; padding: 9px 12px 0; }
.header-copy { padding-right: 86px; }
.chat-header h1 { font-size: 14px; line-height: 20px; font-weight: 400; }
.header-copy p { font-size: 13px; line-height: 20px; }
.header-copy { text-shadow: 0 0 1px #08466a; }
.header-hours { white-space: nowrap; }
.window-actions { position: absolute; right: 2px; top: 0; display: flex; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; background: transparent; color: inherit; border: 0; width: 44px; height: 44px; padding: 12px; }
.window-actions .icon-button { padding: 15px; }
.icon-button:hover { background: #1175af; }
.chat-header button:focus-visible { outline-color: #fff; outline-offset: -4px; }
.header-tools { display: flex; margin-left: -9px; margin-top: 0; }
.header-tools .icon-button { width: 40px; min-width: 44px; }
.header-tools svg { color: var(--text-blue); background: white; border-radius: 50%; padding: 4px; width: 25px; height: 25px; }
.chat-body { display: grid; grid-template-columns: minmax(0, 1fr) 206px; flex: 1 1 auto; min-height: 0; }
.chat-main { min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.conversation { flex: 1 1 auto; min-height: 0; padding: 24px 18px 16px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.messages { margin: 0; padding: 0; list-style: none; }
.welcome, .bubble { max-width: 94%; margin-bottom: 18px; overflow-wrap: anywhere; }
.welcome > p, .bubble > p { background: #fff; border: 1px solid #ededed; border-radius: 2px; padding: 10px 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.bubble-label { display: block; font-size: 12px; line-height: 20px; color: #737373; padding-bottom: 3px; }
.bubble.visitor { margin-left: auto; }
.bubble.visitor .bubble-label { text-align: right; }
.bubble.visitor > p { background: #eaf6fd; border-color: #d3e9f6; }
.compose-area { flex-shrink: 0; max-height: 80%; overflow-y: auto; background: #fff; border-top: 1px solid var(--line); padding: 0 10px 6px; }
textarea { display: block; width: 100%; margin: 8px 0 4px; border: 1px solid #d8e5ed; border-radius: 4px; padding: 10px 12px; min-height: 52px; height: 64px; max-height: 120px; resize: vertical; background: white; color: #333; font-size: 14px; line-height: 1.5; }
textarea:focus, textarea:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgb(33 138 198 / 12%); }
@media (forced-colors: active) {
  textarea:focus, textarea:focus-visible { outline: 2px solid Highlight; outline-offset: -2px; box-shadow: none; }
}
textarea::placeholder, input::placeholder { color: #767676; }
textarea:read-only, input:read-only { background: #f5f7f8; }
.compose-tools { display: flex; align-items: center; gap: 12px; min-height: 44px; flex-shrink: 0; }
#phone-send { margin-left: auto; }
.text-button { display: inline-flex; justify-content: center; align-items: center; color: var(--text-blue); font-size: 12px; min-width: 44px; min-height: 44px; padding: 0 6px; border: 0; background: transparent; white-space: nowrap; }
.text-button:hover { background: #f0f7fa; }
.counter { color: #757575; font-size: 11px; margin-left: auto; }
.primary-button { min-height: 44px; min-width: 70px; padding: 8px 16px; background: #137aae; border: 1px solid #137aae; border-radius: 2px; color: #fff; font-size: 13px; }
.primary-button:hover { background: #096a9f; }
.status { font-size: 12px; line-height: 1.6; margin: 4px 0; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status.error { color: #a22c22; }
.phone-form { display: grid; align-content: start; gap: 14px; padding: 18px 2px 12px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 8px; }
.phone-mode .compose-area { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: none; overflow: hidden; border-top: 0; }
.phone-mode .status { max-height: 48px; overflow-y: auto; flex-shrink: 0; }
.phone-form label { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12px; }
.phone-form input:not([type="checkbox"]), .copy-fallback input { width: 100%; min-height: 44px; padding: 8px; border: 1px solid #aaa; border-radius: 2px; color: #333; background: #fff; font-size: 16px; }
.phone-form .consent { flex-wrap: nowrap; min-height: 44px; gap: 8px; }
.consent input { width: 18px; height: 18px; margin: 0; flex-shrink: 0; accent-color: var(--text-blue); }
.optional { color: #737373; }
.contact-sidebar { border-left: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; overflow: auto; background: #fcfcfc; }
.contact-card { padding: 10px 9px 0; flex-shrink: 0; }
.qr-slot { width: 186px; height: 186px; max-width: 100%; margin: 0 auto; background: #fff; box-shadow: inset 0 0 0 1px #ededed; display: grid; place-items: center; }
.qr-slot img { width: 100%; height: 100%; object-fit: contain; }
.qr-caption { font-size: 11px; line-height: 20px; color: #737373; text-align: center; }
.wechat-text { text-align: center; display: grid; gap: 12px; color: #737373; font-size: 12px; }
.wechat-text strong { font-size: 28px; font-weight: 400; color: #333; letter-spacing: 1px; }
.contact-id { display: flex; align-items: center; gap: 8px; color: #737373; font-size: 12px; padding: 6px 2px 0; min-height: 28px; }
.contact-id strong { font-weight: 400; color: #555; }
.contact-id svg { width: 16px; height: 16px; }
.contact-channels { padding-top: 6px; }
.contact-channels:empty { display: none; }
.contact-channel { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #737373; min-height: 26px; overflow-wrap: anywhere; }
.contact-channel svg { width: 16px; height: 16px; }
.contact-details { display: flex; align-items: center; gap: 4px; margin: 0 9px; flex-shrink: 0; }
.contact-id { white-space: nowrap; }
.contact-details .text-button { justify-content: flex-start; padding: 0 4px; margin-left: auto; }
.copy-fallback { padding: 6px 10px 10px; font-size: 12px; color: #555; flex-shrink: 0; }
.copy-fallback input { margin-top: 6px; user-select: text; -webkit-user-select: text; }
.ad-slot { width: 100%; height: 150px; flex-shrink: 0; margin-top: auto; overflow: hidden; background: #fff; }
.ad-slot img, .ad-slot a { display: block; width: 100%; height: 100%; object-fit: contain; }
.ad-slot a:focus-visible { outline-offset: -3px; }
.ad-fallback { height: 100%; background: #c80b45; color: #fff; text-align: center; }
.ad-fallback > p { background: #244b88; padding: 3px; font-size: 12px; height: 25px; }
.ad-fallback > div { height: 125px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; }
.ad-fallback strong { font-size: 26px; line-height: 1.5; }
.ad-fallback span { font-size: 15px; }
.ad-fallback b { background: #244b88; min-width: 138px; border-radius: 20px; padding: 2px 12px; font-weight: 400; font-size: 16px; }
#sidebar-toggle { display: none; }
@media (max-width: 600px) {
  .chat-header { min-height: 88px; padding: 9px 10px 0; }
  .header-copy { padding-right: 0; }
  .chat-header h1 { padding-right: 88px; }
  .header-copy p { font-size: 12px; padding-top: 3px; padding-right: 0; }
  .header-hours { display: block; white-space: normal; }
  .header-tools { display: none; }
  .chat-body { display: flex; flex-direction: column; min-height: 0; }
  .chat-main { order: 2; flex: 1 1 auto; }
  .contact-sidebar { order: 1; flex-shrink: 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .contact-card { display: none; padding: 0 10px; }
  .contact-details { order: -1; position: sticky; top: 0; z-index: 1; background: #fcfcfc; display: flex; align-items: center; justify-content: space-between; gap: 4px; margin: 0; padding: 0 10px; }
  .contact-id { padding: 0; gap: 5px; }
  .contact-details .text-button { padding: 0 6px; }
  .qr-slot, .ad-slot, .contact-channels, .qr-caption { display: none; }
  #sidebar-toggle { display: inline-flex; }
  .show-materials .contact-sidebar { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
  .show-materials .chat-main { display: none; }
  .contact-sidebar.show-details .contact-card { display: block; }
  .contact-sidebar.show-details .qr-slot { display: grid; margin: 10px auto; }
  .contact-sidebar.show-details .qr-caption { display: block; }
  .contact-sidebar.show-details .contact-channels { display: block; max-width: 206px; margin: 0 auto; }
  .contact-sidebar.show-details .ad-slot { display: block; width: 206px; height: 150px; margin: 8px auto; }
  .conversation { padding: 16px 12px 8px; }
  .welcome, .bubble { max-width: 100%; }
  .welcome > p, .bubble > p { padding: 10px; }
  textarea { font-size: 16px; }
  .compose-area { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
}
@media (max-height: 420px) {
  .chat-header { min-height: 44px; padding: 12px 10px; }
  .header-copy p, .header-tools { display: none; }
  .conversation { padding: 8px 10px; }
  .phone-form { padding-top: 10px; }
}
@media (max-width: 600px) and (max-height: 420px) {
  .phone-mode:not(.show-materials) .contact-sidebar { display: none; }
}
