:root {
  color-scheme: light;
  --app-height: 100vh;
  --bg: #f4f8fd;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --surface-blue: #eaf4ff;
  --primary: #1769e0;
  --primary-strong: #0d55bf;
  --primary-soft: #dcecff;
  --accent: #0f9f95;
  --text: #0e243f;
  --muted: #65748a;
  --border: #dde9f6;
  --border-strong: #b8d2ec;
  --danger: #c2410c;
  --shadow: 0 18px 46px rgba(22, 87, 154, 0.1);
  --shadow-soft: 0 10px 28px rgba(22, 87, 154, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: var(--app-height);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  color: var(--text);
  background: linear-gradient(180deg, #fbfdff 0%, var(--bg) 48%, #eef6ff 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.chat-locked {
  position: fixed;
  inset: 0;
  width: 100%;
}

button,
input,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(18, 101, 216, 0.24);
  outline-offset: 2px;
}

.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 {
  position: relative;
  height: 100dvh;
  height: 100svh;
  height: var(--app-height);
  min-height: 0;
  overflow: hidden;
}

.chat-view {
  height: 100dvh;
  height: 100svh;
  height: var(--app-height);
  min-height: 0;
}

.app-shell[data-view="chat"] {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  height: 100svh;
  height: var(--app-height);
  overflow: hidden;
}

.app-shell:not(.is-authenticated) .account-panel {
  display: none;
}

.login-dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 35, 63, 0.42);
}

.login-dialog[hidden] {
  display: none;
}

.login-panel {
  width: min(100%, 420px);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-dialog-panel {
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
}

.login-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #2994ff);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(18, 101, 216, 0.22);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.login-panel h1,
.login-panel h2,
.chat-header h1,
.sidebar h2 {
  margin: 0;
}

.login-panel h1,
.login-panel h2 {
  font-size: 30px;
  line-height: 1.2;
}

.login-dialog-close {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  color: var(--muted);
  background: #fff;
  border-color: var(--border);
}

.login-dialog-close:hover {
  color: var(--primary);
  border-color: var(--border-strong);
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.home-filing {
  position: fixed;
  right: 16px;
  bottom: 6px;
  z-index: 10;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  max-width: calc(100vw - 32px);
  color: #7a8798;
  font-size: 13px;
  line-height: 1.3;
  opacity: 0.72;
  text-align: right;
  white-space: nowrap;
}

.footer-divider {
  color: #b7c3d1;
}

.icp-link {
  display: inline-block;
  color: var(--primary-strong);
  font-weight: 700;
  text-decoration: none;
}

.icp-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
}

input {
  min-height: 46px;
  padding: 10px 12px;
}

textarea {
  min-height: 52px;
  max-height: 160px;
  padding: 12px;
  line-height: 1.55;
  resize: none;
}

input::placeholder,
textarea::placeholder {
  color: #8a98ab;
}

.field-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button-primary {
  color: #fff;
  background: linear-gradient(180deg, #2579f0 0%, var(--primary) 100%);
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(18, 101, 216, 0.2);
}

.button-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.button-secondary {
  color: var(--primary);
  background: linear-gradient(180deg, #f7fbff 0%, var(--surface-blue) 100%);
  border-color: #c5dff8;
}

.button-secondary:hover {
  background: #ddebff;
  border-color: #a9cff4;
}

.button-ghost {
  color: var(--muted);
  background: #fff;
  border-color: var(--border);
}

.button-ghost:hover {
  color: var(--primary);
  border-color: var(--border-strong);
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.chat-view {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  height: 100dvh;
  height: 100svh;
  height: var(--app-height);
  max-height: 100dvh;
  max-height: 100svh;
  max-height: var(--app-height);
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100svh;
  height: var(--app-height);
  max-height: 100dvh;
  max-height: 100svh;
  max-height: var(--app-height);
  min-height: 0;
  padding: 20px;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 251, 255, 0.96) 100%);
  box-shadow: 8px 0 30px rgba(22, 87, 154, 0.04);
}

.sidebar-head,
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sidebar h2 {
  font-size: 20px;
  line-height: 1.25;
}

.sidebar-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.new-chat-button {
  width: 100%;
  min-height: 44px;
  gap: 6px;
  margin-top: 18px;
  padding: 2px 18px;
  border-color: #e7ebf0;
  border-radius: 999px;
  color: #111827;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(16, 35, 63, 0.06), 0 10px 24px rgba(16, 35, 63, 0.06);
}

.new-chat-button:hover {
  border-color: #d8dee8;
  background: #fff;
  box-shadow: 0 3px 8px rgba(16, 35, 63, 0.08), 0 12px 28px rgba(16, 35, 63, 0.08);
}

.svg-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.new-chat-button .svg-icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.history-block {
  flex: 1;
  min-width: 0;
  min-height: 0;
  margin-top: 22px;
  overflow: hidden;
}

.history-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-width: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
}

.history-group {
  margin: 18px 6px 6px;
  color: #8b95a7;
  font-size: 13px;
  font-weight: 600;
}

.history-group:first-child {
  margin-top: 0;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 40px;
  overflow: hidden;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  color: #111827;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  text-align: left;
}

.history-item:hover,
.history-item.active {
  background: #eaf2ff;
  box-shadow: none;
}

.history-item-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 400;
  line-height: 40px;
}

.history-item.active .history-item-title {
  color: var(--primary);
}


.account-panel {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.account-panel span {
  color: var(--muted);
  font-size: 13px;
}

.account-panel strong {
  font-size: 15px;
}

.chat-main {
  display: grid;
  grid-template-rows: 70px minmax(0, 1fr) auto auto;
  height: 100dvh;
  height: 100svh;
  height: var(--app-height);
  max-height: 100dvh;
  max-height: 100svh;
  max-height: var(--app-height);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.app-shell.welcome-mode .chat-main {
  grid-template-rows: minmax(72px, 1fr) auto auto minmax(72px, 1fr);
}

.chat-header {
  align-items: flex-start;
  min-height: 0;
  height: 70px;
  padding: 14px 34px 0;
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
}

.chat-header h1 {
  max-width: 100%;
  padding: 0;
  border: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
}

.chat-title-block {
  display: grid;
  gap: 6px;
  width: min(100%, 780px);
  min-width: 0;
  margin: 0;
}

.header-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.header-summary span {
  padding: 4px 9px;
  border: 1px solid #d6e7f8;
  border-radius: 999px;
  color: #315a88;
  background: #f6fbff;
  font-size: 12px;
  font-weight: 600;
}

.welcome-panel {
  display: none;
}

.app-shell.welcome-mode .chat-header,
.app-shell.welcome-mode .messages-wrap,
.app-shell.welcome-mode .ai-note {
  display: none;
}

.app-shell.welcome-mode .welcome-panel {
  display: grid;
  align-self: end;
  justify-items: center;
  min-width: 0;
  padding: 0 30px 28px;
}

.welcome-greeting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(100%, 780px);
  min-width: 0;
}

.welcome-avatar {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.welcome-greeting h2 {
  min-width: 0;
  margin: 0;
  color: #111827;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

.messages-wrap {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 34px 30px 28px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.messages {
  display: grid;
  gap: 18px;
  max-width: 940px;
  margin: 0 auto;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.message-row.user-row {
  justify-content: flex-end;
}

.avatar {
  display: none;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
}

.message-row.ai-row .avatar {
  display: block;
  margin-top: 5px;
  transform-origin: 50% 70%;
}

.message-row.ai-row.is-thinking .avatar {
  animation: robot-waiting 1.15s ease-in-out infinite;
}

.message-row.ai-row .message {
  min-width: 0;
}

@keyframes robot-waiting {
  0%, 100% {
    transform: rotate(0deg) translateY(0);
  }

  25% {
    transform: rotate(-7deg) translateY(-1px);
  }

  50% {
    transform: rotate(0deg) translateY(0);
  }

  75% {
    transform: rotate(7deg) translateY(-1px);
  }
}

.message {
  max-width: min(760px, 82%);
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.7;
  word-break: break-word;
}

.message p,
.message h3 {
  margin: 0;
}

.message p + p {
  margin-top: 8px;
}

.message.ai-formatted {
  padding: 12px 14px;
  white-space: normal;
}

.message.ai-formatted p {
  margin: 0 0 10px;
}

.message.ai-formatted p:last-child {
  margin-bottom: 0;
}

.message.ai-formatted strong {
  color: #12365f;
  font-weight: 800;
}

.message-source-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 8px;
  padding: 2px 8px;
  border: 1px solid #d6e7f8;
  border-radius: 999px;
  color: #4f6680;
  background: #f6fbff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.ai-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
  padding-left: 22px;
}

.ai-list:last-child {
  margin-bottom: 0;
}

.ai-list li {
  padding-left: 2px;
  line-height: 1.65;
}

.ai-list li::marker {
  color: var(--primary);
  font-weight: 800;
}

.message.ai {
  border: 0;
  color: var(--text);
  background: transparent;
  box-shadow: none;
}

.message.ai.recommendation-message {
  width: min(940px, 100%);
  max-width: min(940px, 100%);
  padding: 12px 0;
}

.message.user {
  color: var(--text);
  background: #eef4ff;
  box-shadow: none;
}

.attachment-card {
  display: inline-grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  max-width: min(280px, 100%);
  padding: 10px 12px;
  border: 1px solid #e1e6ef;
  border-radius: 14px;
  color: inherit;
  background: #fff;
  text-align: left;
}

button.attachment-card {
  cursor: pointer;
}

button.attachment-card:hover {
  border-color: var(--border-strong);
}

.attachment-icon {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #61b5f5 0%, #2f8fe8 100%);
}

.attachment-icon::before,
.attachment-icon::after {
  position: absolute;
  content: '';
  background: #fff;
}

.attachment-icon::before {
  left: 8px;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.attachment-icon::after {
  left: 7px;
  right: 6px;
  bottom: 7px;
  height: 8px;
  clip-path: polygon(0 100%, 35% 35%, 56% 62%, 74% 22%, 100% 100%);
}

.attachment-info {
  min-width: 0;
}

.attachment-info strong,
.attachment-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-info strong {
  color: #111827;
  font-size: 14px;
  line-height: 1.35;
}

.attachment-info span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.message .attachment-card {
  margin-top: 8px;
}

.message .attachment-card:first-child {
  margin-top: 0;
}

.message-resource-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.message-resource-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(100%, 520px);
  padding: 10px 12px;
  border: 1px solid #d8e7f7;
  border-radius: 14px;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(22, 87, 154, 0.06);
}

.message-resource-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 10px 24px rgba(22, 87, 154, 0.1);
}

.message-resource-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(180deg, #2f8fe8 0%, #1769e0 100%);
  font-size: 13px;
  font-weight: 800;
}

.message-resource-card--pdf .message-resource-icon {
  background: linear-gradient(180deg, #f97373 0%, #dc2626 100%);
}

.message-resource-card--pdf .message-resource-icon::before {
  content: "PDF";
}

.message-resource-card--plan .message-resource-icon {
  background: linear-gradient(180deg, #34c5aa 0%, #0f9f95 100%);
}

.message-resource-card--plan .message-resource-icon::before {
  content: "图";
}

.message-resource-card--material .message-resource-icon::before {
  content: "文";
}

.message-resource-info {
  min-width: 0;
}

.message-resource-info strong,
.message-resource-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-resource-info strong {
  font-size: 14px;
  line-height: 1.35;
}

.message-resource-info span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.message-resource-action {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.message.ai.venue-detail-message {
  width: min(900px, 100%);
  max-width: min(900px, 100%);
  padding: 0;
  background: transparent;
}

.venue-detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px;
  gap: 20px;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 18px 18px 18px 20px;
  border: 1px solid #cfe2f6;
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 8px 24px rgba(22, 87, 154, 0.06);
}

.venue-detail-card--no-actions .venue-detail-main {
  grid-column: 1 / -1;
}

.venue-detail-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.venue-detail-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  min-width: 0;
}

.venue-detail-title-row h3 {
  margin: 0;
  color: #10233f;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.4;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.venue-detail-group {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  overflow: hidden;
  padding: 2px 7px;
  border: 1px solid #cfe2f6;
  border-radius: 6px;
  color: #1766d6;
  background: #eef6ff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.venue-detail-address {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  margin: 0;
  color: #53657d;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.venue-detail-address strong {
  flex: 0 0 auto;
  color: #31435c;
  font-weight: 800;
}

.venue-detail-address span {
  min-width: 0;
}

.venue-detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  min-width: 0;
}

.venue-detail-fact {
  display: flex;
  gap: 6px;
  align-items: baseline;
  min-width: 0;
  color: #334b6a;
  font-size: 13px;
  line-height: 1.45;
}

.venue-detail-fact span {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 700;
}

.venue-detail-fact strong {
  min-width: 0;
  color: #10233f;
  font-size: 16px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.venue-detail-actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
  align-content: center;
  min-width: 0;
}

.venue-detail-material-button,
.venue-detail-plan-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.venue-detail-material-button {
  border: 1px solid #2d76ee;
  color: #fff;
  background: linear-gradient(180deg, #2f7bf3 0%, #1768df 100%);
  box-shadow: 0 6px 12px rgba(23, 104, 223, 0.2);
}

.venue-detail-material-button:hover {
  background: #1259bf;
}

.venue-detail-material-button:active,
.venue-detail-plan-button:active {
  transform: translateY(1px);
}

.venue-detail-plan-button {
  border: 1px solid #d6e7f8;
  color: #1766d6;
  background: #fff;
  box-shadow: 0 4px 10px rgba(22, 87, 154, 0.06);
}

.venue-detail-plan-button:hover {
  border-color: #9fc8ff;
  color: var(--primary-strong);
  background: #f7fbff;
}


.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.message-actions .button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}

.message-advisor-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #cfe2f6;
  border-radius: 14px;
  color: #31435c;
  background: #f7fbff;
}

.message-advisor-cta p {
  flex: 1 1 220px;
  color: #31435c;
  font-size: 13px;
  line-height: 1.6;
}

.message-advisor-cta .button {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 13px;
}

.advisor-qr-card {
  appearance: none;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(230px, 100%);
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #d6e7f8;
  border-radius: 16px;
  color: var(--text);
  background: #fff;
  cursor: zoom-in;
  text-align: center;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.advisor-qr-card:hover {
  border-color: #9fc9ef;
  box-shadow: 0 8px 20px rgba(22, 87, 154, 0.1);
}

.advisor-qr-svg {
  display: block;
  width: min(176px, 100%);
  height: auto;
  border: 1px solid #e2edf8;
  border-radius: 12px;
}

.advisor-qr-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.advisor-qr-copy {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

.guide-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.guide-list span {
  padding: 5px 8px;
  border: 1px solid #c6ddf5;
  border-radius: var(--radius);
  color: var(--primary);
  background: #f2f8ff;
  font-size: 13px;
  font-weight: 700;
}

.recommendation {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.recommendation > p,
.recommendation-followup {
  grid-column: 1 / -1;
}

.message.ai.recommendation-message .recommendation > p {
  padding-inline: 12px;
}

.recommendation-empty {
  grid-column: 1 / -1;
  padding-inline: 12px;
  color: #31435c;
  line-height: 1.75;
}

.recommendation-followup {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #cfe2f6;
  border-radius: var(--radius);
  color: #31435c;
  background: #f7fbff;
  font-size: 13px;
  line-height: 1.6;
}

.recommendation-followup > strong {
  color: #12365f;
  font-size: 13px;
}

.recommendation-followup p {
  margin: 0;
}

.venue-card {
  display: flex;
  overflow: hidden;
  min-width: 0;
  flex-direction: column;
  border: 1px solid #dbe8f8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(28, 72, 125, 0.055);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.venue-card:hover {
  transform: translateY(-2px);
  border-color: #9fc8ff;
  box-shadow: 0 12px 28px rgba(30, 78, 138, 0.1);
}

.venue-cover {
  position: relative;
  padding: 10px 14px 9px;
  color: #10233f;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
  border-bottom: 1px solid #edf4fc;
}

.venue-cover::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #1f73e8 0%, #7fb8ff 100%);
}

.venue-rank,
.venue-label,
.venue-group-line,
.venue-cover h3 {
  position: relative;
  z-index: 1;
}

.venue-rank {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: #1766d6;
  background: #e8f3ff;
  font-size: 12px;
  font-weight: 800;
}

.venue-label {
  position: absolute;
  top: 12px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid #d4e6fb;
  border-radius: 999px;
  color: #1259bf;
  background: #f7fbff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.venue-cover h3 {
  overflow: hidden;
  margin: 8px 0 5px;
  color: #10233f;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.venue-title {
  min-width: 0;
}

.venue-group-line + .venue-title {
  margin-top: 4px;
}

.venue-group-line {
  display: flex;
  min-width: 0;
  margin-top: 8px;
}

.venue-group-tag {
  max-width: 100%;
  overflow: hidden;
  padding: 2px 6px;
  border-radius: 5px;
  color: #1766d6;
  background: #e8f3ff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.venue-title-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.venue-content {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  padding: 10px 14px 12px;
  flex-direction: column;
}

.venue-address {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  color: #61738d;
  font-size: 12px;
  line-height: 1.45;
}

.venue-address strong {
  flex: 0 0 auto;
  color: #1f73e8;
}

.venue-address span {
  min-width: 0;
}

.venue-meta {
  margin-top: 4px;
  color: #53657d;
  font-size: 12px;
  line-height: 1.45;
}

.venue-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
  overflow: visible;
}

.venue-highlights span {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  color: #24496f;
  background: #eef6ff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.venue-highlights span.is-match {
  color: #8a4d00;
  background: #fff2d8;
}

.venue-reason {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #e3effc;
  border-radius: 12px;
  color: #334b6a;
  background: #f7fbff;
  font-size: 12px;
  line-height: 1.55;
}

.venue-reason strong {
  color: #1766d6;
}

.venue-resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  align-self: flex-start;
  margin: auto 0 0;
  padding-top: 10px;
}

.venue-resource-actions:empty {
  display: none;
}

.venue-resource-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 15px 7px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(180deg, #2476e8 0%, var(--primary) 100%);
  box-shadow: 0 4px 10px rgba(18, 101, 216, 0.14);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.venue-resource-link::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.venue-resource-link:hover {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
  box-shadow: 0 5px 12px rgba(18, 101, 216, 0.16);
}

.venue-resource-link:active {
  transform: translateY(1px);
}

.advisor-card {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.qr-box {
  width: 98px;
  height: 98px;
  flex: 0 0 98px;
  border: 8px solid #fff;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, #10233f 9px, transparent 9px 17px, #10233f 17px 25px, transparent 25px 34px, #10233f 34px 43px, transparent 43px),
    linear-gradient(#10233f 9px, transparent 9px 17px, #10233f 17px 25px, transparent 25px 34px, #10233f 34px 43px, transparent 43px),
    #fff;
  background-size: 43px 43px;
  box-shadow: inset 0 0 0 1px #dbe7f4;
}

.advisor-card strong,
.advisor-card span {
  display: block;
}

.advisor-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8fb6df;
  animation: typing 1.1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 120ms;
}

.typing span:nth-child(3) {
  animation-delay: 240ms;
}

.ai-note {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 6px 30px 10px;
  color: #8290a3;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

.composer {
  padding: 12px 30px 0;
  min-height: 136px;
  border-top: 0;
  background: transparent;
  box-shadow: none;
}

.app-shell.welcome-mode .composer {
  align-self: start;
  min-height: 0;
  padding: 0 30px;
}

.composer-box {
  position: relative;
  display: grid;
  grid-template-areas:
    "input input input"
    "prompts attach send";
  grid-template-columns: minmax(0, 1fr) 40px 36px;
  grid-template-rows: minmax(60px, auto) 40px;
  align-items: center;
  gap: 10px 10px;
  width: min(100%, 780px);
  min-height: 124px;
  margin: 0 auto;
  padding: 16px 12px 12px 16px;
  border: 1px solid #e1e6ef;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(16, 35, 63, 0.08);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.app-shell.welcome-mode .composer-box {
  width: min(100%, 820px);
  min-height: 124px;
  box-shadow: 0 12px 34px rgba(16, 35, 63, 0.08);
}

.composer-box:focus-within {
  border-color: #cfd8e8;
  box-shadow: 0 10px 28px rgba(16, 35, 63, 0.1);
}

.composer-box.has-attachment {
  grid-template-areas:
    "attachment attachment attachment"
    "input input input"
    "prompts attach send";
  grid-template-rows: auto minmax(52px, auto) 40px;
  min-height: 174px;
}

.attachment-preview {
  grid-area: attachment;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: min(100%, 240px);
}

.attachment-preview[hidden] {
  display: none;
}

.attachment-preview .attachment-card {
  flex: 1 1 auto;
  min-width: 0;
}

.attachment-remove {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #6b7280;
  background: #f3f4f6;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.attachment-remove:hover {
  color: #111827;
  background: #e5e7eb;
}

.composer-box textarea {
  grid-area: input;
  min-height: 60px;
  max-height: 150px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  line-height: 1.55;
}

.composer-box textarea::placeholder {
  color: #9aa6b8;
}

.composer-box textarea:focus-visible {
  outline: none;
}

.quick-prompts {
  grid-area: prompts;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  padding: 0;
}

.prompt-label {
  display: none;
}

.quick-prompts button {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 5px 12px;
  border: 1px solid #d6e2ff;
  border-radius: 999px;
  color: var(--primary);
  background: #f7faff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.quick-prompts button:hover {
  border-color: #b8cbff;
  background: #eef4ff;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--primary);
  background: #fff;
  border-color: var(--border);
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-blue);
}

.attach-button {
  grid-area: attach;
  align-self: center;
  justify-self: center;
  width: 40px;
  height: 40px;
  color: #111827;
  background: transparent;
  border-color: transparent;
}

.attach-button .svg-icon {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
}

.attach-button:hover {
  color: var(--primary);
  border-color: transparent;
  background: #f4f7fb;
}

.send-button {
  grid-area: send;
  align-self: center;
  justify-self: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #8ea7ff;
  border-color: #8ea7ff;
  box-shadow: none;
}

.send-button:hover:not(:disabled) {
  background: #7f98f2;
  border-color: #7f98f2;
}

.send-button:disabled {
  cursor: not-allowed;
  color: #fff;
  background: #d1d5db;
  border-color: #d1d5db;
  opacity: 1;
}

.mobile-menu,
.mobile-close {
  display: none;
}

.scrim {
  display: none;
}

.qr-preview {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 35, 63, 0.5);
}

.qr-preview[hidden] {
  display: none;
}

.qr-preview-panel {
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 16px;
  border: 1px solid #d5e5f5;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 22px 60px rgba(16, 35, 63, 0.22);
}

.qr-preview-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.qr-preview-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}

.qr-preview-close {
  min-width: 44px;
  min-height: 44px;
  color: var(--muted);
  background: #fff;
  border-color: var(--border);
}

.qr-preview-close:hover {
  color: var(--primary);
  border-color: var(--border-strong);
}

.qr-preview-content {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  border: 1px solid #d6e7f8;
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}

.qr-preview-code-frame {
  display: grid;
  place-items: center;
}

.qr-preview-code-frame .advisor-qr-svg {
  width: min(260px, calc(100vw - 96px));
}

.qr-preview-advisor-name {
  color: var(--text);
  font-size: 17px;
  line-height: 1.4;
}

.qr-preview-copy {
  width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid #bbd5ee;
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.icon-menu,
.icon-x,
.icon-send {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.icon-x::before,
.icon-x::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.icon-x::before {
  transform: rotate(45deg);
}

.icon-x::after {
  transform: rotate(-45deg);
}

.icon-menu::before,
.icon-menu::after {
  content: "";
  position: absolute;
}

.icon-menu::before {
  left: 2px;
  top: 4px;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.icon-send::before,
.icon-send::after {
  content: "";
  position: absolute;
}


.icon-send {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  color: #fff;
}

.icon-send::before {
  left: 8px;
  top: 4px;
  width: 2px;
  height: 11px;
  border-radius: 999px;
  background: currentColor;
}

.icon-send::after {
  left: 5px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}

@keyframes typing {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .chat-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(312px, calc(100vw - 40px));
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: 18px 0 48px rgba(16, 35, 63, 0.14);
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(16, 35, 63, 0.28);
  }

  .mobile-menu,
  .mobile-close {
    display: inline-flex;
  }

  .chat-header {
    justify-content: flex-start;
    padding: 14px 16px;
  }

  .home-filing {
    right: 12px;
    bottom: 4px;
    max-width: calc(100vw - 24px);
    font-size: 10px;
    line-height: 1.25;
    opacity: 0.68;
  }

  .home-filing > span {
    display: none;
  }

  .header-summary {
    display: none;
  }


  .messages-wrap {
    padding: 18px 14px 10px;
  }

  .app-shell.welcome-mode .welcome-panel {
    padding: 0 14px 22px;
  }

  .app-shell.welcome-mode .composer {
    padding: 0 14px;
  }

  .welcome-greeting {
    gap: 10px;
  }

  .welcome-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .welcome-greeting h2 {
    font-size: 24px;
  }

  .ai-note {
    padding: 6px 14px 2px;
  }

  .composer {
    padding: 12px 14px 16px;
  }

  .message {
    max-width: 84%;
  }

  .venue-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .venue-detail-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .venue-detail-main {
    gap: 8px;
  }

  .venue-detail-title-row h3 {
    font-size: 18px;
  }

  .venue-detail-group {
    max-width: 100%;
    font-size: 13px;
  }

  .venue-detail-address,
  .venue-detail-fact {
    font-size: 13px;
  }

  .venue-detail-facts {
    gap: 8px 18px;
  }

  .venue-detail-actions {
    gap: 8px;
  }

  .venue-detail-material-button,
  .venue-detail-plan-button {
    width: 100%;
    min-height: 44px;
    font-size: 13px;
  }
}

@media (max-width: 560px) {
  .login-dialog {
    padding: 16px;
  }

  .login-panel {
    padding: 24px;
  }

  .login-panel h1,
  .login-panel h2 {
    font-size: 26px;
  }

  .code-row {
    grid-template-columns: 1fr;
  }

  .chat-header h1 {
    font-size: 18px;
  }

  .welcome-greeting h2 {
    font-size: 22px;
  }

  .message {
    max-width: 88%;
  }

  .avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .advisor-card {
    align-items: stretch;
    flex-direction: column;
  }

}

body.force-desktop-layout {
  min-width: 1024px;
  overflow: auto;
}

body.force-desktop-layout.chat-locked {
  position: static;
  width: auto;
  overflow: auto;
}

body.force-desktop-layout .app-shell,
body.force-desktop-layout .chat-view,
body.force-desktop-layout .app-shell[data-view="chat"] {
  min-width: 1024px;
}

body.force-desktop-layout .login-panel {
  padding: 32px;
}

body.force-desktop-layout .login-panel h1,
body.force-desktop-layout .login-panel h2 {
  font-size: 30px;
}

body.force-desktop-layout .code-row {
  grid-template-columns: minmax(0, 1fr) 120px;
}

body.force-desktop-layout .chat-view {
  grid-template-columns: 276px minmax(0, 1fr);
  min-width: 1024px;
}

body.force-desktop-layout .sidebar {
  position: static;
  inset: auto;
  z-index: auto;
  width: auto;
  transform: none;
  transition: none;
}

body.force-desktop-layout .app-shell.sidebar-open .scrim {
  display: none;
}

body.force-desktop-layout .mobile-menu,
body.force-desktop-layout .mobile-close {
  display: none;
}

body.force-desktop-layout .chat-header {
  justify-content: space-between;
  padding: 14px 34px 0;
}

body.force-desktop-layout .home-filing {
  right: 16px;
  bottom: 6px;
  max-width: calc(100vw - 32px);
  font-size: 11px;
  line-height: 1.3;
}

body.force-desktop-layout .home-filing > span {
  display: inline;
}

body.force-desktop-layout .chat-header h1 {
  font-size: 18px;
}

body.force-desktop-layout .header-summary {
  display: flex;
}

body.force-desktop-layout .messages-wrap {
  padding: 34px 30px 28px;
}

body.force-desktop-layout .ai-note {
  padding: 6px 30px 2px;
}

body.force-desktop-layout .composer {
  padding: 14px 30px 18px;
}

body.force-desktop-layout .message {
  max-width: 78%;
}

body.force-desktop-layout .venue-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

body.force-desktop-layout .advisor-card {
  align-items: center;
  flex-direction: row;
}
