/* ==========================================================================
 * /agent
 * Two-mode conversational agent: text-to-image and daily office writing.
 * ========================================================================== */

body[data-page="agent"] {
  --agent-ink: #102033;
  --agent-muted: #68798d;
  --agent-surface: rgba(255, 255, 255, 0.92);
  --agent-accent: #146fe8;
  --agent-cyan: #0aa8ba;
  --agent-violet: #7359d6;
  --agent-rose: #d95686;
  --agent-gold: #d69a2d;
  --agent-accent-soft: #edf6ff;
  --agent-teal-soft: #eaf9f8;
  --agent-surface-background: #f4f8fc;
}

body[data-page="agent"] .app-shell {
  background: var(--agent-surface-background);
}

body[data-page="agent"] .home-footer {
  display: none;
}

body[data-page="agent"] .app-main,
.page-agent {
  background-color: var(--agent-surface-background);
  background-image:
    radial-gradient(ellipse 58% 46% at 3% 10%, rgba(10, 168, 186, .2), transparent 74%),
    radial-gradient(ellipse 52% 44% at 98% 16%, rgba(217, 86, 134, .17), transparent 75%),
    radial-gradient(ellipse 54% 38% at 18% 96%, rgba(20, 111, 232, .16), transparent 78%),
    radial-gradient(ellipse 48% 42% at 84% 94%, rgba(115, 89, 214, .18), transparent 76%),
    linear-gradient(128deg, #f6fbfd 0%, #eef4ff 52%, #faf5fa 100%);
  background-position: center;
  background-size: 100% 100%;
}

.page-agent {
  max-width: none;
  min-height: auto;
}

.page-agent.container-fluid {
  padding: 0 !important;
}

body[data-page="agent"] .page-shell.page-agent {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.agent-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

@media (min-width: 901px) {
  body[data-page="agent"] {
    --agent-topbar-height: 64px;
    height: 100dvh;
    overflow: hidden;
  }

  body[data-page="agent"] .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body[data-page="agent"] .app-main {
    box-sizing: border-box;
    flex: 0 0 100dvh;
    height: 100dvh;
    min-height: 0;
    margin-top: 0;
    overflow: hidden;
    padding: var(--agent-topbar-height) 0 0 !important;
  }

  body[data-page="agent"] .page-agent {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    animation: none;
    transform: none;
  }

  body[data-page="agent"] .agent-shell {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding-block: clamp(18px, 2.6vh, 32px);
  }

  body[data-page="agent"] .agent-shell.is-entry,
  body[data-page="agent"] .agent-shell.is-workbench {
    padding-right: clamp(16px, 4vw, 56px);
    padding-left: 12px;
  }

  body[data-page="agent"] .agent-buddy {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    gap: clamp(10px, 1.5vh, 18px);
  }
}

.agent-shell {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: auto;
  padding: clamp(34px, 6vh, 76px) clamp(16px, 4vw, 56px);
  display: grid;
  place-items: start center;
  background: transparent;
}

.agent-buddy {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding-top: clamp(18px, 3vh, 42px);
}

.agent-buddy.is-initializing {
  visibility: hidden;
}

.agent-buddy > * {
  position: relative;
  z-index: 1;
}

.agent-mascot {
  position: relative;
  width: 132px;
  height: 104px;
  display: grid;
  place-items: center;
}

.agent-mascot-core {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  animation: agent-x-breathe 3.6s ease-in-out infinite;
}

.agent-mascot-logo {
  position: relative;
  z-index: 3;
  display: block;
  width: 68px;
  height: 68px;
  object-fit: contain;
  opacity: 1;
  filter: none;
}

.agent-mascot-state {
  min-height: 18px;
  color: var(--agent-cyan);
  background: none;
  -webkit-text-fill-color: currentColor;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  text-shadow: none;
  animation: none;
}

.agent-entry-mascot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: -2px;
}

.agent-shell.is-agent-complete .agent-mascot-state {
  color: var(--agent-cyan);
}

.agent-hero-copy {
  max-width: 760px;
  text-align: center;
}

.agent-hero-copy h1 {
  position: relative;
  margin: 0;
  color: var(--agent-ink);
  font-size: clamp(34px, 3.7vw, 48px);
  font-weight: 900;
  line-height: 1.14;
  text-shadow: 0 1px 0 #fff, 0 8px 24px rgba(29, 76, 116, 0.12);
}

.agent-hero-copy h1 span:nth-child(1) {
  color: #087e8d;
}

.agent-hero-copy h1 span:nth-child(2) {
  color: #146fe8;
}

.agent-hero-copy h1 span:nth-child(3) {
  color: #7359d6;
}

.agent-hero-copy h1 span:nth-child(4) {
  color: #d43f78;
}

.agent-hero-copy h1::after {
  content: "";
  display: block;
  width: 132px;
  height: 3px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, var(--agent-cyan), var(--agent-accent), var(--agent-violet), var(--agent-rose), var(--agent-gold));
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(10, 168, 186, 0.24);
  animation: agent-spectrum-flow 3.6s linear infinite;
}

.agent-hero-copy p {
  margin: 8px 0 0;
  color: var(--agent-muted);
  font-size: 15px;
  line-height: 1.6;
}

.agent-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(68, 106, 145, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 24px rgba(33, 72, 108, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.agent-tab-pill {
  border: 1px solid transparent;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #4d6075;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.agent-tab-pill[data-mode="detail"] {
  border-color: rgba(10, 168, 186, 0.24);
  color: #087e8d;
  background: #eaf9f8;
}

.agent-tab-pill[data-mode="office"] {
  border-color: rgba(115, 89, 214, 0.22);
  color: #604ab9;
  background: #f5f1ff;
}

.agent-tab-pill:hover {
  color: var(--agent-ink);
}

.agent-tab-pill.is-active {
  color: #fff;
  background-size: 180% 100%;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.5), 0 0 0 1px rgba(10, 168, 186, 0.26), 0 8px 20px rgba(31, 69, 106, 0.22);
  animation: agent-spectrum-flow 5s linear infinite;
}

.agent-tab-pill[data-mode="detail"].is-active {
  border-color: transparent;
  background-image: linear-gradient(105deg, #087e8d, #146fe8 56%, #7359d6);
}

.agent-tab-pill[data-mode="office"].is-active {
  border-color: transparent;
  background-image: linear-gradient(105deg, #7359d6, #d95686 58%, #d69a2d);
}

.agent-tab-pill-icon {
  width: 18px;
  height: 18px;
  color: currentColor;
}

.agent-quick-row {
  width: min(100%, 900px);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-quick-row button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(78, 119, 160, 0.2);
  border-radius: 8px;
  color: #42576d;
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.agent-quick-row button:nth-child(4n + 1) { border-bottom-color: var(--agent-cyan); }
.agent-quick-row button:nth-child(4n + 2) { border-bottom-color: var(--agent-violet); }
.agent-quick-row button:nth-child(4n + 3) { border-bottom-color: var(--agent-rose); }
.agent-quick-row button:nth-child(4n + 4) { border-bottom-color: var(--agent-gold); }

.agent-quick-row button:hover,
.agent-quick-row button:focus-visible {
  border-color: rgba(10, 168, 186, 0.46);
  color: #087e8d;
  background: var(--agent-teal-soft);
}

.agent-conv {
  width: min(100%, 920px);
  min-height: clamp(170px, 22dvh, 220px);
  max-height: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(83, 105, 128, 0.2) transparent;
}

.agent-conv::-webkit-scrollbar {
  width: 5px;
}

.agent-conv::-webkit-scrollbar-track {
  background: transparent;
}

.agent-conv::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(83, 105, 128, 0.18);
}

.agent-conv:hover::-webkit-scrollbar-thumb {
  background: rgba(83, 105, 128, 0.3);
}

.agent-session-action {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(20, 111, 232, 0.16);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1558ad;
  background: rgba(237, 246, 255, 0.86);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.agent-session-action:hover,
.agent-session-action:focus-visible {
  color: #087e8d;
  background: #e6f8f7;
  transform: translateY(-1px);
}

.agent-side-rail {
  grid-area: side;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agent-history-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid rgba(65, 108, 151, 0.18);
  border-radius: 12px;
  background: rgba(249, 252, 255, 0.78);
  box-shadow: 0 10px 24px rgba(31, 72, 109, 0.07);
  backdrop-filter: blur(14px);
}

.agent-history-panel[hidden] {
  display: none;
}

.agent-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 1px 1px 12px;
  border-bottom: 1px solid rgba(65, 108, 151, 0.14);
}

.agent-history-head > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.agent-history-head strong {
  color: #172b45;
  font-size: 14px;
  font-weight: 900;
}

.agent-history-head span {
  color: #8190a1;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.agent-history-new-session {
  flex: 0 0 auto;
  min-height: 28px;
  padding-inline: 10px;
  border-radius: 7px;
  font-size: 11px;
  white-space: nowrap;
}

.agent-history-list {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  max-height: none;
  overflow-y: auto;
  padding: 10px 2px 2px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 125, 158, 0.42) transparent;
}

.agent-history-item {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #27435f;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.agent-history-item + .agent-history-item {
  margin-top: 4px;
}

.agent-history-item:hover,
.agent-history-item:focus-visible,
.agent-history-item.is-active {
  color: #1558ad;
  border-color: rgba(79, 143, 224, 0.32);
  background: rgba(225, 241, 255, 0.72);
  outline: none;
}

.agent-history-item-title {
  min-width: 0;
  overflow: hidden;
  color: #1b3653;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-history-item-meta {
  color: #8493a4;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
}

.agent-shell.is-workbench {
  place-items: stretch start;
}

.agent-shell.is-workbench .agent-buddy {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "side conv"
    "side conv"
    "side composer";
  align-items: stretch;
  column-gap: 18px;
  row-gap: 12px;
  width: 100%;
  max-width: none;
  min-height: 0;
  justify-content: flex-start;
  padding-top: 0;
}

.agent-shell.is-entry .agent-conv {
  display: none;
}

.agent-shell.is-entry .agent-side-rail {
  display: none;
}

@media (min-width: 901px) {
  body[data-page="agent"] .agent-shell.is-entry {
    padding-right: 12px;
    padding-block: 12px;
    place-items: stretch center;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-buddy {
    width: min(100%, 1180px);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "mascot"
      "hero"
      "tabs"
      "quick"
      "composer";
    align-content: center;
    align-items: center;
    justify-items: center;
    row-gap: 14px;
    padding-top: 0;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-side-rail {
    grid-area: side;
    align-self: stretch;
    justify-self: stretch;
    display: none;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-buddy.has-history {
    width: 100%;
    max-width: none;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
      "side mascot"
      "side hero"
      "side tabs"
      "side quick"
      "side composer";
    column-gap: 18px;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-side-rail.has-history {
    position: fixed;
    z-index: 2;
    top: calc(var(--agent-topbar-height) + 12px);
    bottom: 12px;
    left: calc(var(--saas-shell-sidebar) + 12px);
    width: 220px;
    display: flex;
    min-height: 0;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-history-panel {
    flex: 1 1 auto;
    height: 100%;
    max-height: none;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-entry-mascot {
    grid-area: mascot;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-hero-copy {
    grid-area: hero;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-tabs {
    grid-area: tabs;
    width: min(100%, 980px);
    justify-self: center;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-quick-row {
    grid-area: quick;
  }

  body[data-page="agent"] .agent-shell.is-entry .agent-composer {
    grid-area: composer;
  }
}

.agent-shell.is-workbench .agent-entry-mascot,
.agent-shell.is-workbench .agent-hero-copy,
.agent-shell.is-workbench .agent-quick-row,
.agent-shell.is-workbench .agent-tabs {
  display: none;
}

.agent-shell.is-workbench .agent-composer {
  flex: 0 0 auto;
}

.agent-shell.is-workbench .agent-history-panel {
  flex: 1 1 auto;
}

.agent-shell.is-workbench .agent-side-rail,
.agent-shell.is-workbench .agent-history-panel {
  min-height: 0;
  overflow: hidden;
}

.agent-shell.is-workbench .agent-history-panel {
  display: flex;
  flex-direction: column;
}

.agent-shell.is-workbench .agent-history-list {
  flex: 1 1 auto;
  max-height: none;
  overflow-y: auto;
}

.agent-shell.is-workbench .agent-conv {
  grid-area: conv;
  width: min(100%, 940px);
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  padding: 18px 6px;
  justify-self: center;
  justify-content: flex-start;
  overscroll-behavior: contain;
}

.agent-conv-empty {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #9ca3af;
  font-size: 13px;
}

.agent-conv-empty-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--agent-cyan);
  animation: agent-pulse 1.6s ease-in-out infinite;
}

.agent-composer {
  grid-area: composer;
  position: relative;
  isolation: isolate;
  overflow: visible;
  width: min(100%, 980px);
  min-height: 184px;
  padding: 18px;
  border: 1px solid rgba(72, 122, 171, 0.38);
  border-radius: 16px;
  background: var(--agent-surface);
  box-shadow: 0 10px 24px rgba(27, 69, 108, 0.06);
  backdrop-filter: blur(16px);
}

.agent-shell.is-workbench .agent-composer {
  justify-self: center;
}

.agent-composer::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -28px -36px -32px -34px;
  border-radius: 38% 62% 44% 56% / 58% 42% 64% 36%;
  background:
    radial-gradient(ellipse 34% 56% at 5% 34%, rgba(10, 168, 186, .38), transparent 74%),
    radial-gradient(ellipse 48% 32% at 31% 96%, rgba(20, 111, 232, .25), transparent 76%),
    radial-gradient(ellipse 42% 30% at 67% 4%, rgba(115, 89, 214, .24), transparent 75%),
    radial-gradient(ellipse 34% 54% at 98% 63%, rgba(200, 63, 115, .3), transparent 73%),
    radial-gradient(ellipse 38% 24% at 52% 88%, rgba(241, 191, 88, .18), transparent 78%);
  filter: blur(22px);
  opacity: .78;
  transform: scale(1.01);
  pointer-events: none;
  transition: opacity .24s ease, transform .24s ease;
}

.agent-composer::after {
  content: "";
  position: absolute;
  z-index: -2;
  inset: -18px -26px -22px -24px;
  border-radius: 56% 44% 62% 38% / 42% 58% 36% 64%;
  background:
    radial-gradient(ellipse 46% 34% at 14% 72%, rgba(55, 204, 207, .22), transparent 78%),
    radial-gradient(ellipse 52% 28% at 52% 16%, rgba(77, 126, 238, .18), transparent 80%),
    radial-gradient(ellipse 44% 38% at 88% 78%, rgba(176, 72, 175, .2), transparent 77%);
  filter: blur(12px);
  opacity: .68;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.agent-composer:focus-within {
  border-color: rgba(10, 168, 186, 0.56);
  box-shadow: 0 10px 24px rgba(27, 69, 108, 0.06);
}

.agent-composer:focus-within::before {
  opacity: 1;
  transform: translate3d(1px, -1px, 0) scale(1.025);
}

.agent-composer:focus-within::after {
  opacity: .9;
  transform: translate3d(-2px, 1px, 0);
}

.agent-composer textarea {
  width: 100%;
  min-height: 96px;
  max-height: 180px;
  padding-right: 16px;
  padding-bottom: 38px;
  border: none;
  outline: none;
  box-shadow: none;
  appearance: none;
  resize: none;
  background: transparent;
  color: var(--agent-ink);
  font: inherit;
  font-size: 17px;
  line-height: 1.65;
}

body[data-page="agent"] .page-shell .agent-composer textarea,
body[data-page="agent"] .page-shell .agent-composer textarea:focus,
body[data-page="agent"] .page-shell .agent-composer textarea:focus-visible {
  border-color: transparent !important;
  outline: none;
  box-shadow: none !important;
}

.agent-composer textarea::placeholder {
  color: #8192a6;
}

.agent-upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.agent-upload-preview:empty {
  display: none;
}

.agent-file-preview {
  min-height: 34px;
  max-width: 100%;
  padding: 0 10px;
  border: 1px solid rgba(10, 168, 186, 0.2);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #effafa;
  color: #36506f;
  font-size: 12px;
  font-weight: 800;
}

.agent-file-preview-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-file-preview-size {
  color: #7b8798;
  font-weight: 700;
}

.agent-composer-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(72, 122, 171, 0.14);
}

.agent-upload-chip {
  position: relative;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(20, 111, 232, 0.22);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #1558ad;
  background: var(--agent-accent-soft);
  cursor: pointer;
}

.agent-upload-icon {
  width: 18px;
  height: 18px;
}

.agent-upload-label {
  font-size: 13px;
  font-weight: 900;
}

.agent-file-upload-chip {
  display: none;
}

.agent-upload-thumb {
  width: 44px;
  height: 44px;
  border: 2px solid #fff;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 10px 22px rgba(6, 63, 180, 0.22);
}

.agent-chip-row {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.agent-chip-row::-webkit-scrollbar {
  display: none;
}

.agent-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(78, 119, 160, 0.2);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f6f9fc;
  color: #43576c;
}

.agent-chip-icon {
  width: 15px;
  height: 15px;
  color: var(--agent-violet);
}

.agent-chip select,
.agent-chip input {
  width: auto;
  min-width: 0;
  max-width: 190px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #374151;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.agent-chip input {
  width: 112px;
}

.agent-mode-office .agent-file-upload-chip {
  display: inline-flex;
}

.agent-mode-office .agent-chip-image-model,
.agent-mode-office .agent-chip-quality,
  .agent-mode-office .agent-chip-ratio,
  .agent-mode-office .agent-chip-product,
  .agent-mode-office .agent-image-upload-chip,
  .agent-mode-office .agent-asset-picker-chip {
    display: none;
  }

.agent-input-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.agent-btn {
  border: 0;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.agent-btn:hover {
  transform: translateY(-1px);
}

.agent-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.agent-btn.ghost {
  border: 1px solid rgba(115, 89, 214, 0.24);
  color: #5b47b3;
  background: #f8f6ff;
}

.agent-btn.primary {
  color: #fff;
  background: #13283e;
  box-shadow: 0 8px 18px rgba(22, 93, 149, 0.22), inset 0 -2px 0 var(--agent-cyan);
}

.agent-btn.primary.icon {
  width: 44px;
  padding: 0;
  border-radius: 10px;
}

.agent-voice-icon {
  display: none;
}

.agent-tabs button:focus-visible,
.agent-quick-row button:focus-visible,
.agent-upload-chip:focus-within,
.agent-btn:focus-visible,
.agent-session-action:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(10, 168, 186, 0.18);
}

.generation-cost-summary,
.agent-status {
  width: min(100%, 940px);
  margin: -6px 0 0;
  color: #667085;
  font-size: 13px;
  text-align: center;
}

.generation-cost-summary[data-configured="false"] {
  color: #9a6a3c;
}

.generation-cost-summary[hidden] {
  display: none;
}

.agent-status.is-hidden {
  display: none;
}

.agent-status.is-success {
  color: #0a7d4b;
}

.agent-status.is-warning {
  color: #9a5b00;
}

.agent-msg {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  margin-block: 2px;
}

.agent-msg-user {
  justify-content: flex-end;
}

.agent-msg-ai {
  justify-content: flex-start;
}

.agent-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  color: #fff;
  background: #13283e;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  text-align: center;
  visibility: visible !important;
  opacity: 1 !important;
}

.agent-msg-avatar-label {
  display: inline-block;
  min-width: 1em;
  color: inherit;
  font: inherit;
  line-height: 1;
  visibility: visible !important;
  opacity: 1 !important;
}

.agent-msg-ai .agent-msg-avatar {
  border: 1px solid rgba(10, 168, 186, 0.42);
  background: linear-gradient(135deg, #0aa8ba, #146fe8 56%, #7359d6);
  background-size: 180% 100%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 8px 20px rgba(20, 111, 232, 0.26);
  animation: agent-spectrum-flow 5s linear infinite;
}

.agent-msg-user .agent-msg-avatar {
  border: 1px solid rgba(6, 63, 180, 0.16);
  color: #fff;
  background: #146fe8;
  box-shadow: 0 10px 22px rgba(6, 63, 180, 0.14);
}

.agent-msg-bubble {
  max-width: min(78%, 640px);
  min-width: 48px;
  padding: 11px 14px;
  border-radius: 18px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(70, 111, 151, 0.1);
  box-shadow: 0 12px 30px rgba(28, 67, 103, 0.08);
}

.agent-msg-user .agent-msg-bubble {
  min-width: 52px;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #1558ad, #087e8d);
  border-bottom-right-radius: 8px;
  text-align: left;
}

.agent-msg-ai .agent-msg-bubble {
  border-bottom-left-radius: 8px;
}

.agent-msg-result-bubble {
  padding: 8px !important;
  border: 1px solid rgba(96, 165, 250, .18) !important;
  border-radius: 14px !important;
  background: #11151d !important;
  color: #d8e1ec !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18) !important;
}

.agent-msg-result-bubble .agent-msg-attachments {
  margin: 0;
}

.agent-msg-result-bubble .agent-msg-attach-button.is-result-preview .agent-msg-attach {
  display: block;
  border-radius: 9px;
}

.agent-msg-result-bubble .agent-msg-meta {
  margin: 7px 2px 1px;
  padding-top: 7px;
  border-top: 1px solid rgba(148, 163, 184, .14);
  color: #8f9bab;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  opacity: 1;
}

.agent-msg-typing {
  align-items: center;
}

.agent-msg-typing .agent-msg-bubble {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: min(72%, 320px);
  min-width: 0;
  min-height: 0;
  padding: 9px 12px;
  border-radius: 14px;
  white-space: normal;
}

.agent-msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.agent-msg-attach-button {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.agent-msg-attach {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  cursor: zoom-in;
  object-fit: cover;
}

.agent-msg-attach-button.is-result-preview {
  width: min(240px, 100%);
}

.agent-msg-attach-button.is-result-preview .agent-msg-attach {
  width: 100%;
  height: auto;
  max-height: 240px;
  border-radius: 10px;
  object-fit: contain;
}

.agent-msg-video {
  width: min(100%, 360px);
  max-height: 320px;
  border-radius: 12px;
  display: block;
  background: #0f172a;
}

.agent-msg-file {
  max-width: 100%;
  padding: 7px 9px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.7);
  color: #36506f;
  font-size: 12px;
  font-weight: 800;
}

.agent-msg-file-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-msg-file-size {
  color: #7b8798;
  font-weight: 700;
}

.agent-msg-meta {
  margin-top: 6px;
  color: inherit;
  font-size: 11px;
  opacity: 0.68;
}

.agent-draw-loader {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 20px;
  margin-bottom: 8px;
}

.agent-msg-typing .agent-draw-loader {
  flex: 0 0 auto;
  height: 18px;
  margin-bottom: 0;
}

.agent-draw-loader span {
  width: 5px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #14bfea, #063fb4);
  animation: agent-loader 0.42s ease-out infinite alternate;
}

.agent-draw-loader span:nth-child(2) {
  height: 17px;
  animation-delay: 0.14s;
}

.agent-draw-loader span:nth-child(3) {
  height: 13px;
  animation-delay: 0.28s;
}

.agent-typing-text {
  color: #667085;
  font-size: 12px;
}

.agent-msg-typing .agent-typing-text {
  line-height: 1.3;
  white-space: nowrap;
}

@media (max-width: 900px) {
  body[data-page="agent"] {
    height: 100svh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body[data-page="agent"] .app-shell {
    height: 100svh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body[data-page="agent"] .app-main {
    box-sizing: border-box;
    flex: 0 0 100svh;
    flex-basis: 100dvh;
    height: 100svh;
    height: 100dvh;
    min-height: 0;
    padding: 64px 0 0 !important;
    overflow: hidden;
  }

  body[data-page="agent"] .page-shell.page-agent {
    padding: 0 !important;
  }

  body[data-page="agent"] .page-agent {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    animation: none;
    transform: none;
  }

  .agent-shell {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    padding: 4px 14px 74px;
    place-items: start center;
    overflow: hidden;
  }

  .agent-shell.is-entry {
    padding: 14px 12px 96px;
    overflow: hidden;
  }

  .agent-buddy {
    height: 100%;
    min-height: 0;
    justify-content: flex-start;
    gap: 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .agent-shell.is-entry .agent-buddy {
    height: 100%;
    min-height: 0;
    justify-content: center;
    gap: 11px;
    padding-top: 0;
    overflow-y: auto;
  }

  .agent-mascot {
    width: 92px;
    height: 74px;
  }

  .agent-conv {
    min-height: 150px;
    max-height: none;
  }

  .agent-shell.is-workbench .agent-conv {
    grid-area: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding-block: 12px;
  }

  .agent-shell.is-workbench .agent-buddy {
    display: flex;
    width: 100%;
    gap: 14px;
    overflow: hidden;
  }

  .agent-side-rail {
    display: none;
  }

  body[data-page="agent"] .agent-side-rail.mobile-history-drawer {
    position: fixed;
    z-index: 130;
    top: 72px;
    right: auto;
    bottom: 10px;
    left: 10px;
    display: flex;
    width: min(220px, calc(100vw - 72px));
    min-height: 0;
    margin: 0;
    padding: 8px;
    overflow: hidden;
    border: 1px solid var(--hx-workbench-border-strong, rgba(255, 255, 255, .17));
    border-radius: 10px;
    background: var(--hx-workbench-sidebar, #0d0f14);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .42);
    transform: translateX(calc(-100% - 20px));
    visibility: hidden;
    pointer-events: none;
    transition: transform .28s ease-out, visibility 0s linear .28s;
  }

  body[data-page="agent"].mobile-history-open .agent-side-rail.mobile-history-drawer {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform .28s ease-out;
  }

  body[data-page="agent"] .mobile-history-drawer .agent-history-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    padding: 8px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-page="agent"] .mobile-history-drawer .agent-history-panel[hidden] {
    display: none;
  }

  body[data-page="agent"] .mobile-history-drawer .agent-history-list {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
  }

  .agent-status {
    display: none;
  }

  .agent-hero-copy h1 {
    font-size: 30px;
    line-height: 1.18;
  }

  .agent-hero-copy p {
    font-size: 14px;
  }

  .agent-tabs {
    width: 100%;
    max-width: 360px;
  }

  .agent-tab-pill {
    flex: 0 0 auto;
    min-width: 108px;
    justify-content: center;
    padding-inline: 12px;
    white-space: nowrap;
  }

  .agent-tab-pill span {
    white-space: nowrap;
  }

  .agent-buddy > .agent-composer {
    position: fixed;
    z-index: 40;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    width: auto;
    max-width: 680px;
    margin-inline: auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
    padding: 8px 8px 6px;
    border-radius: 16px;
  }

  .agent-shell.is-workbench .agent-buddy > .agent-composer {
    justify-self: stretch;
  }

  .agent-shell.is-entry .agent-quick-row {
    width: 100%;
    justify-content: safe center;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-inline: 2px;
    scrollbar-width: none;
  }

  .agent-shell.is-entry .agent-quick-row::-webkit-scrollbar {
    display: none;
  }

  .agent-shell.is-entry .agent-quick-row button {
    min-height: 38px;
    flex: 0 0 auto;
    padding-inline: 14px;
    border-radius: 999px;
    white-space: nowrap;
  }

  .agent-chip-text-model {
    display: none;
  }

  .agent-asset-picker-chip {
    display: inline-flex;
    order: 4;
    border-radius: 50%;
  }

  .agent-image-upload-chip {
    order: 1;
  }

  .agent-chip-row {
    order: 4;
    justify-content: flex-start;
  }

  #home-input-bar:not(.agent-mode-office) .agent-chip-row {
    display: none;
  }

  .agent-buddy > .agent-composer textarea {
    order: 2;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    padding: 0 2px;
    font-size: 15px;
    line-height: 40px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
  }

  .agent-composer-foot {
    display: contents;
  }

  .agent-input-tools {
    order: 3;
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-left: 0;
  }

  .agent-btn.primary.icon {
    width: 40px;
    min-height: 40px;
    border-radius: 50%;
  }

  .agent-buddy > .agent-composer .agent-input-tools {
    gap: 6px;
  }

  .agent-buddy > .agent-composer .agent-upload-chip,
  .agent-buddy > .agent-composer .agent-btn.ghost {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 11px;
  }

  .agent-voice-control {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .agent-voice-control .agent-send-icon {
    display: none;
  }

  .agent-voice-control .agent-voice-icon {
    display: block;
  }

  .agent-voice-control.is-recording {
    background: linear-gradient(135deg, #0aa8ba, #7359d6);
    box-shadow: 0 0 0 5px rgba(10, 168, 186, .15), 0 8px 20px rgba(49, 94, 196, .28);
    animation: agent-voice-pulse 1.1s ease-in-out infinite;
  }

  .agent-upload-preview:not(:empty) {
    order: 0;
    flex: 0 0 100%;
    margin-bottom: 0;
  }

  .agent-composer textarea {
    min-height: 92px;
    font-size: 16px;
  }

  .agent-upload-chip {
    width: 40px;
    flex: 0 0 40px;
    min-width: 40px;
    min-height: 38px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }

  .agent-upload-chip .agent-upload-label {
    display: none;
  }

  .agent-file-preview-name,
  .agent-msg-file-name {
    max-width: 132px;
  }

  .agent-chip-text-model {
    max-width: 126px;
  }

  .agent-chip-quality {
    display: none;
  }

  .agent-chip-text-model select {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .agent-chip {
    flex: 0 0 auto;
    justify-content: space-between;
  }

  .agent-btn.ghost {
    flex: 0 0 auto;
  }

  .agent-msg-bubble {
    max-width: 84%;
  }
}

@media (max-width: 560px) {
  .agent-buddy > .agent-composer {
    flex-wrap: nowrap;
    gap: 4px;
    min-height: 52px;
    padding: 5px 6px 4px;
    border-radius: 10px;
  }

  .agent-buddy > .agent-composer textarea {
    flex: 1 1 0;
    width: 0;
    height: 34px;
    min-height: 34px;
    max-height: 34px;
    padding: 0 3px;
    font-size: 14px;
    line-height: 34px;
    text-overflow: ellipsis;
  }

  .agent-buddy > .agent-composer .agent-upload-chip,
  .agent-buddy > .agent-composer .agent-btn.primary.icon {
    flex: 0 0 34px;
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 8px;
  }

  .agent-buddy > .agent-composer .agent-image-upload-chip {
    order: 1;
  }

  .agent-buddy > .agent-composer .agent-input-tools {
    order: 3;
  }

  .agent-buddy > .agent-composer .agent-asset-picker-chip {
    order: 4;
    display: inline-flex;
  }

  .agent-buddy > .agent-composer .agent-chip-row {
    display: none;
  }

  .agent-mode-office .agent-image-upload-chip,
  .agent-mode-office .agent-asset-picker-chip {
    display: inline-flex;
  }

  .agent-msg-avatar {
    display: none;
  }

  .agent-msg {
    gap: 0;
  }

  .agent-msg-bubble {
    max-width: 100%;
  }

  .agent-buddy > .agent-composer {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
  }

  .agent-shell.is-entry .agent-entry-mascot {
    gap: 0;
    margin-bottom: 0;
  }

  .agent-shell.is-entry .agent-hero-copy {
    width: 100%;
    max-width: none;
  }

  .agent-shell.is-entry .agent-hero-copy h1 {
    max-width: none;
    margin-right: auto;
    margin-left: auto;
    font-size: 26px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .agent-shell.is-entry .agent-hero-copy p {
    max-width: 330px;
    margin: 8px auto 0;
    line-height: 1.55;
  }

}

@media (max-width: 768px) {
  body[data-page="agent"] .app-topbar {
    justify-content: flex-end;
  }

  body[data-page="agent"] .app-topbar-left {
    position: absolute;
    left: 50%;
    max-width: calc(100% - 128px);
    transform: translateX(-50%);
  }

  body[data-page="agent"] .app-sidebar {
    border-color: rgba(0, 151, 177, 0.72);
    background-color: #c9e2ff;
    background-image:
      linear-gradient(rgba(10, 109, 157, 0.14) 1px, transparent 1px),
      linear-gradient(90deg, rgba(10, 109, 157, 0.14) 1px, transparent 1px),
      linear-gradient(145deg, #bcefe7 0%, #c7dbff 52%, #edcde8 100%);
    background-size: 24px 24px;
    box-shadow: -20px 0 58px rgba(24, 67, 111, 0.36), 0 0 34px rgba(0, 151, 177, 0.22);
    backdrop-filter: none;
  }

  body[data-page="agent"] .app-sidebar::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    right: 12px;
    left: 12px;
    height: 3px;
    background: linear-gradient(90deg, var(--agent-cyan), var(--agent-accent), var(--agent-violet), var(--agent-rose), var(--agent-gold));
    background-size: 180% 100%;
    animation: agent-spectrum-flow 5s linear infinite;
    pointer-events: none;
  }

  body[data-page="agent"] .app-mobile-nav-backdrop {
    background: rgba(10, 30, 54, 0.28);
    backdrop-filter: blur(3px);
  }

  body[data-page="agent"] .app-sidebar-section-label {
    color: #146fe8;
    font-weight: 900;
    text-shadow: 0 0 12px rgba(20, 111, 232, 0.16);
  }

  body[data-page="agent"] .sidebar-generation-head {
    border: 1px solid rgba(115, 89, 214, 0.16);
    background: linear-gradient(105deg, rgba(234, 249, 248, 0.9), rgba(245, 241, 255, 0.92));
  }

  body[data-page="agent"] .sidebar-generation-title {
    color: #604ab9;
    font-weight: 900;
  }

  body[data-page="agent"] .app-sidebar-link {
    color: #29435e;
    font-weight: 800;
  }

  body[data-page="agent"] .app-sidebar-nav-secondary .app-sidebar-link:nth-child(4n + 1) { color: #087e8d; }
  body[data-page="agent"] .app-sidebar-nav-secondary .app-sidebar-link:nth-child(4n + 2) { color: #146fe8; }
  body[data-page="agent"] .app-sidebar-nav-secondary .app-sidebar-link:nth-child(4n + 3) { color: #604ab9; }
  body[data-page="agent"] .app-sidebar-nav-secondary .app-sidebar-link:nth-child(4n + 4) { color: #c83f73; }

  body[data-page="agent"] .app-sidebar-link:hover,
  body[data-page="agent"] .app-sidebar-link:focus-visible {
    border-color: rgba(10, 168, 186, 0.24);
    color: #102033;
    background: rgba(255, 255, 255, 0.82);
  }

  body[data-page="agent"] .app-sidebar-link.is-active {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(105deg, #087e8d, #146fe8 54%, #7359d6);
    box-shadow: inset 3px 0 0 #f1bf58, 0 8px 20px rgba(20, 111, 232, 0.2);
  }

  body[data-page="agent"] .sidebar-credit {
    border-color: rgba(10, 168, 186, 0.24);
    color: #087e8d;
    background: linear-gradient(105deg, #eaf9f8, #f5f1ff);
    font-weight: 900;
  }

  body[data-page="agent"] .app-sidebar-footer .btn {
    border-color: rgba(115, 89, 214, 0.2);
    color: #604ab9;
    background: rgba(255, 255, 255, 0.84);
    font-weight: 800;
  }

  body[data-page="agent"].mobile-nav-open .app-topbar {
    z-index: 140;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: none;
  }

  body[data-page="agent"].mobile-nav-open .app-mobile-nav-toggle {
    position: fixed;
    z-index: 141;
    top: 10px;
    right: 12px;
    gap: 0;
    border-color: rgba(10, 168, 186, 0.32);
    color: #146fe8;
    background: rgba(247, 252, 255, 0.94);
    box-shadow: 0 8px 22px rgba(20, 111, 232, 0.18);
    pointer-events: auto;
  }

  body[data-page="agent"].mobile-nav-open .app-mobile-nav-toggle span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    margin-top: -1px;
    margin-left: -7px;
  }

  body[data-page="agent"].mobile-nav-open .app-mobile-nav-toggle span:nth-child(1) {
    transform: translateY(-4px) rotate(45deg);
  }

  body[data-page="agent"].mobile-nav-open .app-mobile-nav-toggle span:nth-child(2) {
    opacity: 0;
    transform: none;
  }

  body[data-page="agent"].mobile-nav-open .app-mobile-nav-toggle span:nth-child(3) {
    transform: translateY(4px) rotate(-45deg);
  }
}

@media (max-width: 360px) {
  .agent-shell.is-entry .agent-hero-copy h1 {
    font-size: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .agent-hero-copy h1,
  .agent-mascot-state {
    color: CanvasText;
    background: none;
    -webkit-text-fill-color: currentColor;
  }

  .agent-hero-copy h1 span {
    color: inherit;
  }
}

@keyframes agent-spectrum-flow {
  to {
    background-position: 200% 0;
  }
}

@keyframes agent-x-breathe {
  0%,
  100% {
    opacity: 1;
    transform: scale(.97);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes agent-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.35);
  }
}

@keyframes agent-voice-pulse {
  0%, 100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }
}

@keyframes agent-loader {
  from {
    opacity: 0.42;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(-2px);
  }
}
