html, body.chat-page { height: 100%; overflow: hidden; }

.chat-page {
  display: flex; flex-direction: column;
  height: 100vh; background: var(--chat-bg);
}

.chat-topbar {
  flex-shrink: 0; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; border-bottom: 1px solid var(--border);
  background: var(--chat-bg);
}
.chat-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.chat-brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--navy); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 700; font-size: .8rem;
  flex-shrink: 0;
}
.chat-brand-text { font-family: 'Fraunces', serif; font-weight: 700; font-size: 1.02rem; color: var(--text); }
.chat-brand-text span { display: block; font-family: 'DM Mono', monospace; font-size: .58rem; color: var(--text-3); font-weight: 400; letter-spacing: .08em; text-transform: uppercase; margin-top: -1px; }

.chat-topbar-actions { display: flex; align-items: center; gap: 8px; }
.btn-new-chat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius);
  border: 1.5px solid var(--border-dark); background: var(--white);
  color: var(--text-2); font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-new-chat:hover { background: var(--bg); color: var(--text); }
.btn-staff-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius);
  color: var(--text-3); font-size: .8rem; font-weight: 500;
  text-decoration: none; transition: var(--transition);
}
.btn-staff-link:hover { color: var(--text); background: var(--bg); }

.chat-scroll { flex: 1; overflow-y: auto; }
.chat-column { max-width: var(--chat-max-w); margin: 0 auto; padding: 24px 20px 12px; min-height: 100%; display: flex; flex-direction: column; }

/* Empty state */
.chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 12px;
}
.chat-empty-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--navy); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 1.4rem;
  margin-bottom: 18px;
}
.chat-empty h1 { font-family: 'Fraunces', serif; font-size: 1.55rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.chat-empty p { font-size: .88rem; color: var(--text-3); max-width: 420px; line-height: 1.6; margin-bottom: 28px; }

.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 560px; }
.prompt-chip {
  padding: 9px 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--white);
  color: var(--text-2); font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); text-align: left;
}
.prompt-chip:hover { border-color: var(--navy); color: var(--navy); }

/* Messages */
.msg-row { display: flex; margin-bottom: 22px; gap: 12px; }
.msg-row.msg-user { justify-content: flex-end; }
.msg-row.msg-assistant { justify-content: flex-start; }

.msg-avatar {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: var(--navy); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 700; font-size: .68rem;
  margin-top: 2px;
}

.msg-user .msg-bubble {
  background: var(--bubble-user-bg); color: var(--bubble-user-text);
  padding: 10px 15px; border-radius: 16px 16px 3px 16px;
  max-width: 75%; font-size: .9rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}

.msg-assistant-body { max-width: calc(100% - 38px); min-width: 0; }
.msg-assistant .msg-bubble {
  font-size: .9rem; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.msg-assistant .msg-bubble p { margin-bottom: 10px; }
.msg-assistant .msg-bubble p:last-child { margin-bottom: 0; }
.msg-assistant .msg-bubble strong { font-weight: 700; }

.msg-citations { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.citation-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); font-size: .74rem; font-weight: 500;
  text-decoration: none; transition: var(--transition); max-width: 260px;
}
.citation-chip:hover { border-color: var(--navy); color: var(--navy); }
.citation-chip .cc-num {
  width: 15px; height: 15px; border-radius: 4px; flex-shrink: 0;
  background: var(--navy-pale); color: var(--navy);
  font-family: 'DM Mono', monospace; font-size: .62rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.citation-chip .cc-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-actions { display: flex; gap: 4px; margin-top: 8px; }
.msg-action-btn {
  width: 26px; height: 26px; border-radius: 6px; border: none; background: none;
  color: var(--text-3); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.msg-action-btn:hover { background: var(--bg); color: var(--text); }

.msg-no-info {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 13px; border-radius: var(--radius);
  background: var(--amber-bg); border: 1px solid rgba(176,106,0,.18);
  font-size: .82rem; color: var(--amber); margin-top: 4px;
}

/* Typing indicator */
.msg-typing { display: flex; gap: 4px; padding: 6px 0; }
.msg-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
  animation: typingBounce 1.1s infinite ease-in-out;
}
.msg-typing span:nth-child(2) { animation-delay: .15s; }
.msg-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity:.4; } 30% { transform: translateY(-4px); opacity:1; } }

/* Composer */
.composer-wrap {
  flex-shrink: 0; padding: 8px 20px 14px;
  background: linear-gradient(0deg, var(--chat-bg) 55%, transparent);
}
.composer-inner { max-width: var(--chat-max-w); margin: 0 auto; }
.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--composer-bg); border: 1.5px solid var(--composer-border);
  border-radius: 20px; padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
.composer-box:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31,43,77,.08); }
.composer-textarea {
  flex: 1; border: none; outline: none; background: none; resize: none;
  font-family: 'DM Sans', sans-serif; font-size: .9rem; color: var(--text);
  line-height: 1.5; max-height: 160px; padding: 6px 0;
}
.composer-textarea::placeholder { color: var(--text-3); }
.composer-send {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--navy); color: var(--white); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.composer-send:hover:not(:disabled) { background: var(--navy-dark); }
.composer-send:disabled { opacity: .4; cursor: not-allowed; }

.composer-disclaimer {
  text-align: center; font-size: .7rem; color: var(--text-3);
  margin-top: 10px; line-height: 1.5;
}
.composer-disclaimer .sb-mark {
  font-family: 'DM Mono', monospace; letter-spacing: .04em;
}

@media (max-width: 640px) {
  .chat-column { padding: 16px 14px 8px; }
  .composer-wrap { padding: 6px 12px 12px; }
  .msg-user .msg-bubble, .msg-assistant-body { max-width: 88%; }
  .chat-brand-text span { display: none; }
}
