:root {
  --bg: #eef4fb;
  --surface: #ffffff;
  --surface-soft: #f6f9fd;
  --line: #dce5f0;
  --line-strong: #ccd8e7;
  --text: #101827;
  --muted: #617089;
  --blue: #4e84f5;
  --blue-soft: #e7f0ff;
  --green: #12a57a;
  --violet: #7758d8;
  --orange: #ec8a34;
  --pink: #e14f8d;
  --shadow: 0 18px 45px rgba(35, 55, 83, 0.08);
  --soft-shadow: 0 10px 24px rgba(31, 49, 75, 0.06);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(78, 132, 245, 0.26);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
}

.workspace-view {
  width: min(1120px, calc(100vw - 80px));
  padding: 48px 0 64px;
  margin-left: clamp(28px, 4vw, 52px);
}

.welcome {
  margin-bottom: 52px;
}

.welcome p {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: clamp(32px, 3.2vw, 40px);
  line-height: 1.2;
  font-weight: 500;
}

.welcome h1 {
  margin: 0;
  font-size: clamp(34px, 3.2vw, 40px);
  line-height: 1.22;
  font-weight: 500;
  letter-spacing: 0;
}

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.composer-large {
  width: min(836px, 100%);
  min-height: 130px;
  border-radius: 32px;
  padding: 18px 20px 10px;
}

.chat-composer {
  min-height: 118px;
  border-radius: 24px;
  padding: 14px 16px 10px;
  box-shadow: var(--soft-shadow);
}

.composer textarea {
  width: 100%;
  min-height: 46px;
  padding: 0;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 16px;
  line-height: 1.6;
}

.composer textarea::placeholder {
  color: #7b889e;
}

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button,
.tool-button,
.model-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  color: var(--text);
  background: transparent;
  border-radius: 12px;
}

.icon-button:hover,
.tool-button:hover,
.model-button:hover {
  background: var(--surface-soft);
}

.tool-button {
  gap: 8px;
  padding: 0 10px;
  color: #18243a;
}

.model-button {
  gap: 8px;
  padding: 0 8px 0 12px;
  white-space: nowrap;
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #c6cfdd;
  transition: transform 160ms ease, background 160ms ease;
}

.send-button:hover {
  background: var(--blue);
  transform: translateY(-1px);
}

.plus-icon,
.branch-icon,
.mic-icon,
.chevron-icon,
.send-icon,
.back-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
}

.plus-icon {
  width: 14px;
  height: 14px;
}

.plus-icon::before,
.plus-icon::after {
  position: absolute;
  content: "";
  background: #334155;
  border-radius: 4px;
}

.plus-icon::before {
  top: 6px;
  left: 1px;
  width: 12px;
  height: 2px;
}

.plus-icon::after {
  top: 1px;
  left: 6px;
  width: 2px;
  height: 12px;
}

.branch-icon {
  width: 14px;
  height: 18px;
  border-left: 2px solid #334155;
  border-radius: 8px 0 0 8px;
}

.branch-icon::before,
.branch-icon::after {
  position: absolute;
  content: "";
  width: 5px;
  height: 5px;
  border: 2px solid #334155;
  border-radius: 50%;
  background: var(--surface);
}

.branch-icon::before {
  top: 0;
  left: 4px;
}

.branch-icon::after {
  right: -1px;
  bottom: 0;
}

.mic-icon {
  width: 12px;
  height: 18px;
  border: 2px solid #526075;
  border-radius: 8px;
}

.mic-icon::before {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 8px;
  content: "";
  border-bottom: 2px solid #526075;
  border-left: 2px solid #526075;
  border-right: 2px solid #526075;
  border-radius: 0 0 8px 8px;
  transform: translateX(-50%);
}

.chevron-icon {
  width: 7px;
  height: 7px;
  border-right: 2px solid #6b7586;
  border-bottom: 2px solid #6b7586;
  transform: rotate(45deg) translateY(-2px);
}

.send-icon {
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 19px solid #ffffff;
  transform: translateX(2px);
}

.section-block {
  margin-top: 66px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.compact-heading {
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0;
}

.text-button {
  height: 28px;
  padding: 0 6px;
  color: #2f6df6;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
}

.text-button:hover {
  background: var(--blue-soft);
}

.my-agent-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 238px));
  gap: 12px;
}

.my-agent-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 12px 14px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(31, 49, 75, 0.04);
}

.my-agent-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.agent-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 36px;
  padding: 0 10px;
  color: #18243a;
  background: var(--blue-soft);
  border-radius: 10px;
}

.create-agent .agent-tag {
  min-width: 36px;
}

.tools-section {
  margin-top: 118px;
}

.document-icon {
  position: relative;
  width: 18px;
  height: 22px;
  border: 2px solid #f0a25a;
  border-radius: 3px;
  background: #ffffff;
}

.document-icon::before,
.document-icon::after {
  position: absolute;
  left: 4px;
  content: "";
  width: 8px;
  height: 2px;
  background: #7fb5ff;
  border-radius: 2px;
}

.document-icon::before {
  top: 5px;
}

.document-icon::after {
  top: 10px;
  background: #f0a25a;
}

.count-pill {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  color: #50647e;
  font-size: 13px;
  line-height: 24px;
  text-align: center;
  background: #eaf1fb;
  border-radius: 999px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
}

.tool-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  padding: 18px 14px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(31, 49, 75, 0.04);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tool-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--soft-shadow);
  transform: translateY(-2px);
}

.tool-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  background: var(--blue-soft);
  border-radius: 10px;
}

.tool-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0;
}

.tool-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #526075;
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.icon-sparkles::before,
.icon-sparkles::after,
.icon-target::before,
.icon-target::after,
.icon-users::before,
.icon-users::after,
.icon-chart::before,
.icon-chart::after,
.icon-search::before,
.icon-search::after,
.icon-rocket::before,
.icon-rocket::after {
  position: absolute;
  content: "";
}

.icon-sparkles::before {
  width: 15px;
  height: 15px;
  background: var(--blue);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.icon-sparkles::after {
  right: 7px;
  bottom: 8px;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
}

.icon-target::before {
  width: 19px;
  height: 19px;
  border: 3px solid #ff4968;
  border-radius: 50%;
}

.icon-target::after {
  width: 7px;
  height: 7px;
  background: var(--blue);
  border-radius: 50%;
}

.icon-users::before {
  width: 21px;
  height: 10px;
  bottom: 9px;
  background: var(--violet);
  border-radius: 10px 10px 4px 4px;
}

.icon-users::after {
  top: 8px;
  width: 18px;
  height: 9px;
  background: var(--violet);
  border-radius: 9px 9px 0 0;
}

.icon-chart::before {
  bottom: 8px;
  left: 9px;
  width: 4px;
  height: 11px;
  background: #27c7d8;
  box-shadow: 7px -5px 0 var(--pink), 14px 2px 0 #34d399;
}

.icon-chart::after {
  right: 8px;
  bottom: 7px;
  left: 8px;
  height: 2px;
  background: #c7d5e8;
}

.icon-search::before {
  width: 14px;
  height: 14px;
  border: 4px solid #2c7df1;
  border-radius: 50%;
}

.icon-search::after {
  right: 7px;
  bottom: 7px;
  width: 10px;
  height: 4px;
  background: var(--violet);
  border-radius: 4px;
  transform: rotate(45deg);
}

.icon-rocket::before {
  width: 18px;
  height: 24px;
  background: #ff4968;
  border-radius: 50% 50% 45% 45%;
  transform: rotate(42deg);
}

.icon-rocket::after {
  left: 10px;
  bottom: 7px;
  width: 9px;
  height: 9px;
  background: var(--orange);
  border-radius: 50%;
}

.chat-view {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.conversation-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.62);
  border-right: 1px solid var(--line);
}

.panel-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.back-icon {
  width: 10px;
  height: 10px;
  border-left: 2px solid #334155;
  border-bottom: 2px solid #334155;
  transform: rotate(45deg) translateX(2px);
}

.conversation-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 64px;
  padding: 12px;
  color: var(--text);
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.conversation-item small {
  color: var(--muted);
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 100vh;
  padding: 28px 36px 24px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
}

.agent-avatar {
  width: 44px;
  height: 44px;
  background: var(--blue-soft);
  border-radius: 14px;
}

.chat-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0;
}

.chat-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.message-list {
  min-height: 0;
  padding: 10px 0;
  overflow: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100%;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0;
}

.empty-state p {
  margin: 0;
}

.message {
  display: flex;
  margin: 14px 0;
}

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

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

.message-bubble {
  max-width: min(680px, 78%);
  padding: 13px 16px;
  font-size: 15px;
  line-height: 1.6;
  border-radius: 16px;
}

.message.user .message-bubble {
  color: #ffffff;
  background: var(--blue);
  border-bottom-right-radius: 5px;
}

.message.assistant .message-bubble {
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 14px;
  color: #ffffff;
  background: #152033;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1040px) {
  .tool-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 760px) {
  .workspace-view {
    width: calc(100vw - 32px);
    padding-top: 32px;
    margin: 0 auto;
  }

  .welcome {
    margin-bottom: 34px;
  }

  .composer-large {
    border-radius: 24px;
  }

  .composer-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-right {
    justify-content: space-between;
  }

  .my-agent-row,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tools-section {
    margin-top: 72px;
  }

  .chat-view {
    grid-template-columns: 1fr;
  }

  .conversation-panel {
    display: none;
  }

  .chat-main {
    padding: 18px 16px;
  }

  .message-bubble {
    max-width: 90%;
  }
}
