@font-face {
  font-family: "DM Sans";
  src: url("/dm-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 750;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "DM Sans", system-ui, sans-serif;
  color: #231b31;
  background: #faf9fc;
  --accent: #6944c6;
  --accent-hover: #5936b1;
  --muted: #6c6379;
  --border: #eae5ef;
  --sidebar-width: 264px;
  --content-width: 780px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, textarea, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #8b6ade;
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.visually-hidden, .symbols {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon, .mark { display: block; width: 20px; height: 20px; flex: none; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}
.icon-button:hover { background: #f0ecf6; color: #372754; }

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.workspace.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.workspace.sidebar-collapsed .sidebar { visibility: hidden; }
.nav-scrim { display: none; }

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: var(--sidebar-width);
  padding: 25px 16px 14px;
  background:
    radial-gradient(ellipse 240px 245px at 18% 0%, #352745 0%, transparent 90%),
    #221b2e;
  color: #f6f2fb;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; margin-bottom: 33px; }
.brand-mark, .hero-icon, .assistant-mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #986df0, #704bd1 65%, #613abc);
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 #ffffff46, 0 4px 10px #140c2880;
}
.brand-mark .mark { width: 23px; height: 23px; }
.brand-name { font-size: 23px; font-weight: 750; line-height: 1.05; letter-spacing: -.065em; }
.brand-company { margin-top: 4px; font-size: 9px; font-weight: 700; letter-spacing: .19em; text-transform: uppercase; color: #c7b5de; }

.nav-actions { display: grid; gap: 8px; }
.new-chat, .search-chats, .connection-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border-radius: 10px;
  text-align: left;
}
.new-chat, .search-chats { min-height: 43px; padding: 0 11px; font-size: 14px; font-weight: 650; }
.new-chat {
  color: #fdfaff;
  border: 1px solid #a084d15c;
  background: linear-gradient(110deg, #513a75, #4c3669);
  box-shadow: inset 0 1px 0 #ffffff0e;
}
.new-chat:hover { background: #604588; }
.new-chat .icon { color: #e5d5fe; }
.search-chats { background: transparent; border: 1px solid transparent; color: #d3c8de; }
.search-chats:hover, .connection-button:hover { background: #ffffff0e; color: #fff; }
.search-chats kbd {
  margin-left: auto;
  padding: 2px 5px;
  color: #bbaecb;
  font: 550 10px/1.5 "DM Sans", sans-serif;
  border: 1px solid #ffffff20;
  border-radius: 5px;
  white-space: nowrap;
}

.history-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-top: 25px; scrollbar-width: thin; }
.history-group + .history-group { margin-top: 22px; }
.history-heading { margin: 0 0 9px; padding: 0 11px; color: #b5a8c4; font-size: 10px; font-weight: 750; letter-spacing: .115em; text-transform: uppercase; }
.history-row { display: flex; align-items: center; margin: 2px 0; border: 1px solid transparent; border-radius: 9px; }
.history-row:hover, .history-row:focus-within { background: #ffffff0c; }
.history-row.active { background: #ffffff14; border-color: #ffffff0d; }
.history-open {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  color: #ebe4f2;
  font-size: 13px;
  padding: 9px 5px 9px 10px;
}
.history-open .icon { width: 16px; height: 16px; color: #b9a8cf; }
.history-open span, #chat-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-menu {
  width: 28px;
  height: 28px;
  margin-right: 3px;
  opacity: 0;
  color: #cabbdc;
}
.history-menu .icon { width: 16px; height: 16px; }
.history-row:hover .history-menu, .history-row:focus-within .history-menu, .history-row.active .history-menu,
.history-menu:focus-visible { opacity: 1; }
.history-menu:hover { background: #ffffff17; color: #fff; }
.no-chats { padding: 0 11px; margin: 1px 0; font-size: 13px; color: #bdb0cb; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid #ffffff13; }
.connection-button { padding: 7px 7px; color: #f4eff9; border: 0; background: transparent; }
.connection-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  background: #ffffff13;
  color: #d0b8fe;
}
.connection-icon .icon { width: 19px; height: 19px; }
.connection-button-text { display: grid; gap: 2px; min-width: 0; }
.connection-button-text strong { font-size: 13px; font-weight: 650; }
.connection-button-text small { color: #bdb0cb; font-size: 11px; }
.connection-arrow { margin-left: auto; width: 16px; height: 16px; color: #9c8aae; }

.chat-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #faf9fc; }
.topbar {
  display: flex;
  flex: none;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 0 25px;
  border-bottom: 1px solid #ede8f1;
  background: #fdfcfe;
}
.page-title { display: flex; align-items: center; gap: 13px; min-width: 0; font-size: 14px; font-weight: 700; }
.topbar-rule { width: 1px; height: 19px; background: #e7e0ef; }
.sidebar-toggle { margin-left: -5px; }
.mode {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 29px;
  padding: 4px 11px;
  border: 1px solid #e8e0f0;
  border-radius: 20px;
  background: #f6f1fa;
  color: #544562;
  font-size: 11px;
  font-weight: 700;
}
.mode > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: #8f839c; }
.mode[data-mode="demo"] > span:first-child { background: #ba7923; box-shadow: 0 0 0 3px #f2e4d1; }
.mode[data-mode="live"] > span:first-child { background: #7253c7; box-shadow: 0 0 0 3px #e8dff7; }

.viewport { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.content-width { width: min(var(--content-width), calc(100% - 48px)); margin-inline: auto; }
.welcome { position: relative; isolation: isolate; width: min(var(--content-width), calc(100% - 48px)); text-align: center; margin: auto; padding: 36px 0 38px; }
.welcome-pattern {
  position: absolute;
  z-index: -1;
  inset: -58px -40px 2px;
  pointer-events: none;
  background-image: radial-gradient(circle, #b5a2d6 1px, transparent 1px), radial-gradient(ellipse at 50% 46%, #eae0fa, transparent 64%);
  background-size: 17px 17px, auto;
  mask-image: radial-gradient(ellipse at 50% 42%, #0004 0, transparent 66%);
}
.welcome-mark { display: grid; place-items: center; position: relative; width: 134px; height: 104px; margin: 0 auto 13px; }
.mark-orbit {
  position: absolute;
  inset: 8px 8px;
  border: 1px solid #e3d7f4;
  border-radius: 50%;
  transform: rotate(-23deg);
  width: 118px;
  height: 86px;
}
.mark-orbit::before, .mark-orbit::after {
  content: "";
  position: absolute;
  background: #aa88e9;
}
.mark-orbit::before { width: 6px; height: 6px; border-radius: 50%; top: 44px; right: -3px; }
.mark-orbit::after { width: 7px; height: 7px; border-radius: 1px; transform: rotate(45deg); left: 7px; bottom: 11px; background: #d0b9f1; }
.hero-icon {
  z-index: 1;
  width: 68px;
  height: 68px;
  border: 1px solid #a77bed;
  border-radius: 22px;
  box-shadow: inset 0 1px 0 #ffffff51, 0 9px 24px #7f51c94c;
}
.hero-icon .mark { width: 39px; height: 39px; }
.welcome h1 { margin: 0; font-size: clamp(36px, 5.25vw, 57px); font-weight: 750; letter-spacing: -.06em; line-height: 1.09; }
.welcome h1 em { color: var(--accent); font-style: normal; }
.welcome > p { margin: 13px 0 33px; font-size: 15px; color: var(--muted); }
.suggestions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; text-align: left; }
.suggestion {
  position: relative;
  padding: 14px;
  min-width: 0;
  min-height: 112px;
  border: 1px solid #e8e2ed;
  border-radius: 14px;
  background: #fff;
  color: inherit;
  box-shadow: 0 2px 3px #2f1a4105;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.suggestion:hover { transform: translateY(-3px); border-color: #cbb7eb; box-shadow: 0 8px 20px #54377c13; }
.suggestion-icon { display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 12px; border-radius: 8px; }
.suggestion-icon .icon { width: 17px; height: 17px; }
.suggestion-icon.violet { background: #efe7fb; color: #7346be; }
.suggestion-icon.mint { background: #e4f3ed; color: #23755b; }
.suggestion-icon.peach { background: #fbefde; color: #9a591e; }
.suggestion-icon.blue { background: #e9eefc; color: #4964a3; }
.suggestion-arrow { position: absolute; top: 16px; right: 13px; width: 14px; height: 14px; color: #8f819d; }
.suggestion:hover .suggestion-arrow { color: var(--accent); }
.suggestion strong, .suggestion small { display: block; overflow-wrap: anywhere; }
.suggestion strong { margin-bottom: 3px; font-size: 14px; font-weight: 750; letter-spacing: -.016em; }
.suggestion small { font-size: 12px; line-height: 1.3; color: var(--muted); }

.composer-area { flex: none; padding: 12px 0 max(22px, env(safe-area-inset-bottom)); }
.composer { background: #fff; padding: 11px 11px 10px 16px; border: 1px solid #ded5e8; border-radius: 18px; box-shadow: 0 5px 22px #3922530a, 0 2px 3px #39225305; }
.composer:focus-within { border-color: #ae98d7; box-shadow: 0 0 0 3px #ede5f7; }
.composer textarea {
  display: block;
  width: 100%;
  max-height: min(30vh, 230px);
  min-height: 39px;
  margin: 0;
  padding: 4px 4px 3px 0;
  field-sizing: content;
  resize: none;
  background: transparent;
  border: 0;
  outline: none;
  color: inherit;
  font-size: 15px;
  line-height: 1.5;
}
.composer textarea:focus-visible { outline: none; }
.composer textarea::placeholder { color: #797084; }
.composer-toolbar { display: flex; align-items: center; min-height: 37px; gap: 10px; }
.composer-hint, .composer-count { font-size: 11px; color: var(--muted); }
.composer-hint kbd { font: inherit; border: 1px solid #eae3ef; border-radius: 4px; background: #faf8fc; padding: 1px 4px; }
.composer-count { margin-inline-start: auto; }
.send-button {
  display: grid;
  place-items: center;
  margin-left: auto;
  width: 37px;
  height: 37px;
  padding: 0;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 2px 4px #50339120;
}
.composer-count:not([hidden]) + .send-button { margin-left: 0; }
.send-button:enabled:hover, .primary-button:hover { background: var(--accent-hover); }
.send-button:disabled { background: #d6c6ef; color: #4a2f77; box-shadow: none; }
.send-button .icon { width: 19px; height: 19px; stroke-width: 2; }
.composer-note { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 11px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.composer-note .icon { width: 13px; height: 13px; }

.conversation { padding: 34px 0 12px; }
.message { display: flex; gap: 13px; margin: 0 0 27px; min-width: 0; }
.message.user { justify-content: flex-end; }
.user-bubble { max-width: min(86%, 620px); padding: 12px 16px; border: 1px solid #e8dff4; border-radius: 17px 17px 5px 17px; background: #efe8f8; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-mark { width: 31px; height: 31px; border-radius: 9px; margin-top: 1px; flex: none; }
.assistant-mark .mark { width: 19px; height: 19px; }
.assistant-answer { min-width: 0; max-width: 100%; flex: 1; padding-top: 3px; }
.assistant-name { margin-bottom: 6px; font-size: 13px; font-weight: 750; }
.answer-text { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.answer-text.live-text { white-space: pre-wrap; }
.answer-text > :first-child { margin-top: 0; }
.answer-text > :last-child { margin-bottom: 0; }
.answer-text p { margin: 11px 0; white-space: pre-wrap; }
.answer-text h3, .answer-text h4 { margin: 14px 0 6px; font-size: 17px; line-height: 1.3; }
.answer-text ul, .answer-text ol { margin: 10px 0; padding-inline-start: 25px; }
.answer-text li + li { margin-top: 4px; }
.answer-text code { background: #eee9f4; border-radius: 4px; padding: 2px 4px; font-size: .9em; }
.answer-text pre { overflow: auto; padding: 12px; background: #eee9f4; border-radius: 8px; }
.answer-text pre code { padding: 0; background: transparent; }
.answer-actions { display: flex; align-items: center; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.answer-actions .icon-button { width: 28px; height: 28px; }
.answer-actions .icon { width: 15px; height: 15px; }
.thinking { color: var(--muted); }
.thinking::after { content: "…"; display: inline-block; animation: pulse 1.15s infinite alternate; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
.reply-error { display: flex; flex-wrap: wrap; gap: 7px 12px; align-items: center; margin: -6px 0 14px; padding: 10px 12px; border: 1px solid #eddbbd; border-radius: 10px; background: #fbf4e9; font-size: 13px; color: #704823; }
.reply-error button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: #704823; font-weight: 750; padding: 3px; border-radius: 4px; }
.reply-error button:hover { background: #f3e5d1; }
.reply-error .icon { width: 15px; height: 15px; }

dialog {
  width: min(470px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  border: 1px solid var(--border);
  border-radius: 19px;
  padding: 19px;
  background: #fff;
  color: inherit;
  box-shadow: 0 24px 80px #21152c3b;
}
dialog::backdrop { background: #1b142763; backdrop-filter: blur(3px); }
.dialog-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.dialog-title h2 { font-size: 19px; letter-spacing: -.037em; margin: 0; }
.dialog-close { width: 31px; height: 31px; }
.dialog-close .icon { width: 16px; height: 16px; }
.search-field { display: flex; align-items: center; gap: 8px; border: 1px solid #dcd2e8; border-radius: 10px; padding: 0 10px; color: var(--muted); }
.search-field:focus-within { outline: 2px solid #ab8fe3; outline-offset: 1px; }
.search-field input { min-width: 0; width: 100%; padding: 10px 1px; border: 0; outline: 0; color: #231b31; background: transparent; font-size: 14px; }
.search-field .icon { width: 17px; height: 17px; }
.search-results { max-height: min(440px, 50vh); overflow-y: auto; margin-top: 11px; }
.search-empty, .connection-details p, #delete-confirm p { font-size: 14px; line-height: 1.5; color: var(--muted); }
.search-result {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-bottom: 3px;
  padding: 10px 8px;
  background: #faf8fc;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
  color: #382a48;
  overflow-wrap: anywhere;
}
.search-result:hover { background: #efe7f8; }
.search-result .icon { width: 16px; height: 16px; color: var(--accent); }
.connection-details p:last-child { margin-bottom: 1px; }
.connection-details dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 12px 0; padding: 12px; background: #f7f3fb; border-radius: 9px; font-size: 13px; overflow-wrap: anywhere; }
.connection-details dt { color: var(--muted); }
.connection-details dd { margin: 0; font-weight: 650; }
.field-label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 7px; }
#rename-input { width: 100%; border: 1px solid #dcd2e8; border-radius: 9px; padding: 10px; color: inherit; }
.dialog-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }
.dialog-actions.end { justify-content: flex-end; }
.text-button, .primary-button { border: 0; border-radius: 8px; padding: 8px 12px; color: var(--muted); font-size: 13px; font-weight: 650; background: #f4eff8; }
.text-button:hover { background: #eae2f2; }
.primary-button { background: var(--accent); color: #fff; }
.danger-text { color: #a12f48; background: #fbeff2; }
.danger { background: #a12f48; }
.danger:hover { background: #882139; }
.toast { position: fixed; z-index: 3; left: 50%; bottom: 26px; transform: translateX(-50%); border-radius: 9px; padding: 9px 13px; background: #30213d; color: #fff; font-size: 13px; box-shadow: 0 4px 15px #2d1f3a29; }

@media (max-width: 1090px) {
  :root { --sidebar-width: 232px; }
  .suggestion { padding: 12px; }
}
@media (max-width: 850px) {
  .suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .suggestion { min-height: 88px; }
  .suggestion-icon { margin-bottom: 8px; }
  .welcome { padding-block: 23px; }
  .welcome > p { margin-bottom: 24px; }
}
@media (max-width: 720px) {
  :root { --sidebar-width: min(288px, 86vw); }
  .workspace, .workspace.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .workspace.sidebar-collapsed .sidebar {
    position: fixed;
    z-index: 2;
    inset: 0 auto 0 0;
    padding-top: max(25px, env(safe-area-inset-top));
    transform: translateX(-100%);
    visibility: hidden;
  }
  .workspace.sidebar-open .sidebar { transform: none; visibility: visible; }
  .workspace.sidebar-open .nav-scrim { display: block; position: fixed; z-index: 1; inset: 0; border: 0; background: #1a11295d; }
  .history-menu { opacity: 1; }
  .topbar { min-height: 57px; padding: 0 15px; }
  .content-width, .welcome { width: calc(100% - 32px); }
  .composer-area { padding-bottom: max(13px, env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 16px; }
  .conversation { padding-top: 24px; }
  .welcome-pattern { inset-inline: 0; }
}
@media (max-width: 390px) {
  .welcome { padding-block: 16px; }
  .welcome > p { font-size: 13px; }
  .composer-hint { display: none; }
}
@media (max-height: 650px) {
  .welcome { padding-block: 20px; }
  .welcome-mark { height: 76px; margin-bottom: 7px; }
  .mark-orbit { inset-block-start: -5px; }
  .hero-icon { width: 57px; height: 57px; border-radius: 17px; }
  .hero-icon .mark { width: 32px; height: 32px; }
  .welcome > p { margin-bottom: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.sign-in-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(ellipse at center, #efe6fa, #faf9fc 58%);
}
.sign-in-card {
  width: min(100%, 410px);
  padding: 34px;
  text-align: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 35px #3c245812;
}
.sign-in-card img { border-radius: 13px; }
.sign-in-card h1 { margin: 7px 0 22px; font-size: 32px; letter-spacing: -.06em; }
.sign-in-card h2 { margin: 0; font-size: 19px; letter-spacing: -.03em; }
.sign-in-card p { margin: 12px 0 22px; color: var(--muted); line-height: 1.5; }
.sign-in-button { display: inline-block; border-radius: 9px; background: var(--accent); color: white; padding: 10px 16px; text-decoration: none; font-weight: 650; }
.sign-in-button:hover { background: var(--accent-hover); }
