/* Elevated controls use one restrained shadow; content surfaces remain flat. */
:root {
  --shadow-float: 0 4px 18px rgb(15 23 42 / 0.12);
  --shadow-dialog: 0 18px 60px rgb(15 23 42 / 0.2);
}
.dark {
  --shadow-float: 0 4px 18px rgb(0 0 0 / 0.28);
  --shadow-dialog: 0 18px 60px rgb(0 0 0 / 0.38);
}
.assistant-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--primary);
  border: 1px solid rgb(255 255 255 / 0.2);
  color: white;
  box-shadow: var(--shadow-float);
  touch-action: none;
  user-select: none;
  cursor: grab;
  font-size: 12px;
  font-weight: 600;
  max-width: calc(100vw - 24px);
}
.assistant-launcher:hover {
  background: #4338ca;
}
.assistant-launcher.dragging {
  cursor: grabbing;
  box-shadow: none;
}
.assistant-active .assistant-launcher {
  opacity: 0;
  pointer-events: none;
}
.chat-workspace {
  position: fixed;
  inset: 20px;
  width: min(1280px, calc(100% - 40px));
  height: min(900px, calc(100dvh - 40px));
  max-width: none;
  max-height: none;
  margin: auto;
  border-radius: 22px;
  box-shadow: var(--shadow-dialog);
  overflow: hidden;
}
.chat-workspace[open] {
  display: grid;
  grid-template-columns: 242px minmax(0, 1fr);
}
.chat-workspace::backdrop {
  background: rgb(2 6 23 / 0.52);
  backdrop-filter: blur(2px);
}
.chat-sidebar {
  background: var(--soft);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow: hidden;
}
.chat-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
}
.chat-wordmark {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.chat-sidebar-top .icon-button {
  display: none;
}
.chat-sidebar > .secondary {
  justify-content: flex-start;
  min-height: 44px;
  flex: none;
  background: var(--surface);
  border-radius: 12px;
}
.chat-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-top: 12px;
}
.chat-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  min-height: 0;
  flex: 1;
}
.chat-thread {
  width: 100%;
  padding: 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  flex: none;
}
.chat-thread:hover,
.chat-thread[aria-current="true"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.chat-sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  flex: none;
}
.chat-sidebar-footer p {
  font-size: 11px;
  line-height: 1.8;
  margin: 12px 0;
}
.chat-sidebar-footer a {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  min-height: 36px;
  align-items: center;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}
.chat-workspace .chat-header {
  padding: 16px 24px;
  flex: none;
  min-height: 80px;
  gap: 10px;
  background: var(--surface);
}
.chat-header > div {
  flex: 1;
  min-width: 0;
}
.chat-header h2 {
  font-size: 15px;
  letter-spacing: -0.01em;
}
.chat-header p {
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.chat-status-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 5px;
}
.chat-header .icon-button {
  flex: none;
  width: 40px;
  height: 40px;
}
#chat-sidebar-toggle {
  display: none;
}
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 32px 32px 16px;
}
.chat-welcome {
  width: min(640px, 100%);
  margin: clamp(12px, 4vh, 60px) auto 24px;
  text-align: center;
}
.chat-welcome-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  background: var(--tint);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 17px;
  font-size: 30px;
  margin: 0 auto 24px;
}
.chat-welcome > .eyebrow {
  font-size: 9px;
  margin-bottom: 14px;
}
.chat-welcome h3 {
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.04em;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 16px;
}
.chat-welcome > p:not(.eyebrow) {
  max-width: 440px;
  margin: 0 auto;
  font-size: 13px;
  line-height: 1.85;
}
.chat-suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 30px;
  text-align: left;
}
.chat-suggestions button {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
  min-width: 0;
}
.chat-suggestions button:hover {
  background: var(--soft);
  border-color: #a5b4fc;
}
.chat-suggestions span {
  font-size: 11px;
  color: var(--muted);
}
.chat-welcome .chat-scope-note {
  font-size: 10px !important;
  margin: 22px auto 0 !important;
  color: var(--muted);
  max-width: 460px !important;
}
.chat-messages {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.chat-message {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.chat-message.user {
  align-self: flex-end;
  max-width: 85%;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 18px 18px 4px 18px;
  background: var(--soft);
}
.chat-author {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.chat-message-text {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
}
.chat-message.assistant {
  padding: 0 4px;
}
.chat-message.assistant .chat-author {
  color: var(--accent);
  margin-bottom: 12px;
}
.chat-result-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 8px;
}
.chat-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.chat-result:hover {
  background: var(--soft);
  border-color: #a5b4fc;
}
.chat-result strong {
  font-size: 13px;
}
.chat-result span {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}
.chat-result small {
  font-size: 10px;
  color: var(--accent);
}
.chat-composer-wrap {
  flex: none;
  padding: 16px 32px 20px;
  background: var(--surface);
}
.chat-workspace .chat-composer {
  display: block;
  padding: 14px 16px 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--soft);
  max-width: 720px;
  margin: 0 auto;
  box-shadow: 0 2px 6px rgb(15 23 42 / 0.025);
}
.chat-composer:focus-within {
  border-color: #a5b4fc;
  outline: 2px solid rgb(165 180 252 / 0.15);
  outline-offset: 2px;
}
.chat-composer textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  max-height: 150px;
  resize: none;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  padding: 4px 0;
  font-size: 14px;
  line-height: 1.7;
}
.chat-composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.chat-composer-bottom > span {
  font-size: 10px;
  color: var(--muted);
}
.chat-send {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  width: 38px;
  height: 38px;
  flex: none;
  background: var(--primary);
  color: white;
}
.chat-send:hover {
  background: #4338ca;
}
.chat-disclaimer {
  text-align: center;
  font-size: 10px;
  line-height: 1.6;
  margin: 12px auto 0;
  max-width: 640px;
}
@media (max-width: 1023px) {
  .chat-workspace[open] {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .chat-scroll {
    padding: 24px 24px 16px;
  }
  .chat-composer-wrap {
    padding: 16px 24px;
  }
  .chat-suggestions {
    grid-template-columns: 1fr;
  }
  .chat-welcome {
    margin-top: 16px;
  }
}
@media (max-width: 767px) {
  .launcher-label {
    display: none;
  }
  .assistant-launcher {
    width: 54px;
    padding: 0;
  }
  .chat-workspace {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-width: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
    margin: 0;
  }
  .chat-workspace[open] {
    display: flex;
  }
  .chat-main {
    width: 100%;
    flex: 1;
  }
  .chat-workspace .chat-header {
    padding: 12px 12px;
    min-height: 72px;
    gap: 4px;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .chat-header h2 {
    font-size: 14px;
  }
  .chat-header p {
    font-size: 10px;
  }
  .chat-header .icon-button {
    width: 38px;
    height: 40px;
  }
  #chat-sidebar-toggle {
    display: inline-grid;
  }
  #chat-reset-position {
    display: none;
  }
  .chat-sidebar {
    display: none;
    position: absolute;
    inset: 0 auto 0 0;
    width: min(300px, 85%);
    z-index: 2;
    box-shadow: var(--shadow-dialog);
  }
  .sidebar-open .chat-sidebar {
    display: flex;
  }
  .sidebar-open .chat-main {
    pointer-events: none;
    visibility: hidden;
  }
  .chat-sidebar-top .icon-button {
    display: inline-grid;
  }
  .chat-scroll {
    padding: 24px 18px 16px;
  }
  .chat-welcome {
    margin-top: 14px;
  }
  .chat-welcome-mark {
    width: 44px;
    height: 44px;
    font-size: 26px;
    margin-bottom: 22px;
  }
  .chat-welcome h3 {
    font-size: 27px;
  }
  .chat-welcome > p:not(.eyebrow) {
    font-size: 13px;
  }
  .chat-suggestions {
    gap: 10px;
    margin-top: 24px;
  }
  .chat-suggestions button {
    padding: 14px 16px;
  }
  .chat-welcome .chat-scope-note {
    font-size: 10px !important;
  }
  .chat-composer-wrap {
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
  }
  .chat-workspace .chat-composer {
    padding: 12px 14px 10px;
    border-radius: 16px;
  }
  .chat-composer textarea {
    font-size: 16px;
    min-height: 40px;
  }
  .chat-disclaimer {
    font-size: 9px;
    max-width: 320px;
    margin-top: 10px;
  }
  .chat-messages {
    gap: 24px;
  }
  .chat-message-text {
    font-size: 14px;
  }
  .chat-message.user {
    max-width: 92%;
    padding: 12px 16px;
  }
  .chat-sidebar-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
@media (max-height: 550px) {
  .chat-composer-wrap {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .chat-disclaimer {
    display: none;
  }
  .chat-workspace .chat-header {
    min-height: 60px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .chat-welcome-mark {
    display: none;
  }
  .chat-welcome {
    margin-top: 0;
  }
  .chat-composer textarea {
    min-height: 32px;
    max-height: 80px;
  }
}

.chat-sidebar-footer .text-link {
  display: flex;
  font-size: 11px;
  margin-bottom: 4px;
  min-height: 36px;
}
.chat-sidebar-footer > a {
  display: flex;
}
