.chat-app {
  display: grid;
  width: 100%;
  min-height: 100vh;
  grid-template-columns: 252px minmax(0, 1fr);
  background: #0d0f15;
}

.chat-sidebar {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 24px 15px 14px;
  border-right: 1px solid var(--border);
  background: #101219;
}

.sidebar-brand {
  margin: 1px 0 27px 5px;
}

.sidebar-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.sidebar-brand .brand-name {
  font-size: 19px;
}

.new-chat-btn {
  display: flex;
  width: 100%;
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.095);
  border-radius: 10px;
  background: #171922;
  color: #e2e1e9;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 150ms ease, border-color 150ms ease;
}

.new-chat-btn:hover {
  border-color: rgba(155, 140, 255, 0.28);
  background: #1c1e29;
}

.new-chat-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #aaa1d9;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.shortcut {
  margin-left: auto;
  color: #707382;
  font-size: 10px;
  font-weight: 500;
}

.sidebar-section {
  margin-top: 31px;
}

.sidebar-label {
  padding: 0 10px;
  color: #6e707d;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.35px;
}

.sidebar-item {
  display: flex;
  height: 39px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 0 10px;
  border-radius: 8px;
  color: #b5b6c2;
  font-size: 11px;
}

.sidebar-item.active {
  background: rgba(155, 140, 255, 0.11);
  color: #d5cdff;
}

.sidebar-item svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.sidebar-tip {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(155, 140, 255, 0.12);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(121, 99, 220, 0.11), rgba(49, 44, 78, 0.08));
}

.tip-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(179, 164, 255, 0.15);
  border-radius: 8px;
  background: rgba(155, 140, 255, 0.12);
  color: #b4a5ff;
}

.sidebar-tip p {
  margin: 12px 0 5px;
  color: #c7c4d4;
  font-size: 11px;
  line-height: 1.65;
}

.sidebar-tip p strong {
  color: #f0eef8;
}

.tip-caption {
  color: #898795;
  font-size: 9px;
}

.sidebar-profile {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  padding: 12px 2px 1px;
  border-top: 1px solid var(--border);
}

.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid rgba(191, 180, 255, 0.2);
  border-radius: 11px;
  background: linear-gradient(145deg, #6656bd, #3c375c);
  color: #f0edff;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.profile-copy strong {
  overflow: hidden;
  color: #e8e7ef;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email {
  overflow: hidden;
  color: #777986;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #888a97;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #f0a0a6;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.chat-main {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 36%, rgba(74, 66, 131, 0.08), transparent 43%),
    #0d0f15;
}

.chat-topbar {
  display: flex;
  height: 60px;
  flex: 0 0 60px;
  align-items: center;
  justify-content: space-between;
  padding: 0 27px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 16, 22, 0.72);
}

.model-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #d8d7e0;
  font-size: 11px;
  font-weight: 600;
}

.model-status {
  width: 6px;
  height: 6px;
  flex-basis: 6px;
}

.model-chevron {
  margin-left: 1px;
  color: #858795;
  font-size: 15px;
}

.topbar-caption {
  color: #717381;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.mobile-brand {
  display: none;
}

.chat-window {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 24px 24px;
  scrollbar-color: #353644 transparent;
  scrollbar-width: thin;
}

.chat-window::-webkit-scrollbar {
  width: 6px;
}

.chat-window::-webkit-scrollbar-thumb {
  border-radius: 20px;
  background: #353644;
}

.welcome-state {
  width: min(100%, 660px);
  margin: auto;
  padding: 22px 0 38px;
  animation: rise-in 420ms ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-symbol {
  display: grid;
  width: 47px;
  height: 47px;
  place-items: center;
  margin-bottom: 23px;
  border: 1px solid rgba(179, 164, 255, 0.15);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(130, 108, 244, 0.19), rgba(69, 60, 119, 0.2));
  box-shadow: 0 12px 40px rgba(90, 74, 192, 0.12);
}

.welcome-symbol img {
  width: 27px;
  height: 27px;
  border-radius: 8px;
}

.welcome-eyebrow {
  font-size: 9px;
  letter-spacing: 1.45px;
}

.welcome-state h1 {
  margin: 13px 0 10px;
  color: #f2f0f8;
  font-family: "Manrope", "DM Sans", sans-serif;
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.16;
}

.welcome-state > p {
  margin: 0;
  color: #9799a6;
  font-size: 13px;
  line-height: 1.7;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 29px;
}

.prompt-card {
  display: flex;
  min-width: 0;
  min-height: 70px;
  align-items: center;
  gap: 11px;
  padding: 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 12px;
  background: rgba(24, 26, 35, 0.75);
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.prompt-card:hover {
  transform: translateY(-2px);
  border-color: rgba(155, 140, 255, 0.34);
  background: #1b1d29;
}

.prompt-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
}

.prompt-violet {
  background: rgba(154, 133, 255, 0.13);
  color: #b7a9ff;
}

.prompt-blue {
  background: rgba(89, 153, 242, 0.14);
  color: #92bbff;
}

.prompt-green {
  background: rgba(86, 191, 138, 0.13);
  color: #89ddb0;
}

.prompt-orange {
  background: rgba(230, 159, 97, 0.13);
  color: #f0b77f;
}

.prompt-card > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}

.prompt-card strong {
  color: #dedce7;
  font-size: 10px;
  font-weight: 700;
}

.prompt-card small {
  overflow: hidden;
  color: #9294a0;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-card > svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: #747785;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.chat-composer-area {
  width: min(100%, 760px);
  align-self: center;
  padding: 0 24px 14px;
}

.composer {
  padding: 12px 12px 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 17px;
  background: #171922;
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.2);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: rgba(155, 140, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(155, 140, 255, 0.07), 0 14px 45px rgba(0, 0, 0, 0.2);
}

#chat-input {
  display: block;
  width: 100%;
  max-height: 170px;
  min-height: 28px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #eeedf4;
  font-size: 13px;
  line-height: 1.55;
  overflow-y: auto;
}

#chat-input::placeholder {
  color: #777a88;
}

#chat-input:focus-visible {
  outline: 0;
}

.composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.composer-hint {
  color: #737582;
  font-size: 9px;
}

.composer-hint kbd {
  padding: 2px 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: #20222c;
  color: #9a9ca8;
  font-family: inherit;
  font-size: 8px;
}

.composer-hint > span {
  margin: 0 3px;
  color: #51535e;
}

.send-btn {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(145deg, #8d7cf2, #705bd7);
  color: white;
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.send-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.13);
}

.send-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.send-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.disclaimer {
  margin: 9px 0 0;
  color: #676a77;
  font-size: 9px;
  text-align: center;
}

.typing {
  display: flex;
  height: 25px;
  align-items: center;
  gap: 4px;
  padding-left: 4px;
  color: #9b9daa;
  font-size: 10px;
}

.typing > span:not(:last-child) {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing-pulse 1s ease-in-out infinite;
}

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

.typing > span:nth-child(3) {
  margin-right: 5px;
  animation-delay: 240ms;
}

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

.message-meta {
  width: min(100%, 720px);
  align-self: center;
  margin: 16px 0 7px;
  color: #858794;
  font-size: 10px;
}

.message-row {
  display: flex;
  width: min(100%, 720px);
  align-self: center;
  margin-bottom: 10px;
  animation: rise-in 220ms ease both;
}

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

.message-row.assistant {
  justify-content: flex-start;
}

.message-bubble {
  max-width: min(85%, 620px);
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: #e6e5ed;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-row.user .message-bubble {
  border-color: rgba(158, 142, 255, 0.19);
  border-bottom-right-radius: 5px;
  background: linear-gradient(140deg, rgba(108, 89, 201, 0.35), rgba(87, 75, 151, 0.25));
  color: #f1efff;
}

.message-row.assistant .message-bubble {
  border-bottom-left-radius: 5px;
  background: #171922;
}

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

.message-bubble p:last-child,
.message-bubble ul:last-child,
.message-bubble ol:last-child,
.message-bubble .code-block:last-child {
  margin-bottom: 0;
}

.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5 {
  margin: 5px 0 9px;
  color: #f0eef8;
  font-family: "Manrope", "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.message-bubble ul,
.message-bubble ol {
  display: grid;
  gap: 5px;
  margin: 0 0 10px;
  padding-left: 21px;
}

.message-bubble li {
  padding-left: 2px;
}

.message-bubble a {
  color: #b6a9ff;
  text-decoration: underline;
  text-decoration-color: rgba(182, 169, 255, 0.45);
  text-underline-offset: 3px;
}

.message-bubble code {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 5px;
  background: rgba(9, 11, 17, 0.68);
  color: #c8bcff;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.9em;
}

.code-block {
  max-width: 100%;
  margin: 9px 0 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.095);
  border-radius: 11px;
  background: #0e1017;
}

.code-block-header {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
  color: #9294a3;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
}

.copy-code-btn {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  background: #1a1c26;
  color: #b7b8c4;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 9px;
  transition: background 140ms ease, color 140ms ease;
}

.copy-code-btn:hover {
  background: #242633;
  color: #f1efff;
}

.code-block pre {
  max-width: 100%;
  margin: 0;
  padding: 13px 14px;
  overflow-x: auto;
  color: #e4e2ed;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  line-height: 1.65;
  tab-size: 2;
}

.code-block pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

@media (max-width: 850px) {
  .chat-app {
    grid-template-columns: 214px minmax(0, 1fr);
  }

  .chat-sidebar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .prompt-card {
    gap: 8px;
    padding: 10px;
  }
}

@media (max-width: 650px) {
  .chat-app {
    min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .chat-sidebar {
    z-index: 2;
    min-height: 58px;
    height: 58px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-brand {
    margin: 0;
  }

  .sidebar-brand .brand-mark {
    width: 31px;
    height: 31px;
  }

  .sidebar-brand .brand-name {
    font-size: 17px;
  }

  .new-chat-btn,
  .sidebar-section,
  .sidebar-tip {
    display: none;
  }

  .sidebar-profile {
    width: auto;
    gap: 7px;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .user-avatar {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
    border-radius: 9px;
    font-size: 10px;
  }

  .profile-copy {
    max-width: min(42vw, 185px);
  }

  .logout-btn {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
  }

  .chat-main {
    height: calc(100dvh - 58px);
    min-height: 0;
  }

  .chat-topbar {
    display: none;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-brand .brand-mark {
    width: 27px;
    height: 27px;
    border-radius: 8px;
  }

  .mobile-brand .brand-name {
    font-size: 16px;
  }

  .chat-window {
    padding: 15px 17px 18px;
  }

  .welcome-state {
    padding: 20px 0 28px;
  }

  .welcome-symbol {
    width: 41px;
    height: 41px;
    margin-bottom: 18px;
  }

  .welcome-state h1 {
    font-size: 35px;
    letter-spacing: -1.6px;
  }

  .welcome-state > p {
    font-size: 12px;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 21px;
  }

  .prompt-card {
    min-height: 59px;
    padding: 9px 11px;
  }

  .prompt-icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .chat-composer-area {
    padding: 0 12px max(10px, env(safe-area-inset-bottom));
  }

  .composer {
    padding: 10px 10px 8px 13px;
    border-radius: 15px;
  }

  #chat-input {
    font-size: 16px;
  }

  .composer-hint {
    font-size: 0;
  }

  .composer-hint kbd {
    font-size: 8px;
  }

  .composer-hint > span,
  .composer-hint kbd:nth-of-type(2) {
    display: none;
  }

  .disclaimer {
    padding: 0 5px;
    font-size: 8px;
    line-height: 1.5;
  }

  .message-meta,
  .message-row {
    width: 100%;
  }

  .message-bubble {
    max-width: 92%;
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .profile-copy {
    max-width: 34vw;
  }

  .chat-sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }
}
