.chat-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 80;
  min-width: 52px; height: 52px; padding: 0 18px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font: 600 14px/1 var(--body); cursor: pointer;
  box-shadow: 0 12px 36px rgba(0,0,0,.22);
}
.chat-launcher:hover { background: var(--accent); }
.chat-launcher.is-compact {
  width: 52px; min-width: 52px; padding: 0;
  font-size: 0;
}
.chat-launcher.is-compact::after { content: "Ask"; font-size: 12px; }
.portfolio-chat {
  position: fixed; inset: auto 24px 88px auto; z-index: 90;
  width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100vh - 120px));
  margin: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--rule); border-radius: 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.portfolio-chat:not([open]) { display: none; }
.portfolio-chat.avoid-portrait {
  inset: auto 24px 88px auto;
  height: min(420px, calc(100vh - 120px));
}
.chat-shell { height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
.chat-head { display: flex; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.chat-head strong { display: block; font-size: 16px; }
.chat-head span { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 13px; }
.chat-close { width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink); font-size: 24px; cursor: pointer; }
.chat-log { overflow-y: auto; padding: 18px 20px; }
.chat-message { max-width: 88%; margin-bottom: 14px; padding: 11px 13px; border-radius: 10px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.chat-message.guide { background: var(--bg); color: var(--ink-soft); }
.chat-message.visitor { margin-left: auto; background: var(--accent); color: #f4f4f6; }
.chat-sources { display: flex; flex-wrap: wrap; gap: 10px; margin: -6px 0 18px; }
.chat-sources a { color: var(--accent); font-size: 13px; }
.chat-starters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.chat-starters button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 999px; background: transparent; color: var(--ink); font: 500 13px/1.3 var(--body); cursor: pointer; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px; border-top: 1px solid var(--rule); }
.chat-form input { min-width: 0; height: 44px; padding: 0 13px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); color: var(--ink); font: 14px var(--body); }
.chat-form button { min-width: 68px; height: 44px; border: 0; border-radius: 8px; background: var(--accent); color: #f4f4f6; font: 600 14px var(--body); cursor: pointer; }
.chat-form button:disabled { opacity: .55; cursor: wait; }
.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; }
@media (max-width: 520px) {
  .chat-launcher {
    left: 16px; right: auto; bottom: 16px;
    width: 52px; min-width: 52px; padding: 0;
    font-size: 0;
  }
  .chat-launcher::after { content: "Ask"; font-size: 12px; }
  .portfolio-chat { inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; border: 0; border-radius: 0; }
}
@media (min-width: 521px) and (max-width: 760px) {
  .portfolio-chat.avoid-portrait {
    inset: auto 16px 80px;
    width: auto;
    height: min(42vh, 380px);
  }
}
