.contact-rail-v2 {
  --contact-surface: #fff;
  --contact-ink: #22252a;
  --contact-muted: #5d626b;
  --contact-border: #dfe2e7;
  --contact-accent: #1659d5;
  --contact-hover: #f0f4fa;
  z-index: 60;
  color: var(--contact-ink);
}
:root[data-theme="dark"] .contact-rail-v2 {
  --contact-surface: #22252a;
  --contact-ink: #f4f5f7;
  --contact-muted: #c5cad3;
  --contact-border: #454b54;
  --contact-accent: #9fc1ff;
  --contact-hover: #303944;
}
.contact-rail-v2 .contact-channel { margin: 0; padding: 0; border: 0; }
.footer .contact-rail-v2 .contact-trigger {
  display: grid;
  place-items: center;
  position: relative;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px 0 0 6px;
  color: #fff;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 4px 14px #0002;
}
.contact-trigger::-webkit-details-marker { display: none; }
.contact-trigger::marker { content: ''; }
.contact-trigger > img { width: 23px; height: 23px; object-fit: contain; }
.social-wechat { background: #218c36; }
.social-wechat > img { filter: invert(1); }
.contact-rail-v2 .contact-trigger:hover,
.contact-rail-v2 details[open] > .contact-trigger { filter: brightness(1.12); }
.contact-rail-v2 :is(a, button, summary):focus-visible { outline: 3px solid #71a7ff; outline-offset: 2px; }
.contact-direct-label {
  display: none;
  position: absolute;
  right: 100%;
  padding: 13px 16px;
  background: inherit;
  color: #fff;
  border-radius: 6px 0 0 6px;
  font-size: 14px;
  white-space: nowrap;
}
.contact-trigger:is(:hover, :focus-visible) .contact-direct-label { display: block; }
.contact-panel {
  position: fixed;
  right: 56px;
  top: 0;
  width: 304px;
  max-width: calc(100vw - 72px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  box-sizing: border-box;
  border: 1px solid var(--contact-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--contact-surface);
  color: var(--contact-ink);
  box-shadow: 0 10px 34px #0003;
  text-align: start;
  line-height: 1.5;
}
.contact-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.contact-panel-heading strong { font-size: 15px; font-weight: 650; color: var(--contact-ink); }
.contact-rail-v2 .contact-close {
  display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px;
  margin: -6px -6px -6px 0; padding: 7px; border: 0; border-radius: 4px;
  background: transparent; color: var(--contact-muted); cursor: pointer; box-shadow: none;
}
.contact-rail-v2 .contact-close:hover { background: var(--contact-hover); }
.contact-rail-v2 .contact-close img { width: 18px; height: 18px; }
.footer .contact-rail-v2 .contact-account {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; margin: 0; padding: 8px 0; border: 0; border-radius: 0;
  background: transparent; color: var(--contact-accent); font-family: inherit;
  font-size: 16px; font-weight: 550; text-align: left; line-height: 1.5;
  cursor: pointer; box-shadow: none; text-decoration: none; overflow-wrap: anywhere;
}
.contact-account span { min-width: 0; }
.contact-account img { width: 18px; height: 18px; flex: 0 0 18px; }
.footer .contact-rail-v2 .contact-account:hover { color: var(--contact-accent); text-decoration: underline; }
.footer .contact-rail-v2 .contact-action {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; margin: 10px 0 0; padding: 9px 12px; border-radius: 4px;
  background: var(--contact-hover); color: var(--contact-accent); font-size: 14px;
  font-weight: 600; text-decoration: none;
}
.footer .contact-rail-v2 .contact-action:hover { color: var(--contact-accent); text-decoration: underline; }
.contact-action img { width: 18px; height: 18px; flex: 0 0 18px; }
:root[data-theme="dark"] .contact-panel :is(.contact-close, .contact-account, .contact-action) img { filter: invert(1); }
.contact-copy-status { color: var(--contact-muted); font-size: 12px; margin-top: 8px; }
.contact-copy-status:empty { display: none; }
.contact-qr-image { display: block; width: 100%; height: auto; max-height: calc(100dvh - 140px); object-fit: contain; background: #fff; }
.footer .contact-qr-caption { margin: 10px 0 0; color: var(--contact-muted); font-size: 13px; text-align: center; }
.contact-settings-qr { display: grid; gap: 12px; min-width: 0; }
.contact-settings-qr img { display: block; width: 160px; height: 238px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.contact-settings-qr img[hidden] { display: none; }
.contact-settings-qr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) {
  .contact-rail-v2 { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); right: 12px; display: flex; gap: 6px; transform: none; }
  .footer .contact-rail-v2 .contact-trigger { width: 44px; height: 44px; border-radius: 6px; }
  .contact-panel { right: 12px; width: 304px; max-width: calc(100vw - 24px); }
  .contact-direct-label { right: 0; bottom: calc(100% + 6px); border-radius: 4px; }
}
@media (prefers-reduced-motion: reduce) { .contact-rail-v2 * { transition: none; } }
