body {
  overflow: hidden;
  background: #fff;
}

.app-header {
  width: 100%;
  height: 76px;
  padding: 0 26px;
  position: relative;
  z-index: 20;
  border-bottom: 1px solid #e5e8eb;
  background: #fff;
  backdrop-filter: none;
}

.brand {
  gap: 11px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 22px;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 3px;
  color: #6f798b;
  font-size: 9px;
  letter-spacing: 0.02em;
}

.header-meta {
  gap: 10px;
}

.header-action {
  min-width: 82px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid #d5d9e6;
  border-radius: 6px;
  color: #3f50b8;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.header-action:hover {
  border-color: #5969e7;
  background: #f6f7ff;
}

.settings-button {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-color: #dde1e8;
  border-radius: 8px;
  color: #58606f;
  background: #fff;
}

.settings-button span {
  display: none;
}

.app-shell {
  width: 100%;
  height: calc(100vh - 76px);
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
}

.app-shell::before,
.app-shell::after {
  content: none;
}

.history-panel {
  min-height: 0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e8ec;
  background: #fff;
}

.history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-title strong {
  font-size: 16px;
}

.history-title span {
  color: #9aa1ad;
  font-size: 10px;
}

.new-chat-button {
  height: 42px;
  margin-top: 18px;
  border: 1px solid #b9c5ff;
  border-radius: 7px;
  color: #3f53cd;
  background: #f4f6ff;
  font-size: 12px;
  font-weight: 600;
}

.new-chat-button:hover {
  background: #ecefff;
}

.session-list {
  max-height: 265px;
  margin: 12px -4px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
}

.session-item {
  width: 100%;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #59616e;
  background: transparent;
  text-align: left;
}

.session-item:hover {
  border-color: #e1e5ef;
  background: #f7f8fc;
}

.session-item.is-active {
  border-color: #d9dfff;
  color: #3341a6;
  background: #f1f3ff;
}

.session-item span {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item small {
  flex: none;
  color: #9aa2b0;
  font-size: 9px;
}

.history-title-current {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #edf0f5;
}

.history-empty {
  margin-top: 24px;
  color: #9199a6;
  text-align: center;
}

.history-empty span {
  font-size: 12px;
}

.history-empty p {
  margin: 8px 15px 0;
  font-size: 9px;
  line-height: 1.7;
}

.history-list {
  min-height: 0;
  margin: 16px -4px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
}

.history-item {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #59616e;
  background: transparent;
  text-align: left;
}

.history-item:hover {
  border-color: #e1e5ef;
  background: #f7f8fc;
}

.history-item.is-active {
  border-color: #d9dfff;
  color: #3341a6;
  background: #f1f3ff;
}

.history-item span,
.history-item p {
  display: block;
}

.history-item span {
  color: #9aa2b0;
  font-size: 8px;
}

.history-item p {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  display: block;
  align-items: initial;
  position: relative;
  background:
    radial-gradient(circle at 82% 8%, rgba(215, 233, 255, 0.74), transparent 30rem),
    radial-gradient(circle at 52% 7%, rgba(234, 235, 255, 0.8), transparent 25rem),
    linear-gradient(180deg, #f8faff 0%, #fbfcff 52%, #fff 100%);
}

.chat-home {
  width: min(1180px, calc(100% - 72px));
  margin: 0 auto;
  padding-top: clamp(34px, 7vh, 82px);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
}

.chat-panel.has-conversation .chat-home {
  display: none;
}

.home-agent-avatar {
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid #d6e2ed;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.27), transparent 38%),
    linear-gradient(145deg, #25a7d9 0%, #6975e7 58%, #e58ac6 100%);
  box-shadow: 0 14px 36px rgba(84, 110, 165, 0.18);
  font-family: "STSong", "Songti SC", serif;
  font-size: 48px;
}

.home-agent-avatar::after {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 15px;
}

.chat-home h1 {
  margin: 25px 0 0;
  color: #14171e;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.home-description {
  width: min(1120px, 100%);
  margin-top: 46px;
  padding: 23px 28px;
  border-radius: 18px;
  color: #20232b;
  background: #e7edf5;
}

.home-description p {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.8;
}

.home-prompts {
  width: min(720px, 100%);
  display: grid;
  gap: 17px;
  margin-top: 26px;
}

.home-prompts button {
  min-height: 58px;
  padding: 12px 18px;
  border: 1px solid #e1e5ed;
  border-radius: 17px;
  color: #20232b;
  background: #fff;
  box-shadow: 0 2px 5px rgba(22, 36, 65, 0.03);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  transition: 150ms ease;
}

.home-prompts button:hover {
  border-color: #aebaff;
  background: #fafbff;
  transform: translateY(-1px);
}

.chat-log {
  width: min(1120px, calc(100% - 72px));
  max-height: none;
  min-height: 0;
  margin: 0;
  padding: 34px 8px 150px;
  position: absolute;
  inset: 0 auto 0 50%;
  display: none;
  overflow-y: auto;
  transform: translateX(-50%);
}

.chat-panel.has-conversation .chat-log {
  display: block;
}

.message {
  width: min(78%, 760px);
}

.message.is-agent .message-bubble {
  border-color: #e3e7ee;
  background: #fff;
  box-shadow: 0 7px 20px rgba(37, 55, 84, 0.055);
}

.message.is-user .message-bubble {
  border-color: #5667d7;
  background: #5264d3;
}

.message-meta {
  color: #8a929f;
  text-shadow: none;
}

.quick-replies {
  width: min(1120px, calc(100% - 72px));
  min-height: 0;
  padding: 0 8px 113px;
  position: absolute;
  left: 50%;
  bottom: 0;
  display: none;
  transform: translateX(-50%);
}

.chat-panel.has-conversation .quick-replies,
.chat-panel.has-conversation .quick-replies:empty {
  display: flex;
}

.quick-reply {
  border-color: #dbe1ed;
  background: #fff;
}

.composer {
  width: min(1120px, calc(100% - 72px));
  position: absolute;
  left: 50%;
  bottom: 42px;
  z-index: 6;
  transform: translateX(-50%);
  border: 1px solid #dce1ea;
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 6px 22px rgba(36, 54, 82, 0.07);
}

.composer-tool {
  width: 44px;
  height: 44px;
  margin-left: 4px;
  border: 1px solid #e4e8ef;
  border-radius: 50%;
  color: #6b7484;
  background: #fff;
}

.attachment-tray {
  width: min(1120px, calc(100% - 72px));
  min-height: 0;
  padding: 8px;
  position: absolute;
  left: 50%;
  bottom: 103px;
  z-index: 7;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid rgba(216, 225, 236, 0.92);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(28, 48, 75, 0.08);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.attachment-chip {
  min-width: 132px;
  max-width: 220px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  border: 1px solid #e1e6ed;
  border-radius: 9px;
  background: #f8fafb;
}

.attachment-chip img,
.attachment-file-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 6px;
  background: #e8f2ec;
}

.attachment-file-icon {
  display: grid;
  place-items: center;
  color: var(--green);
  font-size: 8px;
  font-weight: 800;
}

.attachment-chip strong {
  display: block;
  overflow: hidden;
  color: #45515f;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip small {
  display: block;
  margin-top: 2px;
  color: #99a2ae;
  font-size: 8px;
}

.attachment-remove {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  color: #a44a43;
  background: #ffebe9;
  font-size: 12px;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.message-attachment {
  max-width: 180px;
  padding: 4px 7px;
  border-radius: 7px;
  color: #53616d;
  background: rgba(255, 255, 255, 0.18);
  font-size: 9px;
  text-decoration: none;
}

.message.is-agent .message-attachment {
  background: #edf3ef;
}

.message-attachment img {
  width: 100%;
  max-height: 130px;
  display: block;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 4px;
}

.send-button {
  width: 57px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #7b91ff;
}

.send-button span {
  display: none;
}

.composer-note {
  position: absolute;
  left: 50%;
  bottom: 17px;
  z-index: 5;
  color: #a4aab3;
  transform: translateX(-50%);
  white-space: nowrap;
  text-shadow: none;
}

.profile-panel {
  top: 76px;
  height: calc(100vh - 76px);
}

.profile-panel.is-fullscreen {
  width: 100vw;
  height: 100vh;
  top: 0;
  z-index: 100;
  padding: 28px clamp(20px, 4vw, 56px);
  border: 0;
  border-radius: 0;
  transform: none;
}

.profile-panel.is-fullscreen .browser-stage {
  height: calc(100vh - 285px);
  min-height: 420px;
}

.profile-panel.is-fullscreen .profile-header,
.profile-panel.is-fullscreen .workspace-switch,
.profile-panel.is-fullscreen .browser-toolbar,
.profile-panel.is-fullscreen .browser-controls,
.profile-panel.is-fullscreen .browser-input-row,
.profile-panel.is-fullscreen .browser-hint {
  width: min(1280px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.operation-auth {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 28px 90px rgba(22, 32, 54, 0.25);
}

.operation-auth::backdrop {
  background: rgba(18, 25, 41, 0.46);
  backdrop-filter: blur(4px);
}

.operation-auth-card {
  padding: 25px;
}

.operation-auth-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: #5264d3;
  font-size: 18px;
}

.operation-auth h2 {
  margin: 15px 0 0;
  font-size: 19px;
}

.operation-auth p {
  margin: 8px 0 16px;
  color: #7a8492;
  font-size: 10px;
  line-height: 1.7;
}

.operation-auth input {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid #d8dfea;
  border-radius: 9px;
  outline: none;
}

.operation-auth input:focus {
  border-color: #6577de;
  box-shadow: 0 0 0 3px rgba(82, 100, 211, 0.1);
}

.operation-auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.message-menu {
  width: 156px;
  padding: 6px;
  position: fixed;
  z-index: 200;
  border: 1px solid #dfe3ea;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(27, 39, 60, 0.18);
}

.message-menu button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: #525a68;
  background: transparent;
  text-align: left;
  font-size: 10px;
}

.message-menu button:hover {
  background: #f5f6fa;
}

.message-menu button[data-message-action="turn"] {
  color: #ba4841;
}

.workspace-backdrop {
  inset: 76px 0 0;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .history-panel {
    display: none;
  }

  .chat-home {
    width: calc(100% - 44px);
  }
}

@media (max-width: 640px) {
  .app-header {
    height: 66px;
    padding: 0 14px;
  }

  .app-shell {
    height: calc(100vh - 66px);
  }

  .brand strong {
    font-size: 13px;
  }

  .brand small {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 19px;
  }

  .header-meta {
    gap: 6px;
  }

  .header-action {
    display: none;
  }

  .chat-home {
    width: calc(100% - 28px);
    padding-top: 38px;
  }

  .home-agent-avatar {
    width: 88px;
    height: 88px;
    border-radius: 18px;
    font-size: 38px;
  }

  .chat-home h1 {
    margin-top: 18px;
    font-size: 26px;
    text-align: center;
  }

  .home-description {
    margin-top: 28px;
    padding: 17px;
    border-radius: 15px;
  }

  .home-description p {
    font-size: 12px;
    line-height: 1.75;
  }

  .home-prompts {
    gap: 10px;
    margin-top: 18px;
  }

  .home-prompts button {
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 11px;
  }

  .chat-log {
    width: 100%;
    padding: 20px 14px 142px;
  }

  .message {
    width: 90%;
  }

  .quick-replies {
    width: 100%;
    padding: 0 14px 107px;
  }

  .composer {
    width: calc(100% - 28px);
    bottom: 38px;
    border-radius: 16px;
  }

  .composer-tool {
    width: 34px;
    height: 34px;
  }

  .attachment-tray {
    width: calc(100% - 28px);
    bottom: 98px;
  }

  .send-button {
    width: 45px;
    height: 42px;
  }

  .composer-note {
    bottom: 15px;
    font-size: 8px;
  }

  .profile-panel {
    top: 66px;
    height: calc(100vh - 66px);
  }
}
