:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --app-height: 100dvh;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-pale: #eff6ff;
  --chat-bg: #f1f5f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior: none;
}

button,
textarea,
input {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  outline: 0;
}

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.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;
}

.app-shell {
  width: 100%;
  height: var(--app-height);
  min-height: 0;
  overflow: hidden;
}

.chat-viewport {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--chat-bg);
}

.chat-header {
  z-index: 20;
  display: flex;
  flex: 0 0 64px;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: max(0px, env(safe-area-inset-top)) 16px 0;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(12px);
}

.header-avatar-box {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.header-avatar,
.header-avatar-fallback {
  width: 44px;
  height: 44px;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.header-avatar {
  display: block;
  object-fit: cover;
  background: #dbeafe;
}

.header-avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2563eb 0%, #0f766e 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
}

.header-status-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.header-status-dot.is-offline {
  background: var(--text-muted);
  box-shadow: none;
}

.header-meta {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.header-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.header-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-status-badge {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  background: #ecfdf5;
  color: #059669;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.header-status-badge.is-offline {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #64748b;
}

.header-subtitle {
  margin: 2px 0 0;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-banner {
  z-index: 16;
  display: flex;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-bottom: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12px;
}

.connection-spinner,
.mini-spinner,
.loading-spinner {
  display: inline-block;
  border-style: solid;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.connection-spinner {
  width: 12px;
  height: 12px;
  border-width: 2px;
  border-color: rgba(194, 65, 12, 0.25);
  border-top-color: #c2410c;
}

.chat-stream-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--chat-bg);
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  -webkit-overflow-scrolling: touch;
}

.chat-stream-stage::-webkit-scrollbar {
  width: 4px;
}

.chat-stream-stage::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: #cbd5e1;
}

.history-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  color: #64748b;
  font-size: 12px;
}

.mini-spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-color: #cbd5e1;
  border-top-color: var(--brand);
}

.message-list {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: flex-start;
  padding: 8px 0 14px;
}

.time-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin: 4px 0 2px;
}

.time-tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: #64748b;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.message-row {
  display: flex;
  width: 100%;
  align-items: flex-start;
  padding: 6px 14px;
  animation: message-in 0.18s ease-out both;
}

.message-row.is-self {
  justify-content: flex-end;
}

.message-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  margin-right: 10px;
  overflow: hidden;
  border: 1px solid #ffffff;
  border-radius: 50%;
  background: #dbeafe;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  object-fit: cover;
}

.message-avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2563eb 0%, #0f766e 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
}

.bubble-container {
  display: flex;
  max-width: min(78vw, 470px);
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.is-self .bubble-container {
  align-items: flex-end;
}

.message-sender-name {
  max-width: 100%;
  margin: 0 0 4px 2px;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-bubble {
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  background: #ffffff;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.05);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.is-self .message-bubble {
  border: 0;
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.22);
  color: #ffffff;
}

.message-bubble a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.is-self .message-bubble a {
  color: #dbeafe;
}

.media-bubble {
  width: fit-content;
  max-width: min(84vw, 420px);
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  line-height: 0;
}

.image-grid {
  display: grid;
  width: min(72vw, 390px);
  max-width: 100%;
  gap: 3px;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.image-grid.count-1 {
  display: block;
  width: fit-content;
  background: transparent;
}

.image-grid.count-2,
.image-grid.count-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-grid.count-3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.media-image-button {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #e2e8f0;
  cursor: zoom-in;
}

.count-1 .media-image-button {
  width: auto;
  max-width: min(72vw, 360px);
  border-radius: 12px;
}

.image-grid:not(.count-1) .media-image-button {
  aspect-ratio: 1 / 1;
}

.media-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: cover;
  transition: transform 0.18s ease;
}

.count-1 .media-image {
  width: auto;
  max-width: min(72vw, 360px);
  max-height: min(52vh, 460px);
  object-fit: contain;
}

.media-image-button:active .media-image {
  transform: scale(0.99);
}

.video-bubble {
  width: min(76vw, 390px);
  overflow: hidden;
  border-radius: 12px;
  background: #000000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
  line-height: 0;
}

.message-video {
  display: block;
  width: 100%;
  max-height: min(52vh, 480px);
  background: #000000;
  object-fit: contain;
}

.broken-media {
  display: flex;
  width: min(66vw, 280px);
  min-height: 96px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.delivery-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 16px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
}

.delivery-line.is-sending {
  color: var(--warning);
}

.delivery-line.is-failed {
  color: var(--danger);
}

.delivery-line.is-read {
  color: var(--success);
}

.retry-button {
  padding: 2px 4px;
  border-radius: 4px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 11px;
}

.new-message-button {
  position: sticky;
  z-index: 12;
  bottom: 12px;
  left: calc(100% - 126px);
  display: inline-flex;
  width: 110px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.chat-composer-container {
  position: relative;
  z-index: 30;
  width: 100%;
  flex: 0 0 auto;
}

.composer-root {
  position: relative;
  width: 100%;
  padding: 8px 12px max(9px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.035);
}

.composer-toolbar {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.tool-button,
.panel-close-button,
.lightbox-close {
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.tool-button {
  width: 38px;
  height: 34px;
  border-radius: 8px;
  color: #64748b;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.tool-button:hover,
.tool-button.is-active {
  background: var(--brand-pale);
  color: var(--brand);
}

.tool-button:active {
  transform: scale(0.96);
}

.tool-button svg,
.send-button svg,
.panel-close-button svg,
.new-message-button svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.9;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding-right: 2px;
  color: #64748b;
  font-size: 11px;
}

.state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
}

.connection-state.is-online {
  color: #059669;
}

.connection-state.is-online .state-dot {
  background: var(--success);
}

.connection-state.is-offline {
  color: #94a3b8;
}

.connection-state.is-offline .state-dot {
  background: #94a3b8;
}

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.composer-textarea-wrapper {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.composer-textarea-wrapper:focus-within {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.composer-textarea {
  width: 100%;
  min-height: 38px;
  max-height: 100px;
  padding: 7px 0 4px;
  overflow-y: auto;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.composer-textarea::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

.send-button {
  display: inline-flex;
  width: 84px;
  height: 52px;
  flex: 0 0 84px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.send-button:active:not(:disabled) {
  transform: scale(0.98);
}

.send-button:disabled {
  background: #e2e8f0;
  box-shadow: none;
  color: #94a3b8;
  cursor: default;
}

.emoji-panel {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.06);
  animation: panel-up 0.16s ease-out both;
}

.emoji-panel-header {
  display: flex;
  height: 28px;
  align-items: center;
  justify-content: space-between;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.panel-close-button {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: #94a3b8;
}

.panel-close-button:hover {
  background: #f1f5f9;
  color: #475569;
}

.emoji-grid {
  display: grid;
  max-height: 154px;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 3px;
  overflow-y: auto;
  padding-top: 7px;
}

.emoji-item {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.emoji-item:hover {
  background: #f1f5f9;
}

.upload-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 14px;
  border-top: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
}

.upload-progress {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.loading-screen {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.loading-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  border-width: 3.5px;
  border-color: #e2e8f0;
  border-top-color: var(--brand);
}

.lightbox {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 14px 22px;
  background: rgba(2, 6, 23, 0.94);
  backdrop-filter: blur(6px);
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.toast-region {
  position: fixed;
  z-index: 400;
  top: calc(max(12px, env(safe-area-inset-top)) + 66px);
  left: 50%;
  display: flex;
  width: min(86vw, 360px);
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  max-width: 100%;
  margin-bottom: 8px;
  padding: 9px 13px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  color: #ffffff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  animation: toast-in 0.18s ease-out both;
}

.hidden-file-input {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 769px) {
  .chat-viewport {
    max-width: 600px;
    margin: 0 auto;
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.08);
  }
}

@media (max-width: 480px) {
  .chat-header {
    gap: 10px;
    padding-right: 13px;
    padding-left: 13px;
  }

  .message-row {
    padding-right: 10px;
    padding-left: 10px;
  }

  .message-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    margin-right: 8px;
  }

  .bubble-container {
    max-width: calc(100vw - 68px);
  }

  .composer-root {
    padding-right: 10px;
    padding-left: 10px;
  }

  .send-button {
    width: 52px;
    flex-basis: 52px;
  }

  .send-label {
    display: none;
  }

  .emoji-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .image-grid {
    width: min(76vw, 330px);
  }
}

@media (max-width: 340px) {
  .header-status-badge,
  .connection-state {
    display: none;
  }

  .emoji-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------- 访客定位 ---------------- */
.location-chip {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  max-width: 46vw;
  padding: 0 8px;
  border: 1px solid #e4e7ec;
  border-radius: 999px;
  background: #f7f8fa;
  color: #6b7280;
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.location-chip i,
.location-chip svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.location-chip.has-location {
  border-color: #cfe3ff;
  background: #eef5ff;
  color: #2563eb;
}

.location-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 0;
}

.location-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 0 0;
  background: #ffffff;
  box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.16);
}

.location-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.location-sheet-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #111827;
}

.location-status {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 20px;
  color: #6b7280;
}

.location-status[data-kind="pending"] {
  color: #2563eb;
}

.location-status[data-kind="ok"] {
  color: #15803d;
}

.location-status[data-kind="warn"] {
  color: #b45309;
}

.location-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.location-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
}

.location-field-full {
  margin-top: 10px;
}

.location-field select,
.location-field input {
  height: 40px;
  padding: 0 10px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  color: #111827;
  appearance: none;
}

.location-field select:focus,
.location-field input:focus {
  border-color: #93b8ff;
  outline: 2px solid #dbe8ff;
  outline-offset: 0;
}

.location-tip {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 18px;
  color: #9aa1ae;
}

.location-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.location-secondary,
.location-primary {
  flex: 1;
  height: 44px;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
}

.location-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f7f8fa;
  color: #374151;
}

.location-secondary i,
.location-secondary svg {
  width: 15px;
  height: 15px;
}

.location-primary {
  border-color: transparent;
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

.location-primary:active,
.location-secondary:active {
  transform: translateY(1px);
}

/* ---- 位置横幅（聊天头部下方，整条可点） ---- */
.location-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 8px 12px 0;
  padding: 9px 12px;
  border: 1px solid #cfe3ff;
  border-radius: 12px;
  background: linear-gradient(180deg, #f2f8ff 0%, #eaf3ff 100%);
  text-align: left;
  cursor: pointer;
}

.location-bar-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
}

.location-bar-icon i,
.location-bar-icon svg {
  width: 15px;
  height: 15px;
}

.location-bar-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.location-bar-copy strong {
  overflow: hidden;
  color: #1e40af;
  font-size: 13px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-bar-copy small {
  overflow: hidden;
  color: #5b7fa8;
  font-size: 11px;
  line-height: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-bar-action {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-size: 12px;
  line-height: 18px;
}

.location-bar.has-location {
  border-color: #c7e7d5;
  background: linear-gradient(180deg, #f4fdf8 0%, #eefaf3 100%);
}

.location-bar.has-location .location-bar-icon {
  background: #d8f3e3;
  color: #15803d;
}

.location-bar.has-location .location-bar-copy strong {
  color: #166534;
}

.location-bar.has-location .location-bar-copy small {
  color: #4b7f5f;
}

.location-bar.has-location .location-bar-action {
  background: #e8f5ee;
  color: #166534;
}

/* ---- 会话里的定位消息卡片 ---- */
.location-bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 168px;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid #dbe7f6;
  border-radius: 14px;
  background: #f6faff;
}

.location-bubble.is-clickable {
  cursor: pointer;
}

.location-bubble.is-clickable:active {
  background: #eef5ff;
}

.location-bubble-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.location-bubble-icon {
  flex: none;
  font-size: 15px;
  line-height: 18px;
}

.location-bubble-title {
  overflow: hidden;
  color: #1e40af;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-bubble-hint {
  padding-left: 21px;
  color: #7c93b3;
  font-size: 11px;
  line-height: 16px;
}

/* Address selection extends only the existing location sheet. */
.location-district-field { grid-column: 1 / -1; }
.location-field select:disabled { color: #9ca3af; background: #f7f8fa; }
.location-primary:disabled { opacity: .55; cursor: wait; }
.chat-viewport.is-blocked .chat-composer-container { pointer-events: none; opacity: .45; }
.connection-banner.is-blocked { display: flex; color: #b91c1c; background: #fef2f2; }
.connection-banner.is-blocked .connection-spinner { display: none; }
