:root {
  --zwq-chat-css-build: "2026.10.12.video-preview1";
  --page: #f5f5f2;
  --bg: #fffefb;
  --panel-2: #f8f8f5;
  --border: rgba(42, 42, 38, 0.11);
  --ink-1: #292923;
  --ink-2: #51514a;
  --ink-3: #7a7971;
  --sidebar: #24231f;
  --sidebar-soft: #34322d;
  --rail-ink-active: #fffdf7;
  --rail-ink-muted: rgba(255, 253, 247, 0.68);
  --surface: rgba(255, 253, 247, 0.82);
  --surface-2: rgba(248, 245, 234, 0.72);
  --ink: var(--ink-1);
  --muted: #756f62;
  --line: rgba(52, 52, 46, 0.13);
  --yellow: #ffe100;
  --yellow-soft: rgba(255, 225, 0, 0.18);
  --charcoal: #24231f;
  --glow-neutral: rgba(42, 42, 38, 0.08);
  --glow-accent: rgba(255, 225, 0, 0.16);
  --accent: var(--yellow);
  --accent-soft: rgba(255, 225, 0, 0.16);
  --on-accent: #2b220d;
  --focus: #4a4a42;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(42, 42, 38, 0.05);
  --shadow-lg: 0 18px 42px -30px rgba(42, 42, 38, 0.28);
  --motion-fast: 140ms;
  --motion-med: 190ms;
  --motion-slow: 460ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Shared product scale. Exceptional geometry keeps its explicit value. */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-xxl: 24px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --app-sidebar-width: 232px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

body::before {
  display: none;
}

body::after {
  display: none;
}

button,
select,
textarea {
  font: inherit;
}

:root {
  --app-viewport-height: 100vh;
  --app-keyboard-inset: 0px;
}

.agent-inline-approval {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.agent-inline-approval button {
  border: 1px solid var(--chat-border, #d8dbe2);
  border-radius: var(--radius-sm);
  background: var(--chat-surface, #fff);
  color: inherit;
  cursor: pointer;
  padding: 7px 12px;
}

.agent-inline-approval button[data-decision="approve"] {
  border-color: #d2a62b;
  background: #f6c945;
  color: #2a2106;
}

.aichat-execution-trace {
  width: min(100%, 440px);
  margin: 0 0 10px;
  border: 1px solid color-mix(in srgb, var(--chat-border, #d8dbe2) 78%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--chat-surface, #fff) 88%, #f4f1e8);
  color: var(--muted);
  overflow: hidden;
}

.aichat-execution-trace summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 7px 10px;
  cursor: pointer;
  list-style: none;
}

.aichat-execution-trace summary::-webkit-details-marker { display: none; }

.aichat-execution-trace summary::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #c6a600;
  box-shadow: 0 0 0 3px rgba(198, 166, 0, .12);
}

.aichat-trace-title {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.aichat-execution-trace summary small {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.aichat-trace-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0 10px 8px 25px;
  list-style: none;
}

.aichat-trace-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 3px 0;
}

.aichat-trace-state {
  width: 8px;
  height: 8px;
  border: 1.5px solid #a9aeb8;
  border-radius: 50%;
}

.aichat-trace-item[data-status="running"] .aichat-trace-state {
  border-color: #c6a600;
  box-shadow: 0 0 0 3px rgba(198, 166, 0, .12);
}

.aichat-trace-item[data-status="completed"] .aichat-trace-state {
  border-color: #4c8b62;
  background: #4c8b62;
}

.aichat-trace-item[data-status="failed"] .aichat-trace-state {
  border-color: #b24a42;
  background: #b24a42;
}

.aichat-trace-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.aichat-trace-copy strong,
.aichat-trace-copy small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.aichat-trace-copy strong {
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
}

.aichat-trace-copy small,
.aichat-trace-notice,
.aichat-trace-live {
  font-size: var(--fs-xs);
  line-height: 1.35;
}

.aichat-trace-notice {
  margin: 0;
  padding: 0 10px 8px 25px;
  color: #8d5a18;
}

.aichat-trace-live {
  display: block;
  padding: 0 10px 8px 25px;
  color: #8d7c20;
}

body.auth-pending {
  min-height: var(--app-viewport-height);
  overflow: hidden;
  background: #f7f7f4;
}

body.auth-pending:not(.auth-ready) .auth-gate {
  display: none;
}

.chat-boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: #f7f7f4;
  color: #777872;
  font-size: var(--fs-base);
  animation: chatBootWait 0s 160ms both;
}

@keyframes chatBootWait {
  from { visibility: hidden; }
  to { visibility: visible; }
}

.auth-gate {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: var(--app-viewport-height);
  place-items: center;
  overflow: hidden;
  padding: 32px 24px;
  background:
    linear-gradient(140deg, rgba(255, 225, 0, 0.18) 0%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(315deg, var(--glow-accent) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #fbfbf8 0%, #f4f4f1 48%, #ededeb 100%);
  animation: authGateReveal var(--motion-med) ease-out both;
}

@keyframes authGateReveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.auth-gate::before {
  position: absolute;
  inset: -1px;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.58) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 64px 64px;
  content: "";
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), transparent 72%);
}

.auth-card {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(420px, 100%);
  min-height: 390px;
  flex-direction: column;
  justify-content: center;
  padding: 38px 34px 32px;
  border: 1px solid rgba(36, 36, 36, 0.14);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.54)),
    rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.34),
    0 28px 80px rgba(23, 23, 23, 0.13);
  backdrop-filter: blur(30px) saturate(1.18);
}

.auth-card::before {
  position: absolute;
  inset: 1px;
  pointer-events: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.68), transparent 42%);
  content: "";
}

.auth-logo {
  position: relative;
  display: block;
  width: 88px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto 16px;
  filter: drop-shadow(0 10px 18px rgba(36, 36, 36, 0.08));
}

.auth-card h1 {
  position: relative;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: var(--fs-xxl);
  font-weight: 750;
  line-height: 1.28;
  text-align: center;
}

.auth-helper {
  position: relative;
  max-width: 300px;
  margin: 0 auto 12px;
  color: rgba(23, 23, 23, 0.68);
  font-size: var(--fs-base);
  font-weight: 650;
  line-height: 1.55;
  text-align: center;
}

.auth-badge {
  position: relative;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 auto 12px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: rgba(36, 36, 36, 0.92);
  color: var(--yellow);
  font-size: var(--fs-sm);
  font-weight: 850;
  line-height: 1;
}

.auth-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.auth-field {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.auth-step[hidden] {
  display: none;
}

.auth-back-button {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  margin: 2px 0 8px;
  padding: 6px 9px;
  border: 1px solid rgba(36, 36, 36, 0.1);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.46);
  color: rgba(23, 23, 23, 0.64);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 750;
}

.auth-back-button:hover,
.auth-back-button:focus-visible {
  color: var(--ink);
  outline: none;
}

.auth-field label {
  position: relative;
  color: rgba(23, 23, 23, 0.66);
  font-size: var(--fs-base);
  font-weight: 700;
}

.auth-field input {
  position: relative;
  width: 100%;
  height: 50px;
  border: 1px solid rgba(36, 36, 36, 0.18);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font: inherit;
  padding: 0 15px;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 10px 24px rgba(36, 36, 36, 0.04);
  transition:
    border-color var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    background-color var(--motion-med) ease;
}

.auth-field input::placeholder {
  color: rgba(84, 78, 68, 0.78);
}

.auth-field-hint {
  position: relative;
  margin: -1px 0 0;
  color: rgba(84, 78, 68, 0.76);
  font-size: var(--fs-xs);
  font-weight: 650;
  line-height: 1.5;
}

.auth-field input:focus {
  border-color: rgba(36, 36, 36, 0.34);
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 4px rgba(255, 225, 0, 0.24),
    0 16px 34px rgba(36, 36, 36, 0.07);
}

.auth-user-list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 206px;
  overflow: auto;
  border: 1px solid rgba(36, 36, 36, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 18px 44px rgba(28, 25, 18, 0.16);
  padding: 6px;
  backdrop-filter: blur(22px) saturate(1.16);
}

.auth-user-option {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(247, 247, 244, 0.72);
  color: var(--ink);
  cursor: pointer;
  padding: 9px 10px 9px 12px;
  text-align: left;
  transition:
    border-color var(--motion-med) ease,
    background-color var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.auth-user-option + .auth-user-option {
  margin-top: 5px;
}

.auth-user-option-name {
  min-width: 0;
  overflow: hidden;
  font-size: var(--fs-md);
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-option-action {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: rgba(36, 36, 36, 0.08);
  color: rgba(36, 36, 36, 0.64);
  font-size: var(--fs-xs);
  font-weight: 850;
  line-height: 24px;
}

.auth-user-option:hover,
.auth-user-option.active,
.auth-user-option:focus {
  border-color: rgba(36, 36, 36, 0.16);
  background: rgba(255, 225, 0, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  outline: none;
  transform: translateY(-1px);
}

.auth-user-option:hover .auth-user-option-action,
.auth-user-option.active .auth-user-option-action,
.auth-user-option:focus .auth-user-option-action {
  background: rgba(36, 36, 36, 0.9);
  color: var(--yellow);
}

.auth-user-empty {
  justify-content: center;
  cursor: default;
  color: rgba(84, 78, 68, 0.74);
  font-size: var(--fs-base);
  font-weight: 700;
}

.auth-user-empty:hover,
.auth-user-empty:focus {
  border-color: transparent;
  background: rgba(247, 247, 244, 0.72);
  box-shadow: none;
  transform: none;
}

.auth-message {
  position: relative;
  min-height: 20px;
  margin: 15px 0 0;
  color: var(--danger);
  font-size: var(--fs-base);
  line-height: 1.5;
}

.auth-submit {
  position: relative;
  width: 100%;
  height: 50px;
  margin-top: 15px;
  border: 0;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0)),
    var(--yellow);
  color: var(--charcoal);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.68),
    0 14px 30px rgba(204, 172, 0, 0.22);
  transition:
    box-shadow var(--motion-med) ease,
    filter var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.auth-submit:not(:disabled):hover,
.auth-submit:not(:disabled):focus-visible {
  filter: brightness(1.02);
  outline: none;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 18px 34px rgba(204, 172, 0, 0.26);
}

.auth-submit:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

@media (max-width: 640px) {
  .auth-gate {
    padding: 18px;
  }
  .auth-card {
    width: min(100%, 390px);
    min-height: 390px;
    padding: 34px 22px 28px;
    border-radius: var(--radius-md);
  }

  .auth-card h1 {
    margin-bottom: 9px;
    font-size: var(--fs-xl);
  }

  .auth-logo {
    width: 96px;
    height: 68px;
  }

  .auth-field input,
  .auth-submit {
    height: 48px;
  }
}

.chat-layout {
  display: grid;
  min-height: var(--app-viewport-height);
  grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
  background: var(--page);
}

.history-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: var(--app-viewport-height);
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 26px 20px;
  background: var(--sidebar);
  color: #fffdf7;
  transition:
    margin-left var(--motion-med) ease,
    opacity var(--motion-med) ease;
}

.history-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: #fffdf7;
  text-decoration: none;
}

.history-brand img {
  display: block;
  width: 64px;
  height: 50px;
  flex: 0 0 auto;
  object-fit: contain;
}

.history-brand strong,
.history-brand span {
  display: block;
}

.history-brand strong {
  font-size: var(--fs-lg);
  line-height: 1.2;
}

.history-brand span {
  margin-top: 3px;
  color: #cfcfcf;
  font-size: var(--fs-sm);
}

.sidebar-icon-button,
.show-sidebar-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: rgba(255, 225, 0, 0.14);
  color: var(--yellow);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 22px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px) saturate(145%);
  transition:
    background var(--motion-med) ease,
    border-color var(--motion-med) ease,
    color var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.sidebar-icon-button:hover,
.show-sidebar-button:hover {
  border-color: rgba(255, 225, 0, 0.45);
  background: rgba(255, 225, 0, 0.24);
  color: #fffdf7;
  transform: translateY(-1px);
}

.sidebar-icon-button svg,
.show-sidebar-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.show-sidebar-button {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 30;
  border-color: rgba(255, 225, 0, 0.22);
  background: rgba(36, 36, 36, 0.84);
  color: var(--yellow);
  box-shadow: 0 10px 30px rgba(20, 24, 35, 0.08);
}

.show-sidebar-button[hidden] {
  display: none;
}

.new-chat-button {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 34px 0 24px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--yellow);
  color: #111;
  box-shadow: none;
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: 0;
  text-align: left;
  transition:
    transform var(--motion-med) ease,
    background var(--motion-med) ease;
}

.new-chat-button:hover {
  background: #ffec3d;
  transform: translateY(-1px);
}

.new-chat-button span {
  font-size: var(--fs-lg);
  line-height: 1;
}

.archive-toggle-button {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  justify-self: start;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 700;
  transition:
    background var(--motion-med) ease,
    border-color var(--motion-med) ease,
    color var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.archive-toggle-button:hover,
.archive-toggle-button.active {
  border-color: rgba(255, 225, 0, 0.34);
  background: rgba(255, 225, 0, 0.08);
  color: rgba(255, 255, 255, 0.88);
  transform: translateY(-1px);
}

.archive-toggle-icon {
  width: 12px;
  height: 10px;
  border: 2px solid currentColor;
  border-top-width: 4px;
  border-radius: var(--radius-xs);
  opacity: 0.78;
}

.history-list {
  display: grid;
  grid-auto-rows: 54px;
  align-content: start;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 18px;
  mask-image: linear-gradient(to bottom, black calc(100% - 32px), transparent 100%);
  scrollbar-width: none;
}

.history-list::-webkit-scrollbar {
  display: none;
}

.history-bottom-links {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.sidebar-user-panel {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 30px;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.024)),
    rgba(255, 255, 255, 0.032);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 12px 26px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(18px) saturate(1.08);
}

.sidebar-avatar-button {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 225, 0, 0.58);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.72), transparent 0 16px),
    linear-gradient(145deg, rgba(255, 225, 0, 0.92), rgba(255, 248, 183, 0.74));
  color: #1c1c1c;
  cursor: pointer;
  font-size: var(--fs-lg);
  font-weight: 900;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 8px 16px rgba(0, 0, 0, 0.18);
}

.sidebar-avatar-button:hover,
.sidebar-avatar-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.72);
  outline: none;
}

.sidebar-avatar-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-meta {
  min-width: 0;
}

.sidebar-user-name {
  overflow: hidden;
  color: #fffdf7;
  font-size: var(--fs-base);
  font-weight: 900;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-points {
  overflow: hidden;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.58);
  font-size: var(--fs-xs);
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-menu-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 900;
  letter-spacing: 1px;
  transition:
    background var(--motion-med) ease,
    color var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.sidebar-user-menu-button:hover,
.sidebar-user-menu-button:focus-visible,
.sidebar-user-menu-button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fffdf7;
  outline: none;
  transform: translateY(-1px);
}

.sidebar-user-menu {
  position: absolute;
  right: 8px;
  bottom: calc(100% + 7px);
  z-index: 3;
  display: grid;
  width: 116px;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(38, 38, 38, 0.94);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
}

.sidebar-user-menu-item {
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 850;
  text-align: left;
  padding: 0 10px;
}

.sidebar-user-menu-item:hover,
.sidebar-user-menu-item:focus-visible {
  background: rgba(255, 225, 0, 0.14);
  color: #fffbe0;
  outline: none;
}

.sidebar-user-menu-item:disabled {
  cursor: wait;
  opacity: 0.58;
}

.sidebar-tools-panel {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.048), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.026);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.075),
    0 10px 24px rgba(0, 0, 0, 0.1);
}

.sidebar-tools-title {
  min-height: 31px;
  padding: 8px 12px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.68);
  font-size: var(--fs-sm);
  font-weight: 900;
}

.history-bottom-links a.sidebar-bottom-link {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--fs-sm);
  font-weight: 900;
  line-height: 1.35;
  text-align: left;
  text-decoration: none;
  box-shadow: none;
}

.history-bottom-links a.sidebar-bottom-link:last-child {
  border-bottom: 0;
}

.history-bottom-links a.sidebar-bottom-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fffdf7;
}

.history-bottom-links a.sidebar-admin-link {
  background: linear-gradient(135deg, rgba(255, 225, 0, 0.98), rgba(255, 238, 82, 0.88));
  color: #151515;
  border-bottom: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 10px 24px rgba(255, 225, 0, 0.12);
}

.history-bottom-links a.sidebar-admin-link:hover {
  background: linear-gradient(135deg, #ffec3d, #ffe100);
  color: #111;
}

.sidebar-admin-link .sidebar-link-icon,
.sidebar-admin-link .sidebar-link-arrow,
.sidebar-admin-link:hover .sidebar-link-icon,
.sidebar-admin-link:hover .sidebar-link-arrow {
  color: rgba(17, 17, 17, 0.82);
}

.sidebar-link-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-link-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-link-arrow {
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--fs-xl);
  font-weight: 400;
  line-height: 1;
  text-align: right;
}

.sidebar-bottom-link:hover .sidebar-link-icon,
.sidebar-bottom-link:hover .sidebar-link-arrow {
  color: rgba(255, 255, 255, 0.88);
}

.sidebar-version {
  margin: -2px 0 0;
  color: rgba(255, 255, 255, 0.34);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
}

.profile-open {
  overflow: hidden;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.profile-modal[hidden] {
  display: none;
}

.profile-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.42);
  backdrop-filter: blur(18px);
  animation: profileBackdropIn var(--motion-med) ease both;
}

.profile-dialog {
  position: relative;
  z-index: 1;
  width: min(680px, calc(100vw - 32px));
  max-height: min(780px, calc(var(--app-viewport-height) - 48px));
  overflow: auto;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 253, 247, 0.62) 55%, rgba(255, 225, 0, 0.09)),
    rgba(255, 255, 255, 0.72);
  box-shadow:
    0 28px 86px rgba(23, 23, 23, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(28px) saturate(150%);
  animation: profileDialogIn var(--motion-med) cubic-bezier(0.2, 0.8, 0.2, 1) both;
  scrollbar-gutter: stable;
  scrollbar-color: rgba(117, 111, 98, 0.36) rgba(255, 255, 255, 0.28);
  scrollbar-width: thin;
}

.profile-dialog::-webkit-scrollbar {
  width: 8px;
}

.profile-dialog::-webkit-scrollbar-track {
  margin: 18px 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.28);
}

.profile-dialog::-webkit-scrollbar-thumb {
  border: 2px solid rgba(255, 255, 255, 0.36);
  border-radius: var(--radius-pill);
  background: rgba(117, 111, 98, 0.36);
}

.profile-dialog::-webkit-scrollbar-thumb:hover {
  background: rgba(117, 111, 98, 0.54);
}

@keyframes profileBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes profileDialogIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.profile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(23, 23, 23, 0.76);
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  transition:
    background-color var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.profile-close::before,
.profile-close::after {
  position: absolute;
  width: 12px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: currentColor;
  content: "";
}

.profile-close::before {
  transform: rotate(45deg);
}

.profile-close::after {
  transform: rotate(-45deg);
}

.profile-close:hover,
.profile-close:focus-visible {
  background: rgba(255, 225, 0, 0.22);
  box-shadow: 0 10px 24px rgba(31, 27, 18, 0.12);
  outline: none;
  transform: scale(1.04);
}

.profile-kicker {
  margin: 0 0 6px;
  color: rgba(117, 111, 98, 0.82);
  font-size: var(--fs-base);
  font-weight: 800;
}

.profile-dialog h2 {
  margin: 0 44px 20px 0;
  color: var(--ink);
  font-size: var(--fs-xxl);
  line-height: 1.24;
}

.profile-stats {
  display: grid;
  gap: 18px;
}

.profile-user-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 225, 0, 0.34);
  border-radius: var(--radius-md);
  background: rgba(255, 225, 0, 0.12);
}

.profile-user-summary span,
.profile-stat-card span,
.profile-recent-item span,
.profile-recent-item em {
  color: rgba(95, 88, 76, 0.82);
  font-size: var(--fs-sm);
  font-style: normal;
}

.profile-user-summary strong {
  color: var(--ink);
  font-size: var(--fs-lg);
}

.profile-stat-section {
  display: grid;
  gap: 10px;
}

.profile-stat-section h3 {
  margin: 0;
  color: rgba(23, 23, 23, 0.86);
  font-size: var(--fs-md);
  font-weight: 900;
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.profile-stat-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profile-cost-grid .profile-stat-card {
  min-height: 88px;
  background:
    linear-gradient(145deg, rgba(255, 225, 0, 0.14), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.58);
}

.profile-stat-card {
  display: grid;
  gap: 4px;
  min-height: 82px;
  padding: 13px;
  border: 1px solid rgba(226, 220, 205, 0.7);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.profile-stat-card strong {
  color: var(--ink);
  font-size: var(--fs-xl);
  line-height: 1.1;
}

.profile-stat-card em {
  color: rgba(117, 111, 98, 0.78);
  font-size: var(--fs-xs);
  font-style: normal;
}

.profile-recent-list {
  display: grid;
  gap: 8px;
}

.profile-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(226, 220, 205, 0.62);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.48);
}

.profile-recent-item div {
  display: grid;
  gap: 3px;
}

.profile-recent-item div:last-child {
  text-align: right;
}

.profile-recent-item strong {
  color: var(--ink);
  font-size: var(--fs-base);
}

.profile-recent-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 4px;
}

.profile-recent-pager button {
  min-width: 64px;
  height: 30px;
  border: 1px solid rgba(226, 220, 205, 0.72);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.62);
  color: rgba(23, 23, 23, 0.78);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 800;
  transition:
    background-color var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.profile-recent-pager button:not(:disabled):hover,
.profile-recent-pager button:not(:disabled):focus-visible {
  background: rgba(255, 225, 0, 0.2);
  outline: none;
  transform: translateY(-1px);
}

.profile-recent-pager button:disabled {
  cursor: default;
  opacity: 0.46;
}

.profile-recent-pager span {
  min-width: 52px;
  color: rgba(95, 88, 76, 0.78);
  font-size: var(--fs-sm);
  font-weight: 800;
  text-align: center;
}

.profile-empty,
.profile-error {
  margin: 0;
  color: rgba(95, 88, 76, 0.82);
  font-size: var(--fs-base);
}

.profile-error {
  color: var(--danger);
}

.history-row,
.history-item,
.history-empty {
  width: 100%;
  min-width: 0;
}

.history-item,
.history-empty {
  border: 0;
  background: transparent;
  text-align: left;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
  height: 54px;
  min-height: 42px;
  padding: 5px 6px 5px 10px;
  border: 1px solid rgba(255, 225, 0, 0.34);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(255, 255, 255, 0.035);
  color: #f5f5f5;
  transition:
    background var(--motion-med) ease,
    border-color var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    color var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.history-item {
  display: flex;
  height: 100%;
  min-height: 0 !important;
  align-self: stretch;
  align-items: center;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: 800;
  line-height: 1.35;
}

.history-copy {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.kling-storyboard-shot [data-storyboard-delete] {
  width: 44px !important;
  min-width: 44px;
}

.history-delete {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  opacity: 0.34;
  transition:
    opacity var(--motion-med) ease,
    color var(--motion-med) ease,
    background var(--motion-med) ease,
    border-color var(--motion-med) ease;
}

.history-row:hover .history-delete,
.history-delete:focus-visible {
  opacity: 1;
}

.history-delete:hover,
.history-delete:focus-visible {
  border-color: rgba(255, 225, 0, 0.42);
  background: rgba(255, 225, 0, 0.12);
  color: #ffe100;
  outline: none;
}

.history-delete svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-row:hover,
.history-row.active {
  border-color: rgba(255, 225, 0, 0.86);
  background:
    linear-gradient(145deg, rgba(255, 225, 0, 0.1), rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.045);
  color: #fffdf7;
  box-shadow:
    inset 3px 0 0 rgba(255, 225, 0, 0.95),
    0 10px 24px rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}

.history-row.active {
  border-color: rgba(255, 225, 0, 0.95);
  background:
    linear-gradient(145deg, rgba(255, 225, 0, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.05);
  color: #fffdf7;
}

.history-row-archived {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.archive-note {
  margin: 4px 2px 0;
  color: rgba(255, 255, 255, 0.42);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.history-title {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  padding-left: 1px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  display: inline-flex;
  flex: 0 0 auto;
  margin-top: 0;
  overflow: hidden;
  color: #bdbdbd;
  font-size: var(--fs-xs);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-empty {
  padding: 12px;
  color: #bdbdbd;
  font-size: var(--fs-base);
  line-height: 1.55;
}

body.sidebar-collapsed .chat-layout {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed .history-sidebar {
  margin-left: calc(-1 * var(--app-sidebar-width));
  opacity: 0;
  pointer-events: none;
}

.chat-page {
  position: relative;
  display: grid;
  min-height: var(--app-viewport-height);
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, #f7f8f6 0%, #f4f6f2 54%, #eef3f1 100%);
  transition: padding var(--motion-med) ease;
}

.chat-disclaimer {
  position: absolute;
  right: 24px;
  bottom: 14px;
  left: 24px;
  margin: 0;
  color: rgba(95, 99, 108, 0.72);
  font-size: var(--fs-sm);
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}

body.is-chatting .chat-page {
  min-height: var(--app-viewport-height);
  align-items: stretch;
  justify-items: center;
  padding: 54px 24px 70px;
}

.chat-shell {
  position: relative;
  z-index: 10;
  display: grid;
  width: min(840px, 100%);
  max-height: calc(var(--app-viewport-height) - 48px);
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.scroll-latest-button {
  position: absolute;
  right: 50%;
  bottom: 174px;
  z-index: 6;
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.68);
  color: rgba(23, 23, 23, 0.82);
  box-shadow:
    0 18px 44px rgba(31, 27, 18, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(150%);
  cursor: pointer;
  transform: translateX(50%);
}

.scroll-latest-button[hidden] {
  display: none;
}

.scroll-latest-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.is-chatting .chat-shell {
  width: min(860px, 100%);
  height: calc(var(--app-viewport-height) - 124px);
  max-height: none;
}

body.is-chat-empty .chat-shell {
  width: min(760px, 100%);
  height: auto;
  max-height: calc(var(--app-viewport-height) - 48px);
}

.chat-shell::before {
  display: none;
}

.message-list {
  display: grid;
  min-height: 0;
  align-content: end;
  gap: 14px;
  overflow-y: auto;
  padding: 8px 10px 8px 2px;
  scrollbar-color: rgba(89, 83, 66, 0.42) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.message-list::-webkit-scrollbar {
  width: 9px;
}

.message-list::-webkit-scrollbar-track {
  background: transparent;
}

.message-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  background: rgba(89, 83, 66, 0.36);
  background-clip: padding-box;
}

.message-list::-webkit-scrollbar-thumb:hover {
  background: rgba(62, 57, 45, 0.54);
  background-clip: padding-box;
}

body.is-chatting .message-list {
  align-content: start;
  gap: 18px;
  padding: 22px 10px 8px 2px;
}

.message-list:empty {
  display: none;
}

.chat-loading {
  justify-self: center;
  align-self: center;
  max-width: min(520px, 92%);
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  text-align: center;
  font-size: var(--fs-md);
  line-height: 1.7;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

.chat-loading button {
  margin-top: 10px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--ink-1);
  background: var(--ink-1);
  color: #fffdf7;
  font-size: var(--fs-base);
  font-weight: 800;
}

.chat-loading button:hover {
  background: var(--charcoal);
}

.chat-history-loading {
  display: inline-grid;
  gap: 8px;
  min-width: min(300px, 86vw);
  padding: 18px 20px;
  border-color: rgba(255, 255, 255, 0.76);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(232, 248, 255, 0.46) 58%, rgba(255, 247, 176, 0.28)),
    rgba(255, 255, 255, 0.54);
  color: rgba(24, 30, 39, 0.72);
  box-shadow:
    0 14px 34px rgba(21, 27, 35, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  animation: chatHistoryLoadingIn var(--motion-med) cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.chat-history-loading strong {
  color: rgba(17, 24, 39, 0.9);
  font-size: var(--fs-md);
  font-weight: 900;
}

.chat-history-loading small {
  color: rgba(75, 85, 99, 0.72);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.chat-history-loader {
  display: inline-flex;
  justify-content: center;
  gap: 6px;
}

.chat-history-loader i {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: #ffe100;
  box-shadow: 0 0 14px rgba(255, 225, 0, 0.45);
  animation: chatHistoryPulse 900ms ease-in-out infinite;
}

.chat-history-loader i:nth-child(2) {
  animation-delay: 120ms;
}

.chat-history-loader i:nth-child(3) {
  animation-delay: 240ms;
}

.message-list.is-restoring-history .message {
  opacity: 0;
  filter: blur(8px) saturate(0.92);
  transform: translateY(12px) scale(0.992);
}

.message-list.is-history-ready .message {
  opacity: 0;
  animation: chatHistoryReveal var(--motion-slow) var(--ease-out) both;
  animation-delay: var(--history-reveal-delay, 0ms);
  will-change: opacity, transform, filter;
}

@keyframes chatHistoryPulse {
  0%,
  100% {
    opacity: 0.36;
    transform: translateY(0) scale(0.82);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px) scale(1);
  }
}

@keyframes chatHistoryLoadingIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chatHistoryReveal {
  from {
    opacity: 0;
    filter: blur(10px) saturate(0.9);
    transform: translateY(18px) scale(0.992);
  }
  62% {
    opacity: 1;
    filter: blur(1.5px) saturate(1.04);
  }
  to {
    opacity: 1;
    filter: blur(0) saturate(1);
    transform: translateY(0);
  }
}

.chat-shell:has(.message-list:empty) {
  width: min(840px, 100%);
  height: auto;
  grid-template-rows: auto auto;
}

.message {
  max-width: min(760px, 100%);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  line-height: 1.75;
  font-size: var(--fs-lg);
  letter-spacing: 0;
  backdrop-filter: none;
  white-space: normal;
  overflow-wrap: anywhere;
  content-visibility: auto;
  contain-intrinsic-size: auto 220px;
}

.message.user {
  justify-self: end;
  display: grid;
  justify-items: end;
}

.message.assistant {
  justify-self: start;
  width: min(760px, 100%);
}

.message-content {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.68), rgba(255, 253, 247, 0.38)),
    rgba(255, 253, 247, 0.54);
  backdrop-filter: blur(20px) saturate(136%);
  white-space: pre-wrap;
}

.message.assistant .message-content {
  background: transparent;
  border-color: transparent;
  border-radius: 0;
  backdrop-filter: none;
  color: rgba(23, 23, 23, 0.92);
  padding: 0;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
}

.message.assistant .message-content > :first-child {
  margin-top: 0;
}

.message.assistant .message-content > :last-child {
  margin-bottom: 0;
}

.message.assistant .message-content p {
  margin: 0 0 14px;
  line-height: 1.75;
}

.message.assistant .message-content h2,
.message.assistant .message-content h3,
.message.assistant .message-content h4 {
  margin: 24px 0 10px;
  color: rgba(18, 18, 18, 0.96);
  font-weight: 700;
  line-height: 1.35;
}

.message.assistant .message-content h2 {
  font-size: var(--fs-xl);
}

.message.assistant .message-content h3 {
  font-size: var(--fs-lg);
}

.message.assistant .message-content h4 {
  font-size: var(--fs-lg);
}

.message.assistant .message-content ul,
.message.assistant .message-content ol {
  margin: 0 0 14px;
  padding-left: 1.35em;
}

.message.assistant .message-content li {
  margin: 6px 0;
  line-height: 1.75;
}

.message.assistant .message-content strong {
  font-weight: 700;
  color: rgba(15, 15, 15, 0.98);
}

.message.assistant .message-content a {
  color: #146b5a;
  text-decoration-color: rgba(20, 107, 90, 0.36);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.message.assistant .message-content a:hover {
  color: #0e5144;
  text-decoration-color: currentColor;
}

.message.assistant .message-content a:focus-visible {
  border-radius: var(--radius-xs);
  outline: 2px solid rgba(20, 107, 90, 0.46);
  outline-offset: 3px;
}

.message.assistant .message-content em {
  color: rgba(55, 55, 55, 0.9);
}

.message.assistant .message-content code {
  padding: 2px 5px;
  border: 1px solid rgba(218, 212, 196, 0.84);
  border-radius: var(--radius-xs);
  background: rgba(255, 250, 224, 0.72);
  color: rgba(32, 30, 24, 0.95);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
  overflow-wrap: normal;
  word-break: normal;
}

.message.assistant .message-content pre {
  margin: 12px 0 16px;
  padding: 13px 14px;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(210, 205, 190, 0.82);
  border-radius: var(--radius-sm);
  background: rgba(255, 251, 235, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.message.assistant .message-content pre code {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  line-height: 1.62;
}

.message.assistant .message-content .markdown-table-wrap {
  max-width: 100%;
  margin: 14px 0 16px;
  overflow-x: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.message.assistant .message-content table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: var(--fs-md);
  line-height: 1.55;
}

.message.assistant .message-content th,
.message.assistant .message-content td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(218, 212, 196, 0.72);
  border-right: 0;
  text-align: left;
  vertical-align: top;
}

.message.assistant .message-content th:last-child,
.message.assistant .message-content td:last-child {
  border-right: 0;
}

.message.assistant .message-content tr:last-child td {
  border-bottom: 0;
}

.message.assistant .message-content th {
  background: transparent;
  color: rgba(20, 20, 18, 0.96);
  font-weight: 700;
}

.vjshi-history-result {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 12px;
}

.vjshi-result-narrative > :last-child {
  margin-bottom: 2px !important;
}

.vjshi-result-summary {
  display: flex;
  min-width: 0;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 10px;
  border-bottom: 1px solid rgba(197, 190, 169, 0.72);
}

.vjshi-result-summary > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.vjshi-result-summary span {
  color: rgba(93, 83, 50, 0.76);
  font-size: var(--fs-sm);
  font-weight: 800;
  line-height: 1.4;
}

.vjshi-result-summary strong {
  font-size: var(--fs-lg);
  line-height: 1.5;
}

.vjshi-result-summary small {
  max-width: 42%;
  color: rgba(65, 65, 61, 0.62);
  font-size: var(--fs-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: right;
}

.vjshi-project-result {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(205, 199, 180, 0.74);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.46);
  box-shadow: 0 8px 24px rgba(47, 43, 33, 0.05);
}

.vjshi-project-heading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(213, 207, 189, 0.66);
  background: rgba(249, 247, 239, 0.72);
}

.message.assistant .message-content .vjshi-project-heading h3 {
  margin: 0;
  font-size: var(--fs-md);
  line-height: 1.5;
}

.vjshi-project-index {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(167, 149, 76, 0.34);
  border-radius: var(--radius-xs);
  background: rgba(255, 225, 0, 0.13);
  color: rgba(90, 74, 16, 0.82);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.vjshi-project-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 2px;
  color: rgba(63, 63, 58, 0.58);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.vjshi-match-badge {
  align-self: start;
  padding: 3px 7px;
  border: 1px solid rgba(20, 107, 90, 0.22);
  border-radius: var(--radius-pill);
  background: rgba(20, 107, 90, 0.07);
  color: #146b5a;
  font-size: var(--fs-xs);
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
}

.vjshi-match-badge.is-fuzzy {
  border-color: rgba(178, 116, 0, 0.24);
  background: rgba(255, 189, 46, 0.1);
  color: #865700;
}

.vjshi-material-list {
  display: grid;
  min-width: 0;
}

.vjshi-material-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.82fr) minmax(0, 1.6fr);
  min-width: 0;
  gap: 18px;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(220, 215, 201, 0.68);
}

.vjshi-material-row:last-child {
  border-bottom: 0;
}

.vjshi-material-heading {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 5px;
}

.message.assistant .message-content .vjshi-material-name {
  color: rgba(23, 23, 21, 0.95);
  font-size: var(--fs-md);
  font-weight: 750;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.message.assistant .message-content .vjshi-material-name:hover {
  color: #146b5a;
  text-decoration: underline;
}

.message.assistant .message-content .vjshi-material-id {
  width: fit-content;
  color: #146b5a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.45;
}

.vjshi-material-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: 9px 16px;
  margin: 0;
}

.vjshi-material-facts > div {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 2px;
}

.vjshi-material-facts dt {
  color: rgba(70, 69, 62, 0.54);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.35;
}

.vjshi-material-facts dd {
  min-width: 0;
  margin: 0;
  color: rgba(31, 31, 29, 0.88);
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.vjshi-material-cost dd {
  font-weight: 750;
}

.vjshi-empty-result,
.vjshi-result-note {
  margin: 0;
  padding: 13px 14px;
  border: 1px solid rgba(205, 199, 180, 0.68);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.42);
  color: rgba(57, 57, 53, 0.68);
  font-size: var(--fs-base);
  line-height: 1.6;
}

.vjshi-result-note {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: var(--fs-sm);
}

.message.assistant .message-content hr {
  height: 1px;
  margin: 18px 0;
  border: 0;
  background: rgba(210, 204, 188, 0.72);
}

.message.assistant.has-media-pending .message-content,
.message.assistant.has-document-pending .message-content {
  display: none;
}

.message-time {
  display: block;
  margin-top: 5px;
  color: rgba(95, 99, 108, 0.58);
  font-size: var(--fs-xs);
  line-height: 1.2;
  text-align: left;
}

.message.user .message-time {
  text-align: right;
}

.search-sources {
  margin: 6px 0 2px;
  font-size: var(--fs-base);
  color: #999;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
}

.search-sources .source-link {
  color: #4a90d9;
  text-decoration: none;
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.search-sources .source-link:hover {
  text-decoration: underline;
  color: #2b6cb0;
}

.message.user .message-content {
  display: inline-block;
  max-width: min(560px, 100%);
  text-align: left;
  border-color: rgba(255, 225, 0, 0.95);
  background:
    linear-gradient(145deg, rgba(255, 244, 97, 0.98), rgba(255, 225, 0, 0.92));
  color: #181300;
  box-shadow:
    0 10px 22px rgba(255, 225, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.generated-images {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.generated-image-card {
  display: grid;
  gap: 9px;
  margin: 0;
  max-width: min(560px, 100%);
}

.generated-image-link {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(210, 216, 214, 0.92);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  box-shadow:
    0 18px 38px rgba(26, 35, 37, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  cursor: zoom-in;
}

.generated-image-link img {
  display: block;
  width: 100%;
  height: auto;
}

.generated-image-link[style*="aspect-ratio"] img {
  height: 100%;
  object-fit: contain;
}

.generated-image-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  align-items: center;
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.generated-image-toolbar::-webkit-scrollbar {
  display: none;
}

.generated-image-tool {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(198, 205, 203, 0.88);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(23, 28, 30, 0.82);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 850;
  line-height: 1;
  padding: 0 11px 0 9px;
  transition:
    transform var(--motion-med) ease,
    background var(--motion-med) ease,
    border-color var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    color var(--motion-med) ease;
}

.generated-image-tool:hover,
.generated-image-tool:focus-visible,
.generated-image-tool.is-done {
  border-color: rgba(255, 225, 0, 0.7);
  background: rgba(255, 248, 178, 0.82);
  color: #171717;
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(29, 35, 36, 0.12);
}

.generated-image-tool.is-failed {
  border-color: rgba(220, 38, 38, 0.42);
  background: rgba(254, 226, 226, 0.86);
  color: #991b1b;
}

.generated-image-tool svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.media-seq-shell {
  position: relative;
  isolation: isolate;
}

.media-seq-shell img,
.media-seq-shell video {
  opacity: 0;
  transition: opacity var(--motion-med) ease;
}

.media-seq-shell.is-loaded img,
.media-seq-shell.is-loaded video {
  opacity: 1;
}

.media-seq-shell.is-waiting,
.media-seq-shell.is-loading {
  min-height: 132px;
}

.message.user .media-seq-shell.is-waiting,
.message.user .media-seq-shell.is-loading {
  min-height: 72px;
}

.media-seq-loader {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(244, 239, 225, 0.86) 0%, rgba(255, 253, 247, 0.96) 48%, rgba(244, 239, 225, 0.86) 100%);
  background-size: 220% 100%;
  opacity: 1;
  animation: chatMediaShimmer 1.25s infinite linear;
  transition: opacity var(--motion-med) ease;
}

.media-seq-loader::before,
.media-seq-loader::after,
.media-seq-loader i {
  content: "";
  position: absolute;
  border-radius: var(--radius-pill);
  background: rgba(255, 225, 0, 0.55);
  box-shadow: 0 0 24px rgba(255, 225, 0, 0.22);
}

.media-seq-loader::before {
  width: 38%;
  height: 10px;
  left: 18px;
  bottom: 18px;
}

.media-seq-loader::after {
  width: 68px;
  height: 68px;
  right: 18px;
  top: 18px;
  opacity: 0.55;
}

.media-seq-loader i {
  width: 46%;
  height: 8px;
  left: 18px;
  bottom: 36px;
  opacity: 0.48;
}

.media-seq-shell.is-loaded .media-seq-loader,
.media-seq-shell.is-error .media-seq-loader {
  opacity: 0;
  pointer-events: none;
}

.media-seq-label {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  padding: 4px 8px;
  border: 1px solid rgba(255, 225, 0, 0.5);
  border-radius: var(--radius-pill);
  background: rgba(24, 19, 0, 0.76);
  color: #fff8c9;
  font-size: var(--fs-xs);
  font-weight: 800;
  line-height: 1.2;
  transition: opacity var(--motion-med) ease;
}

.media-seq-shell.is-loading .media-seq-label::after {
  content: "";
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: chatMediaDots 1.1s infinite steps(4, end);
}

.media-seq-shell.is-loaded .media-seq-label {
  opacity: 0;
  pointer-events: none;
}

.media-seq-shell.is-error .media-seq-label {
  border-color: rgba(180, 35, 24, 0.34);
  background: rgba(180, 35, 24, 0.88);
  color: #fffdf7;
}


.user-attachments {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.user-attachment-card {
  width: 72px;
  height: 72px;
  margin: 0;
}

.user-attachment-link {
  display: block;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid rgba(255, 225, 0, 0.72);
  border-radius: var(--radius-sm);
  background: rgba(255, 246, 166, 0.32);
  box-shadow: 0 8px 18px rgba(31, 27, 18, 0.1);
  cursor: zoom-in;
}

.user-attachment-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-documents {
  display: grid;
  justify-content: end;
  gap: 6px;
  margin-top: 8px;
}

.user-document-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: min(320px, 78vw);
  padding: 8px;
  border: 1px solid rgba(255, 225, 0, 0.72);
  border-radius: var(--radius-sm);
  background: rgba(255, 246, 166, 0.32);
  box-shadow: 0 8px 18px rgba(31, 27, 18, 0.1);
}

.user-document-icon,
.attachment-doc-icon {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(24, 19, 0, 0.88);
  color: #fff8c9;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0;
}

.user-document-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.user-document-copy strong,
.user-document-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-document-copy strong {
  font-size: var(--fs-base);
}

.user-document-copy small {
  color: rgba(24, 19, 0, 0.68);
  font-size: var(--fs-xs);
}

.attachment-chip-document .attachment-thumb {
  display: none;
}

.attachment-chip-document .attachment-doc-icon {
  min-width: 38px;
  height: 30px;
}

.attachment-chip-audio .attachment-doc-icon {
  min-width: 44px;
  height: 30px;
  font-size: var(--fs-xs);
}

.user-audio-attachments {
  display: grid;
  justify-content: end;
  gap: 6px;
  margin-top: 8px;
}

.user-audio-card {
  display: grid;
  gap: 5px;
  width: min(360px, 78vw);
  padding: 9px;
  border: 1px solid rgba(255, 225, 0, 0.72);
  border-radius: var(--radius-sm);
  background: rgba(255, 246, 166, 0.32);
  box-shadow: 0 8px 18px rgba(31, 27, 18, 0.1);
}

.user-audio-card span {
  font-size: var(--fs-sm);
  color: rgba(24, 19, 0, 0.72);
}

.user-audio-card audio {
  width: 100%;
  min-width: 0;
  height: 36px;
}
.message.user .generated-images {
  justify-items: end;
  gap: 6px;
  margin-top: 8px;
}

.message.user .generated-image-card {
  width: min(132px, 34vw);
  max-width: 132px;
}

.message.user .generated-image-link {
  border-color: rgba(255, 225, 0, 0.7);
  border-radius: var(--radius-sm);
  background: rgba(255, 246, 166, 0.32);
  box-shadow: 0 8px 18px rgba(31, 27, 18, 0.1);
}

.message.user .generated-image-link img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.generated-videos {
  display: grid;
  width: min(640px, 100%);
  gap: 10px;
  margin-top: 12px;
}

.generated-documents {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.generated-document-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  width: min(380px, 100%);
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(226, 220, 205, 0.82);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.76);
  color: rgba(23, 23, 23, 0.9);
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(31, 27, 18, 0.08);
  transition:
    border-color var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    transform var(--motion-med) ease;
}

.generated-document-icon {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(24, 19, 0, 0.88);
  color: #fff8c9;
  font-size: var(--fs-xs);
  font-weight: 850;
}

.generated-document-copy {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 2px;
}

.generated-document-copy strong,
.generated-document-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-document-copy small {
  color: rgba(95, 99, 108, 0.72);
  font-size: var(--fs-sm);
}

.generated-video-card {
  display: grid;
  width: 100%;
  gap: 8px;
  margin: 0;
  max-width: min(640px, 100%);
}

.video-media-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 132px;
  max-height: 360px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f4efe1 0%, #fffdf7 48%, #e8f2ef 100%);
  cursor: pointer;
}

.video-poster,
.video-poster-placeholder {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  object-fit: cover;
  pointer-events: none;
}

.video-poster-placeholder {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 28%, rgba(255, 225, 0, 0.34), transparent 35%),
    linear-gradient(135deg, rgba(247, 242, 226, 0.98), rgba(226, 241, 235, 0.94));
  color: rgba(35, 50, 47, 0.68);
  z-index: 0;
}

.video-poster-placeholder::before {
  content: "";
  position: absolute;
  inset: -30% -20%;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.64) 50%, transparent 65%);
  transform: translateX(-58%);
  animation: videoPosterShimmer 2.4s ease-in-out infinite;
}

.video-poster-status {
  position: relative;
  z-index: 1;
  padding: 7px 11px;
  border: 1px solid rgba(42, 73, 67, 0.16);
  border-radius: var(--radius-pill);
  background: rgba(255, 253, 247, 0.74);
  box-shadow: 0 8px 20px rgba(42, 73, 67, 0.08);
  font-size: var(--fs-sm);
  font-weight: 750;
  letter-spacing: 0.02em;
}

.video-poster {
  z-index: 1;
  background: transparent;
  transition: opacity var(--motion-med) ease, visibility var(--motion-med) ease;
}

.video-play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: rgba(18, 18, 18, 0.72);
  color: #fff;
  z-index: 3;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform var(--motion-med) ease, background-color var(--motion-med) ease;
}

.video-play-button:hover,
.video-play-button:focus-visible {
  background: rgba(255, 225, 0, 0.92);
  color: #171717;
  transform: translate(-50%, -50%) scale(1.06);
}

.video-play-button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.5;
}

.video-media-shell.is-loading .video-play-button {
  opacity: 0.55;
  pointer-events: none;
}

.video-media-shell.is-frame-ready .video-poster,
.video-media-shell.is-frame-ready .video-poster-placeholder {
  opacity: 0;
  visibility: hidden;
}

.video-media-shell.is-playing {
  cursor: default;
}

.media-seq-shell.video-media-shell video {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  opacity: 0;
  transition: opacity var(--motion-med) ease;
  cursor: default;
}

.media-seq-shell.video-media-shell.is-frame-ready video {
  opacity: 1;
}

@keyframes videoPosterShimmer {
  0%, 24% { transform: translateX(-58%); opacity: 0; }
  42% { opacity: 1; }
  72%, 100% { transform: translateX(58%); opacity: 0; }
}

.generated-video-card video {
  display: block;
  border: 1px solid rgba(226, 220, 205, 0.72);
  border-radius: var(--radius-md);
  background: #111;
  box-shadow: 0 14px 34px rgba(31, 27, 18, 0.08);
}

.generated-video-card .media-seq-shell.is-waiting video,
.generated-video-card .media-seq-shell.is-loading video {
  min-height: 0;
}

.document-pending-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  width: min(390px, 100%);
  margin-top: 0;
  padding: 12px;
  border: 1px solid rgba(169, 201, 192, 0.74);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(236, 251, 247, 0.78)),
    rgba(255, 255, 255, 0.72);
  box-shadow:
    0 10px 24px rgba(26, 53, 48, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.document-pending-card::after {
  content: "";
  position: absolute;
  inset: -45% auto -45% -40%;
  z-index: 0;
  width: 42%;
  pointer-events: none;
  transform: skewX(-18deg);
  background:
    linear-gradient(90deg,
      rgba(255, 255, 255, 0),
      rgba(255, 255, 255, 0.92),
      rgba(156, 221, 210, 0.62),
      rgba(255, 255, 255, 0.68),
      rgba(255, 255, 255, 0));
  filter: blur(0.5px);
  animation: documentPendingShine 2.2s ease-in-out infinite;
}

.document-pending-icon {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 6px;
  width: 58px;
  height: 66px;
  padding: 13px 10px 10px;
  overflow: hidden;
  border: 1px solid rgba(48, 130, 112, 0.24);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 251, 247, 0.84));
  box-shadow: 0 8px 16px rgba(26, 53, 48, 0.08);
}

.document-pending-icon::before {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 18px;
  height: 18px;
  border-left: 1px solid rgba(48, 130, 112, 0.26);
  border-bottom: 1px solid rgba(48, 130, 112, 0.26);
  border-bottom-left-radius: 5px;
  background: linear-gradient(135deg, rgba(207, 239, 231, 0.95), rgba(255, 255, 255, 0.96));
}

.document-pending-icon span {
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(48, 130, 112, 0.34);
  transform-origin: left center;
  animation: documentPendingLine 1.45s ease-in-out infinite;
}

.document-pending-icon span:nth-child(2) {
  width: 78%;
  animation-delay: 0.16s;
}

.document-pending-icon span:nth-child(3) {
  width: 56%;
  animation-delay: 0.32s;
}

.document-pending-copy {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 5px;
}

.document-pending-copy strong {
  color: rgba(24, 47, 43, 0.92);
  font-size: var(--fs-lg);
  line-height: 1.2;
}

.document-pending-copy span {
  color: rgba(69, 86, 82, 0.78);
  font-size: var(--fs-base);
  line-height: 1.42;
}

.document-pending-copy em {
  position: relative;
  display: block;
  width: min(210px, 100%);
  height: 6px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(48, 130, 112, 0.14);
}

.document-pending-copy em i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(48, 130, 112, 0), rgba(48, 130, 112, 0.78), rgba(230, 183, 55, 0.78));
  animation: documentPendingProgress 1.55s ease-in-out infinite;
}

.media-pending-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  width: min(390px, 100%);
  margin-top: 0;
  padding: 12px;
  border: 1px solid rgba(32, 30, 25, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.96);
  box-shadow: 0 5px 16px rgba(31, 27, 18, 0.06);
  transform: translateZ(0);
  transition:
    opacity var(--motion-med) ease,
    transform var(--motion-med) ease,
    border-color var(--motion-med) ease;
  will-change: opacity, transform;
}

.media-pending-card.is-completing {
  opacity: 0;
  transform: translateY(-3px) scale(0.992);
}

.media-pending-card.is-failing {
  border-color: rgba(180, 35, 24, 0.28);
  opacity: 0;
  transform: translateY(-2px) scale(0.994);
}

.media-pending-tile {
  position: relative;
  width: 58px;
  height: 66px;
  overflow: hidden;
  border: 1px solid rgba(32, 30, 25, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 225, 0, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  isolation: isolate;
}

.media-pending-tile::before,
.media-pending-tile::after,
.media-pending-tile span {
  content: "";
  position: absolute;
  inset: -28%;
  pointer-events: none;
}

.media-pending-tile::before {
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.8) 50%, transparent 70%);
  transform: translateX(-64%) rotate(8deg);
  animation: mediaPendingSweep 2.9s cubic-bezier(0.45, 0, 0.2, 1) infinite;
  animation-delay: var(--media-motion-delay, 0s);
}

.media-pending-tile::after {
  inset: 5px;
  border: 1px solid rgba(32, 30, 25, 0.08);
  border-radius: var(--radius-xs);
  box-shadow: inset 10px 10px 28px rgba(255, 255, 255, 0.3);
}

.media-pending-tile span {
  display: none;
}

.media-pending-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.media-pending-copy strong {
  color: rgba(23, 23, 23, 0.9);
  font-size: var(--fs-lg);
  line-height: 1.2;
}

.media-pending-title::after {
  content: "";
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: chatMediaDots 1.1s steps(4, end) infinite;
  animation-delay: var(--media-motion-delay, 0s);
}

.media-pending-copy span {
  color: rgba(82, 82, 82, 0.74);
  font-size: var(--fs-base);
  line-height: 1.42;
}

.media-pending-copy:not(:has(.media-progress-track)) > span {
  color: transparent;
  font-size: 0;
  line-height: 0;
}

.media-pending-copy:not(:has(.media-progress-track)) > span::after {
  content: "";
  display: block;
  width: min(230px, 100%);
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, rgba(255, 225, 0, 0.9), rgba(255, 246, 166, 0.9), rgba(42, 42, 38, 0.46));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 0 16px var(--glow-accent);
  transform: scaleX(0.12) translateZ(0);
  transform-origin: left center;
  will-change: transform;
  animation: mediaProgressFallback 2.8s ease-in-out infinite;
}

.media-pending-copy small {
  color: rgba(82, 82, 82, 0.58);
  font-size: var(--fs-sm);
  font-weight: 750;
  line-height: 1.2;
}

.media-pending-copy .media-progress-estimate {
  color: rgba(82, 82, 82, 0.52);
  font-size: var(--fs-xs);
  font-weight: 650;
}

.media-pending-card .media-progress-estimate {
  display: block;
  margin-top: -1px;
}

.media-progress-track {
  position: relative;
  width: min(230px, 100%);
  height: 7px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(36, 36, 36, 0.08);
  box-shadow: none;
  contain: paint;
}

.media-progress-track i {
  position: absolute;
  inset: 0 auto 0 -34%;
  width: 42%;
  border-radius: inherit;
  background: #ffe100;
  box-shadow: none;
  will-change: transform;
  animation: mediaPendingLine 1.8s ease-in-out infinite;
}

.media-progress-track i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -45%;
  width: 42%;
  border-radius: inherit;
  background: rgba(255,255,255,.72);
  animation: mediaPendingLine 1.8s ease-in-out infinite reverse;
  animation-delay: var(--media-motion-delay, 0s);
}

.media-progress-track.is-queued i {
  opacity: 0.55;
  animation-duration: 2.4s;
}

.media-pending-copy em {
  width: fit-content;
  margin-top: 3px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 225, 0, 0.2);
  color: rgba(74, 68, 8, 0.75);
  font-size: var(--fs-sm);
  font-style: normal;
  line-height: 1.2;
}

@keyframes mediaPendingSweep {
  0% {
    transform: translateX(-72%) rotate(8deg);
    opacity: 0;
  }
  16% {
    opacity: 1;
  }
  68% {
    opacity: 1;
  }
  100% {
    transform: translateX(76%) rotate(8deg);
    opacity: 0;
  }
}

@keyframes mediaPendingGlow {
  to {
    transform: rotate(1turn);
  }
}

@keyframes mediaProgressFallback {
  0% {
    transform: scaleX(0.08) translateZ(0);
  }
  55% {
    transform: scaleX(0.72) translateZ(0);
  }
  100% {
    transform: scaleX(0.95) translateZ(0);
  }
}

@keyframes chatMediaShimmer {
  0% {
    background-position: 220% 0;
  }
  100% {
    background-position: -220% 0;
  }
}

@keyframes chatMediaDots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

@keyframes mediaPendingLine {
  0%, 100% { transform: translateX(-35%) scaleX(0.28) translateZ(0); }
  50% { transform: translateX(250%) scaleX(0.5) translateZ(0); }
}

@keyframes mediaResultIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.is-media-result-entering .generated-images,
.message.is-media-result-entering .generated-videos {
  animation: mediaResultIn var(--motion-slow) cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes documentPendingLine {
  0%,
  100% {
    opacity: 0.44;
    transform: scaleX(0.62);
  }
  45% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes documentPendingProgress {
  0% {
    transform: translateX(-115%);
  }
  100% {
    transform: translateX(278%);
  }
}

@keyframes documentPendingShine {
  0% {
    transform: translateX(0) skewX(-18deg);
    opacity: 0;
  }
  18% {
    opacity: 0.86;
  }
  70% {
    opacity: 0.86;
  }
  100% {
    transform: translateX(360%) skewX(-18deg);
    opacity: 0;
  }
}

@keyframes messageActionPop {
  0% {
    transform: scale(0.9);
  }
  55% {
    transform: translateY(-1px) scale(1.08);
  }
  100% {
    transform: translateY(-1px) scale(1);
  }
}

@keyframes generatedDocumentShine {
  0% {
    transform: translateX(-155%) skewX(-18deg);
    opacity: 0;
  }
  18% {
    opacity: 0.72;
  }
  58% {
    opacity: 0.72;
  }
  100% {
    transform: translateX(280%) skewX(-18deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .document-pending-card::after,
  .media-pending-tile::before,
  .media-pending-tile span,
  .media-pending-copy:not(:has(.media-progress-track)) > span::after,
  .media-progress-track i::after,
  .media-progress-track i,
  .media-pending-title::after,
  .media-seq-loader,
  .video-poster-placeholder::before,
  .media-seq-shell.is-loading .media-seq-label::after,
  .document-pending-icon span,
  .document-pending-copy em i,
  .message-list.is-history-ready .message,
  .message.is-media-result-entering .generated-images,
  .message.is-media-result-entering .generated-videos {
    animation-duration: 0.01ms;
    animation-delay: 0ms;
    animation-iteration-count: 1;
    filter: none;
  }

  .media-progress-track i,
  .media-pending-card {
    transition: none;
  }

  .media-pending-title::after {
    content: "...";
  }

  .text-stream-thinking-label,
  .text-stream-thinking .typing span,
  .skill-invocation-status .typing span {
    animation: none;
  }

  .text-stream-thinking-label {
    background: none;
    color: var(--muted);
  }
}

@keyframes sendPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 225, 0, 0.42); }
  60% { box-shadow: 0 0 0 10px rgba(255, 225, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 225, 0, 0); }
}

@media (min-width: 761px) and (orientation: landscape) {
  .generated-document-card::after {
    content: "";
    position: absolute;
    inset: -52% auto -52% -38%;
    z-index: 0;
    width: 36%;
    pointer-events: none;
    background:
      linear-gradient(90deg,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0.82),
        rgba(255, 225, 0, 0.38),
        rgba(42, 42, 38, 0.08),
        rgba(255, 255, 255, 0));
    filter: blur(0.4px);
    animation: generatedDocumentShine 3.4s ease-in-out infinite;
  }
}

@media (min-width: 761px) and (orientation: landscape) and (hover: hover) {
  .generated-document-card:hover {
    border-color: rgba(255, 225, 0, 0.68);
    box-shadow:
      0 16px 34px rgba(31, 27, 18, 0.13),
      0 0 26px rgba(255, 225, 0, 0.16);
    transform: translateY(-1px);
  }
}

.image-preview-open {
  overflow: hidden;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-preview-modal[hidden] {
  display: none;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.62);
  backdrop-filter: blur(18px);
}

.image-preview-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  max-width: min(1080px, 92vw);
  max-height: min(860px, 88vh);
  place-items: center;
}

.image-preview-img {
  display: block;
  max-width: min(1080px, 92vw);
  max-height: min(820px, 86vh);
  border-radius: var(--radius-md);
  background: var(--bg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.image-preview-img[hidden] {
  display: none;
}

.image-preview-video {
  width: min(1080px, 92vw);
  object-fit: contain;
  background: #111;
}

.image-preview-close,
.image-preview-download {
  position: absolute;
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.82);
  color: #171717;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px) saturate(140%);
  cursor: pointer;
}

.image-preview-close {
  top: -14px;
  right: -14px;
}

.image-preview-download {
  right: -14px;
  bottom: -14px;
}

.image-preview-close svg,
.image-preview-download svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 640px) {
  .image-preview-modal {
    align-items: center;
    justify-items: center;
    padding:
      max(54px, env(safe-area-inset-top))
      16px
      max(78px, env(safe-area-inset-bottom))
      16px;
  }

  .image-preview-backdrop {
    background: rgba(17, 17, 17, 0.68);
    backdrop-filter: blur(16px) saturate(1.08);
  }

  .image-preview-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(var(--app-viewport-height) - 132px);
    place-items: center;
  }

  .image-preview-img {
    width: auto;
    max-width: calc(100vw - 32px);
    max-height: calc(var(--app-viewport-height) - 160px);
    object-fit: contain;
    border-radius: var(--radius-md);
    background: transparent;
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.3);
  }

  .image-preview-video {
    width: 100%;
    background: #111;
  }

  .image-preview-close,
  .image-preview-download {
    position: fixed;
    z-index: 2;
    width: 48px;
    height: 48px;
    border-color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.9);
  }

  .image-preview-close {
    top: max(14px, env(safe-area-inset-top));
    right: 14px;
  }

  .image-preview-download {
    right: 14px;
    bottom: max(18px, env(safe-area-inset-bottom));
  }
}

.composer:has(.skill-menu:not([hidden])) {
  z-index: 220;
}

.composer > .skill-menu {
  position: absolute;
  right: 12px;
  bottom: calc(100% + 60px);
  left: 12px;
  z-index: 230;
  display: grid;
  gap: 2px;
  max-height: min(264px, 45dvh);
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(48, 32, 20, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 248, 0.985);
  box-shadow: 0 24px 54px -30px rgba(45, 32, 23, 0.38);
  backdrop-filter: blur(16px) saturate(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
  animation: skillMenuIn var(--motion-med) ease-out both;
}

.skill-menu[hidden],
.skill-selection[hidden] {
  display: none;
}

.skill-menu button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: #211b17;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--motion-med) ease, color var(--motion-med) ease;
}

.skill-menu button[hidden] {
  display: none;
}

.skill-menu button:hover,
.skill-menu button.is-active {
  background: rgba(48, 32, 20, 0.06);
}

.skill-menu button:focus-visible {
  outline: 2px solid rgba(217, 191, 0, 0.72);
  outline-offset: -2px;
}

.skill-option-icon,
.skill-selection-icon {
  display: inline-flex;
  color: rgba(49, 42, 37, 0.68);
}

.skill-option-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skill-selection-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skill-menu button.is-selected .skill-option-icon {
  color: #7a6500;
}

.skill-option-copy {
  display: grid;
  grid-template-columns: minmax(150px, max-content) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  align-items: baseline;
}

.skill-menu strong {
  overflow: hidden;
  font-size: var(--fs-md);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-option-copy > span {
  min-width: 0;
  overflow: hidden;
  color: rgba(49, 42, 37, 0.62);
  font-size: var(--fs-base);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-input-row {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
}

.composer-input-row > textarea {
  min-width: 0;
  flex: 1 1 0;
}

.skill-selection {
  display: inline-flex;
  max-width: min(240px, 44%);
  min-width: 0;
  height: 28px;
  min-height: 28px;
  margin-top: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 0 1px 0 2px;
  color: #7a6500;
  font-size: var(--fs-base);
  font-weight: 700;
  line-height: 20px;
}

.skill-selection > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-selection button {
  position: relative;
  display: inline-flex;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px !important;
  align-items: center;
  justify-content: center;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(40, 31, 21, 0.56);
  cursor: pointer;
}

.skill-selection button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skill-selection button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%);
}

.skill-selection button:hover {
  background: rgba(48, 32, 20, 0.08);
  color: rgba(40, 31, 21, 0.82);
}

.skill-selection button:focus-visible {
  outline: 2px solid rgba(217, 191, 0, 0.72);
  outline-offset: 1px;
}

@keyframes skillMenuIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .skill-menu {
    right: 8px;
    left: 8px;
    max-height: min(236px, 40dvh);
  }

  .skill-menu button {
    min-height: 54px;
  }

  .skill-option-copy {
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
  }

  .skill-option-copy > span {
    font-size: var(--fs-sm);
    text-align: left;
  }

  .skill-selection {
    max-width: min(210px, 52%);
  }
}

/* Upload feedback keeps a stable attachment footprint while the server is
   receiving the file. The overlay owns status text; the remove action stays
   above it so users retain control during a slow or failed upload. */


.attachment-chip.has-upload {
  min-width: min(214px, 100%);
  height: 74px;
  min-height: 74px;
  padding-right: 8px;
  overflow: hidden;
}
.attachment-chip.has-upload > .attachment-thumb,
.attachment-chip.has-upload > .attachment-name {
  opacity: .28;
}
.attachment-chip.has-upload .media-upload-feedback {
  border-radius: inherit;
  background: rgba(255, 253, 247, .9);
  color: rgba(23, 23, 23, .88);
}
.attachment-chip.has-upload .media-upload-feedback[data-state="ready"] {
  display: none;
}
.attachment-chip.has-upload .media-upload-feedback[data-state="failed"],
.attachment-chip.has-upload .media-upload-feedback[data-state="canceled"] {
  background: rgba(255, 247, 247, .96);
}
.attachment-chip.has-upload .media-upload-feedback .media-upload-detail {
  max-width: min(188px, calc(100% - 12px));
}
.attachment-chip.has-upload > .attachment-remove {
  position: absolute;
  z-index: 12;
  top: 5px;
  right: 5px;
}
.attachment-chip.has-upload > .attachment-name {
  margin-right: 34px;
}
@media (max-width: 640px) {
  .attachment-chip.has-upload {
    width: 74px;
    min-width: 74px;
    height: 74px;
    min-height: 74px;
  }
  .attachment-chip.has-upload .media-upload-feedback {
    padding: 5px;
    gap: 2px;
  }
  .attachment-chip.has-upload .media-upload-feedback .media-upload-spinner {
    width: 25px;
    height: 25px;
    border-width: 2px;
  }
  .attachment-chip.has-upload .media-upload-feedback .media-upload-detail {
    display: none;
  }
  .attachment-chip.has-upload .media-upload-feedback .media-upload-progress {
    width: 54px;
  }
}

.message.error .message-content {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fff7f6;
  color: var(--danger);
}

.reasoning-panel {
  margin: 0 0 12px;
  color: rgba(88, 94, 105, 0.92);
  font-size: var(--fs-md);
  line-height: 1.7;
}

.reasoning-panel[hidden] {
  display: none;
}

.reasoning-panel summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: #2f6bff;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.reasoning-panel summary::-webkit-details-marker {
  display: none;
}

.reasoning-panel summary::after {
  width: 7px;
  height: 7px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  content: "";
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--motion-med) ease;
}

.reasoning-panel[open] summary::after {
  transform: translateY(2px) rotate(225deg);
}

.reasoning-content {
  padding-left: 14px;
  border-left: 1px solid rgba(47, 107, 255, 0.18);
  color: rgba(82, 87, 96, 0.88);
  white-space: pre-wrap;
}

.message.is-typing {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.68), rgba(255, 253, 247, 0.38)),
    rgba(255, 253, 247, 0.54);
  backdrop-filter: blur(20px) saturate(136%);
}

.message-actions {
  display: flex;
  gap: 7px;
  margin-top: 8px;
}

.message.user .message-actions {
  justify-content: flex-end;
}

.message-action {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 253, 247, 0.3)),
    rgba(255, 255, 255, 0.24);
  color: rgba(23, 23, 23, 0.78);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(31, 27, 18, 0);
  transition:
    transform var(--motion-med) ease,
    background var(--motion-med) ease,
    border-color var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    color var(--motion-med) ease;
}

.message.user .message-action {
  border-color: rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 253, 247, 0.3)),
    rgba(255, 255, 255, 0.24);
  color: rgba(23, 23, 23, 0.78);
}

.message-action:hover,
.message-action.is-done {
  border-color: rgba(255, 225, 0, 0.58);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(255, 246, 166, 0.36)),
    rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(31, 27, 18, 0.12);
  color: rgba(23, 23, 23, 0.9);
}

.message.user .message-action:hover,
.message.user .message-action.is-done {
  border-color: rgba(255, 225, 0, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 249, 182, 0.58)),
    rgba(255, 255, 255, 0.34);
  box-shadow: 0 9px 20px rgba(31, 27, 18, 0.14);
}

.message-action:active {
  transform: translateY(0) scale(0.94);
}

.message-action.is-done {
  animation: messageActionPop var(--motion-slow) ease;
}

.message-action.is-failed {
  border-color: rgba(220, 38, 38, 0.46);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(254, 226, 226, 0.62)),
    rgba(255, 255, 255, 0.3);
  color: rgba(153, 27, 27, 0.88);
}

.message-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 128px;
  overflow: visible;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 253, 247, 0.28) 36%, rgba(255, 225, 0, 0.1) 63%, var(--glow-neutral) 82%, rgba(255, 255, 255, 0.68)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(248, 245, 234, 0.42)),
    rgba(255, 253, 247, 0.44);
  box-shadow:
    0 38px 108px rgba(31, 27, 18, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.34),
    0 0 42px rgba(255, 255, 255, 0.24),
    0 0 34px var(--glow-neutral),
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -1px 0 rgba(116, 101, 22, 0.08),
    inset 18px 0 44px rgba(255, 255, 255, 0.16),
    inset -18px 0 42px rgba(255, 225, 0, 0.08);
  backdrop-filter: blur(34px) saturate(165%) brightness(1.04);
  transform: translateZ(0);
}

.mode-tabs {
  position: relative;
  z-index: 1;
  display: inline-flex;
  justify-self: end;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-bottom-color: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-pill);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 253, 247, 0.5) 62%, rgba(255, 225, 0, 0.12)),
    rgba(255, 255, 255, 0.58);
  box-shadow:
    0 10px 24px rgba(31, 27, 18, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px) saturate(145%);
}

.mode-tab {
  display: inline-flex;
  height: 30px;
  min-width: 82px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: rgba(23, 23, 23, 0.58);
  box-shadow: none;
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 900;
  letter-spacing: 0;
  transition:
    background var(--motion-med) ease,
    color var(--motion-med) ease,
    transform var(--motion-med) ease,
    box-shadow var(--motion-med) ease;
}

.mode-tab.active {
  height: 30px;
  margin-bottom: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 246, 150, 0.66)),
    rgba(255, 225, 0, 0.22);
  color: var(--ink);
  box-shadow:
    0 6px 16px rgba(255, 225, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.composer::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(110deg, transparent 0 24%, rgba(255, 255, 255, 0.82) 34%, rgba(255, 225, 0, 0.22) 42%, transparent 56%),
    linear-gradient(72deg, transparent 0 30%, var(--glow-neutral), transparent 58%),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.58), transparent);
  background-size: 210% 100%, 170% 100%, 240% 100%;
  border-radius: inherit;
  content: "";
  opacity: 0.28;
  pointer-events: none;
  animation: none;
}

.composer::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 1px;
  border-radius: inherit;
  background:
    linear-gradient(116deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.72) 20%, rgba(42, 42, 38, 0.12) 36%, rgba(255, 255, 255, 0.24) 52%, rgba(255, 225, 0, 0.16) 66%, rgba(255, 255, 255, 0.82) 82%, rgba(255, 255, 255, 1));
  content: "";
  mask:
    linear-gradient(black 0 0) content-box,
    linear-gradient(black 0 0);
  mask-composite: exclude;
  -webkit-mask:
    linear-gradient(black 0 0) content-box,
    linear-gradient(black 0 0);
  -webkit-mask-composite: xor;
  opacity: 0.94;
  pointer-events: none;
}

.composer.is-dragging-files {
  border-color: rgba(255, 225, 0, 0.72);
  box-shadow:
    0 30px 84px rgba(31, 27, 18, 0.2),
    0 0 0 1px rgba(255, 225, 0, 0.28),
    0 0 38px rgba(255, 225, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.composer.is-dragging-files::before {
  opacity: 0.52;
  animation: dragFileGlow 1.6s ease-in-out infinite alternate;
}

.composer.is-dragging-files::after {
  display: grid;
  place-items: center;
  padding: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.68), rgba(255, 246, 150, 0.3), var(--glow-accent)),
    rgba(255, 255, 255, 0.42);
  color: rgba(23, 23, 23, 0.72);
  content: "松开添加参考图";
  font-size: var(--fs-lg);
  font-weight: 900;
  letter-spacing: 0;
  mask: none;
  -webkit-mask: none;
  opacity: 1;
  backdrop-filter: blur(8px) saturate(142%);
}

.composer.is-dragging-files > * {
  opacity: 0.18;
  pointer-events: none;
}

@keyframes dragFileGlow {
  from {
    background-position: 0% 50%, 0% 50%, 0% 50%;
  }
  to {
    background-position: 100% 50%, 100% 50%, 100% 50%;
  }
}

.composer > * {
  position: relative;
  z-index: 2;
}

.composer:focus-within {
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 42px 118px rgba(31, 27, 18, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.5),
    0 0 46px rgba(255, 255, 255, 0.28),
    0 0 34px var(--glow-accent),
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 0 30px rgba(255, 255, 255, 0.24);
}

.composer textarea {
  width: 100%;
  max-height: 220px;
  min-height: 44px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-lg);
  line-height: 1.65;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -2px;
  padding: 7px 7px 2px 0;
  overflow: visible;
}

.attachment-list[hidden] {
  display: none;
}

.kling-frame-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 2px;
}

.kling-frame-panel[hidden] { display: none; }

.kling-storyboard-panel {
  margin: 8px 0 0;
}

.kling-storyboard-panel[hidden] { display: none; }

.kling-storyboard-panel textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

.kling-frame-slot {
  min-height: 92px;
  border: 1.5px dashed rgba(116, 101, 22, 0.35);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 247, 0.5);
  color: var(--ink);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 8px;
  overflow: hidden;
  cursor: pointer;
}

.kling-frame-slot.is-dragging { border-color: #d8b500; background: rgba(255, 225, 0, 0.1); }
.kling-frame-slot.has-image { grid-template-columns: 72px 1fr; text-align: left; }
.kling-frame-slot .kling-frame-preview { display: none; width: 72px; height: 72px; border-radius: var(--radius-sm); overflow: hidden; }
.kling-frame-slot.has-image .kling-frame-preview { display: block; grid-row: span 2; }
.kling-frame-slot img { width: 100%; height: 100%; object-fit: cover; }
.kling-frame-slot small { color: var(--muted); }
.kling-frame-swap {
  grid-column: 1 / -1;
  height: 32px;
  border: 1px solid rgba(116, 101, 22, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.72);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 800;
}
.kling-frame-swap:hover:not(:disabled) {
  border-color: rgba(116, 101, 22, 0.42);
  background: rgba(255, 248, 219, 0.9);
}
.kling-frame-swap:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.video-inline-control,
.video-option-toggle {
  height: 38px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: var(--radius-md);
  background: rgba(248,245,234,.62);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 800;
}
.video-inline-control { display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; }
.video-inline-control[hidden], .video-option-toggle[hidden] { display: none; }
.video-inline-control select { border: 0; background: transparent; color: inherit; font-weight: 900; outline: 0; }
.video-option-toggle { padding: 0 12px; cursor: pointer; }
.video-option-toggle.active { background: var(--ink); border-color: var(--ink); color: #fffdf7; }

.attachment-notice {
  flex: 1 1 100%;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(254, 226, 226, 0.68);
  color: #b91c1c;
  font-size: var(--fs-sm);
  font-weight: 800;
  line-height: 1.45;
}

.attachment-chip {
  position: relative;
  display: inline-flex;
  max-width: min(240px, 100%);
  height: 46px;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 5px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 253, 247, 0.44)),
    rgba(255, 225, 0, 0.08);
  color: rgba(23, 23, 23, 0.82);
  box-shadow:
    0 10px 22px rgba(31, 27, 18, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-size: var(--fs-sm);
  font-weight: 800;
  overflow: visible;
}

.attachment-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 3;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-pill);
  background: rgba(23, 23, 23, 0.78);
  color: #fffdf7;
  box-shadow: 0 8px 18px rgba(31, 27, 18, 0.16);
  cursor: pointer;
}

.attachment-remove svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attachment-thumb {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.68);
}

.attachment-thumb img,
.attachment-thumb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink-1);
}

.attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-footer {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
}

.model-picker {
  display: inline-flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 900;
}

.model-picker > span {
  display: inline-flex;
  height: 38px;
  align-items: center;
  padding: 0 2px;
  color: rgba(95, 88, 76, 0.82);
  font-size: var(--fs-sm);
}

.model-picker .web-search-button,
.model-picker .document-generate-button {
  height: 38px;
  padding: 0 13px;
  font-size: var(--fs-base);
}
.video-model-control[hidden],
.video-ratio-control[hidden],
.video-duration-control[hidden] {
  display: none;
}

.video-model-control {
  width: 150px;
  flex: 0 0 150px;
}

.video-ratio-control {
  width: 116px;
  flex: 0 0 116px;
}

.video-duration-control {
  width: 72px;
  flex: 0 0 72px;
}
.video-model-control .model-popover,
.video-ratio-control .model-popover,
.video-duration-control .model-popover {
  min-width: 168px;
}
.video-model-trigger,
.video-ratio-trigger,
.video-duration-trigger {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.model-control {
  position: relative;
  min-width: 0;
  z-index: 8;
}

.chat-model-control,
.web-search-button,
.document-generate-button,
.video-model-control,
.video-ratio-control,
.video-duration-control {
  transition:
    opacity var(--motion-med) ease,
    transform var(--motion-med) ease,
    width var(--motion-med) ease,
    flex-basis var(--motion-med) ease,
    margin var(--motion-med) ease;
}

body.is-image-mode .chat-model-control,
body.is-video-mode .chat-model-control,
body.is-image-mode .web-search-button,
body.is-video-mode .web-search-button,
body.is-image-mode .document-generate-button,
body.is-video-mode .document-generate-button,
body.is-image-mode .model-picker > span,
body.is-video-mode .model-picker > span {
  display: none;
  width: 0;
  min-width: 0;
  max-width: 0;
  flex: 0 0 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(4px);
}

body.is-image-mode .chat-model-control .model-trigger,
body.is-video-mode .chat-model-control .model-trigger {
  opacity: 0;
  pointer-events: none;
}

.native-model-select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.model-trigger {
  position: relative;
  display: inline-flex;
  max-width: min(260px, 56vw);
  min-width: 180px;
  height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 253, 247, 0.38) 48%, rgba(255, 225, 0, 0.12)),
    rgba(248, 245, 234, 0.48);
  color: var(--ink);
  box-shadow:
    0 12px 28px rgba(31, 27, 18, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(116, 101, 22, 0.06);
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: 900;
  letter-spacing: 0;
  outline: 0;
  backdrop-filter: blur(18px) saturate(142%);
  transition:
    transform var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    border-color var(--motion-med) ease,
    background var(--motion-med) ease;
}

.model-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-image-mode .model-picker {
  flex: 0 1 auto;
  gap: 14px;
  padding-left: 0;
}

body.is-video-mode .model-picker {
  flex: 0 1 auto;
  gap: 14px;
  padding-left: 0;
}

body.is-video-mode .video-model-control {
  width: 170px;
  flex: 0 0 170px;
  transform: translateX(0);
}

body.is-video-mode .video-ratio-control {
  width: 150px;
  flex: 0 0 150px;
  transform: translateX(0);
}

body.is-video-mode .video-duration-control {
  width: 76px;
  flex: 0 0 76px;
  transform: translateX(0);
}
.video-model-control .model-trigger,
.video-ratio-control .model-trigger,
.video-duration-control .model-trigger {
  min-width: 0;
  max-width: 100%;
}

.model-trigger:hover,
.model-trigger[aria-expanded="true"] {
  border-color: rgba(255, 225, 0, 0.5);
  box-shadow:
    0 16px 34px rgba(31, 27, 18, 0.12),
    0 0 22px rgba(255, 246, 166, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
  transform: translateY(-1px);
}

.model-chevron {
  width: 8px;
  height: 8px;
  border-right: 1px solid rgba(23, 23, 23, 0.72);
  border-bottom: 1px solid rgba(23, 23, 23, 0.72);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--motion-med) ease;
}

.model-trigger[aria-expanded="true"] .model-chevron {
  transform: translateY(2px) rotate(225deg);
}

.model-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 80;
  display: grid;
  width: 100%;
  min-width: 190px;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 253, 247, 0.36) 54%, rgba(255, 225, 0, 0.1)),
    rgba(255, 253, 247, 0.58);
  box-shadow:
    0 18px 48px rgba(31, 27, 18, 0.18),
    0 0 0 1px rgba(255, 225, 0, 0.18),
    0 0 32px rgba(255, 246, 166, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(26px) saturate(158%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.96);
  transform-origin: left bottom;
  transition:
    opacity var(--motion-med) ease,
    transform var(--motion-med) cubic-bezier(0.2, 0.9, 0.2, 1);
}

.model-popover.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.model-option{
  width: 100%;
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: var(--fs-sm);
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  transition:
    background var(--motion-med) ease,
    border-color var(--motion-med) ease,
    transform var(--motion-med) ease,
    box-shadow var(--motion-med) ease;
}

.model-option:hover,
.model-option.active{
  border-color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 246, 166, 0.34)),
    rgba(255, 253, 247, 0.44);
  box-shadow:
    0 10px 22px rgba(31, 27, 18, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  transform: translateY(-1px);
}

.model-option.active{
  color: #1f1900;
}

.model-popover.model-card-popover {
  width: min(304px, calc(100vw - 28px));
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 253, 247, 0.5) 56%, rgba(255, 225, 0, 0.12)),
    rgba(255, 253, 247, 0.72);
  box-shadow:
    0 22px 58px rgba(31, 27, 18, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.model-card-popover-label {
  grid-column: 1 / -1;
  color: rgba(95, 88, 76, 0.82);
  font-size: var(--fs-xs);
  font-weight: 900;
  line-height: 1.2;
}

.model-picker select:not(.native-model-select) {
  max-width: min(260px, 56vw);
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.78), rgba(255, 253, 247, 0.42)),
    rgba(248, 245, 234, 0.48);
  color: var(--ink);
  outline: 0;
  box-shadow:
    0 10px 24px rgba(31, 27, 18, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  font-weight: 800;
  backdrop-filter: blur(18px) saturate(135%);
}

.model-picker select:focus,
.model-trigger:focus-visible {
  border-color: var(--focus);
}

.file-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 253, 247, 0.34)),
    rgba(255, 255, 255, 0.36);
  color: rgba(23, 23, 23, 0.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 12px 26px rgba(31, 27, 18, 0.08);
  cursor: pointer;
  transition:
    transform var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    border-color var(--motion-med) ease;
}

.file-button:hover,
.file-button.has-file {
  border-color: rgba(255, 225, 0, 0.52);
  box-shadow:
    0 0 22px rgba(255, 246, 166, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.file-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.web-search-button,
.document-generate-button {
  display: inline-flex;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius-pill);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(245, 249, 255, 0.48)),
    rgba(255, 255, 255, 0.38);
  color: rgba(23, 23, 23, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 12px 26px rgba(31, 27, 18, 0.08);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
  transition:
    transform var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    border-color var(--motion-med) ease,
    background var(--motion-med) ease,
  color var(--motion-med) ease;
}

.document-generate-button[hidden] {
  display: none !important;
}

.web-search-button:hover,
.web-search-button.active,
.document-generate-button:hover,
.document-generate-button.active {
  border-color: rgba(47, 107, 255, 0.36);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(229, 238, 255, 0.72)),
    rgba(238, 244, 255, 0.62);
  color: #255ee8;
  box-shadow:
    0 0 22px rgba(47, 107, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
}

.composer #send-button {
  display: inline-flex;
  min-width: 92px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px 0 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background:
    linear-gradient(145deg, rgba(255, 245, 104, 0.76), rgba(255, 225, 0, 0.6)),
    rgba(255, 225, 0, 0.52);
  color: #171300;
  font-weight: 900;
  box-shadow:
    0 12px 24px rgba(255, 225, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    inset 0 -1px 0 rgba(87, 72, 0, 0.08);
  backdrop-filter: blur(14px) saturate(142%);
  cursor: pointer;
  letter-spacing: 0;
  transition:
    transform var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    filter var(--motion-med) ease;
}

.composer #send-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--motion-med) ease;
}

.composer #send-button:hover {
  filter: saturate(1.04) brightness(1.02);
  transform: translateY(-2px);
  box-shadow:
    0 16px 34px rgba(255, 225, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.68),
    inset 0 -1px 0 rgba(87, 72, 0, 0.08);
}

.composer #send-button:hover svg {
  transform: translateX(2px);
}

.composer #send-button:active {
  transform: translateY(0);
}

.composer #send-button:disabled {
  cursor: wait;
  filter: grayscale(0.18);
  opacity: 0.62;
}

.composer #send-button.is-send-confirmed {
  animation: sendPulse var(--motion-slow) var(--ease-out);
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.text-stream-thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.text-stream-thinking-label {
  color: var(--muted);
  animation: textStreamThinkingBreath 1.8s ease-in-out infinite;
}

.text-stream-thinking .typing {
  gap: 4px;
}

.text-stream-thinking .typing span {
  width: 5px;
  height: 5px;
}

.skill-invocation-status {
  display: inline-grid;
  max-width: 100%;
  grid-template-columns: 30px minmax(0, auto) max-content;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.skill-invocation-icon {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: rgba(217, 191, 0, 0.1);
  color: #7a6500;
}

.skill-invocation-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skill-invocation-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.skill-invocation-copy strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: 1.4;
}

.skill-invocation-copy small {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.35;
}

.skill-invocation-status > .typing {
  gap: 4px;
}

.skill-invocation-status > .typing span {
  width: 5px;
  height: 5px;
}

@media (max-width: 520px) {
  .skill-invocation-status {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
  }

  .skill-invocation-icon {
    width: 28px;
    height: 28px;
  }

  .skill-invocation-status > .typing {
    display: none;
  }
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 120ms;
}

.typing span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    opacity: 0.32;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes textStreamThinkingBreath {
  0%,
  100% {
    opacity: 0.72;
  }

  50% {
    opacity: 1;
  }
}

@media (min-width: 1200px) {
  :root {
    --app-sidebar-width: 228px;
  }

  .history-sidebar {
    padding: 26px 20px;
  }

  .history-header {
    min-height: 50px;
  }

  .history-brand {
    gap: 10px;
  }

  .history-brand img {
    width: 54px;
    height: 42px;
  }

  .history-brand strong {
    font-size: var(--fs-md);
  }

  .history-brand span {
    font-size: var(--fs-xs);
  }

  .sidebar-icon-button,
  .show-sidebar-button {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
  }

  .new-chat-button {
    min-height: 40px;
    margin: 28px 0 18px;
    padding: 10px 12px;
    font-size: var(--fs-base);
  }

  .history-list {
    gap: 6px;
  }

  .history-row,
  .history-item,
  .history-empty {
    border-radius: var(--radius-sm);
  }

  .history-item,
  .history-empty {
    min-height: 30px;
    padding: 0;
    font-size: var(--fs-sm);
    line-height: 1.28;
  }

  .history-row {
    grid-template-columns: minmax(0, 1fr) 24px;
    gap: 6px;
    min-height: 42px;
    padding: 5px 6px 5px 10px;
  }

  .history-delete {
    width: 24px;
    height: 24px;
  }

  .history-delete svg {
    width: 12px;
    height: 12px;
  }

  .sidebar-user-panel {
    grid-template-columns: 36px minmax(0, 1fr) 28px;
    min-height: 56px;
    padding: 8px;
    border-radius: var(--radius-sm);
  }

  .sidebar-avatar-button {
    width: 36px;
    height: 36px;
    font-size: var(--fs-md);
  }

  .sidebar-bottom-link {
    min-height: 34px;
    padding: 0 10px;
    font-size: var(--fs-sm);
  }

  .sidebar-version {
    margin-top: 10px;
    font-size: var(--fs-xs);
  }

  .chat-page {
    padding: 18px 22px;
  }

  body.is-chatting .chat-page {
    padding: 42px 22px 56px;
  }

  .chat-shell {
    width: min(840px, 100%);
    gap: 8px;
  }

  body.is-chatting .chat-shell {
    width: min(840px, 100%);
    height: calc(var(--app-viewport-height) - 104px);
  }

  body.is-chat-empty .chat-shell,
  .chat-shell:has(.message-list:empty) {
    width: min(840px, 100%);
  }

  body.is-chatting .message-list {
    gap: 14px;
    padding-top: 16px;
  }

  .message {
    max-width: min(760px, 100%);
    font-size: var(--fs-lg);
    line-height: 1.75;
  }

  .message.assistant .message-content p {
    margin-bottom: 14px;
    line-height: 1.75;
  }

  .message-content {
    padding: 12px 14px;
    border-radius: var(--radius-md);
  }

  .message-time {
    margin-top: 5px;
    font-size: var(--fs-xs);
  }

  .message-actions {
    margin-top: 7px;
  }

  .message-action {
    width: 28px;
    height: 28px;
  }

  .mode-tabs {
    padding: 2px;
  }

  .mode-tab,
  .mode-tab.active {
    height: 27px;
    min-width: 72px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
  }

  .composer {
    min-height: 108px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    box-shadow:
      0 26px 76px rgba(31, 27, 18, 0.18),
      0 0 0 1px rgba(255, 255, 255, 0.32),
      0 0 26px rgba(255, 255, 255, 0.2),
      0 0 24px var(--glow-neutral),
      inset 0 1px 0 rgba(255, 255, 255, 0.94),
      inset 0 -1px 0 rgba(116, 101, 22, 0.06);
  }

  .composer textarea {
    min-height: 38px;
    font-size: var(--fs-md);
    line-height: 1.5;
  }

  .composer-footer {
    gap: 8px;
  }

  .composer-actions {
    gap: 7px;
  }

  .model-trigger {
    height: 34px;
    min-width: 154px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
  }

  .chat-model-control {
    width: 168px;
    flex-basis: 168px;
  }

  body.is-image-mode .model-picker,
  body.is-video-mode .model-picker {
    gap: 10px;
  }
  body.is-video-mode .video-model-control {
    width: 142px;
    flex-basis: 142px;
  }
  body.is-video-mode .video-ratio-control {
    width: 132px;
    flex-basis: 132px;
  }
  body.is-video-mode .video-duration-control {
    width: 70px;
    flex-basis: 70px;
  }

  .scroll-latest-button {
    bottom: 144px;
    width: 38px;
    height: 38px;
  }
}

@media (min-width: 1680px) {
  :root {
    --app-sidebar-width: 228px;
  }

  .history-sidebar {
    padding: 26px 20px;
  }

  .message {
    max-width: min(760px, 100%);
  }
}

@media (max-width: 1100px) and (min-width: 641px) {
  .chat-layout {
    grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
  }

  .history-sidebar {
    padding: 22px 16px;
  }

  body.sidebar-collapsed .history-sidebar {
    margin-left: calc(-1 * var(--app-sidebar-width));
  }

  .history-brand {
    gap: 10px;
  }

  .history-brand img {
    width: 56px;
    height: 44px;
  }

  .history-brand strong {
    font-size: var(--fs-md);
  }

  .chat-shell {
    width: min(840px, 100%);
  }

  body.is-chatting .chat-page {
    padding-right: 18px;
    padding-left: 18px;
  }
}

@media (max-width: 640px) {
  html,
  body,
  .chat-layout,
  .chat-page {
    min-height: var(--app-viewport-height);
  }

  .chat-layout {
    display: block;
  }

  .history-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 288px);
    box-shadow: none;
    margin-left: 0;
    opacity: 1;
    pointer-events: none;
    transform: translateX(-100%);
    transition: transform var(--motion-med) ease;
  }

  body.sidebar-open .chat-page::after {
    position: fixed;
    inset: 0;
    z-index: 18;
    background: rgba(12, 12, 12, 0.46);
    backdrop-filter: blur(12px) saturate(86%);
    content: "";
  }

  body.sidebar-open .history-sidebar {
    pointer-events: auto;
    transform: translateX(0);
  }

  body.sidebar-collapsed .history-sidebar {
    margin-left: 0;
    opacity: 1;
    transform: translateX(-100%);
  }

  .chat-page {
    align-items: end;
    width: 100%;
    overflow: hidden;
    padding: 58px 12px calc(34px + var(--app-keyboard-inset));
  }

  body.is-chatting .chat-page {
    padding: 52px 12px calc(34px + var(--app-keyboard-inset));
  }

  .chat-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: calc(var(--app-viewport-height) - 92px);
    gap: 12px;
  }

  body.is-chatting .chat-shell {
    height: calc(var(--app-viewport-height) - 86px);
  }

  body.is-chat-empty .chat-shell {
    height: auto;
    max-height: calc(var(--app-viewport-height) - 92px);
  }

  .composer {
    min-height: 118px;
    padding: 11px 12px 12px;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-shadow:
      0 18px 44px rgba(31, 27, 18, 0.12),
      0 0 0 1px rgba(255, 255, 255, 0.44),
      0 0 24px var(--glow-neutral),
      inset 0 1px 0 rgba(255, 255, 255, 0.92),
      inset 0 -1px 0 rgba(116, 101, 22, 0.05);
  }

  .composer:focus-within {
    box-shadow:
      0 20px 48px rgba(31, 27, 18, 0.14),
      0 0 0 1px rgba(47, 107, 255, 0.42),
      0 0 20px var(--glow-neutral),
      inset 0 1px 0 rgba(255, 255, 255, 0.96);
  }

  .mode-tabs {
    z-index: 0;
    gap: 2px;
    padding: 3px;
    border-radius: 14px 14px 9px 9px;
  }

  .mode-tab {
    height: 28px;
    min-width: 72px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
  }

  .mode-tab.active {
    height: 28px;
    margin-bottom: 0;
  }

  .attachment-list {
    gap: 7px;
    padding: 0 2px 1px;
  }

  .attachment-chip {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 4px;
    overflow: visible;
  }

  .attachment-thumb {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .attachment-name {
    display: none;
  }

  .composer-footer {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
    min-width: 0;
  }

  .composer-actions {
    display: inline-flex;
    width: auto;
    min-width: 0;
    justify-content: flex-end;
    gap: 6px;
    flex: 0 0 auto;
  }

  .model-picker {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 5px;
    font-size: var(--fs-xs);
    overflow: visible;
  }

  .model-picker > span {
    display: none;
  }

  .model-control {
    min-width: 0;
    width: min(98px, 25vw);
    flex: 0 1 min(98px, 25vw);
  }

  body.is-image-mode .chat-model-control,
  body.is-video-mode .chat-model-control,
  body.is-image-mode .web-search-button,
  body.is-video-mode .web-search-button,
  body.is-image-mode .document-generate-button,
  body.is-video-mode .document-generate-button,
  body.is-image-mode .model-picker > span,
  body.is-video-mode .model-picker > span {
    display: none;
    width: 0;
    min-width: 0;
    max-width: 0;
    flex: 0 0 0;
  }

  .video-model-control {
    width: 44px;
    flex: 0 0 44px;
  }

  .video-ratio-control {
    width: 56px;
    flex: 0 0 56px;
  }

  .video-duration-control {
    width: 44px;
    flex: 0 0 44px;
  }

  body.is-image-mode .model-picker,
  body.is-video-mode .model-picker {
    gap: 5px;
  }

  body.is-video-mode .video-model-control {
    width: 112px;
    flex: 0 1 112px;
  }

  body.is-video-mode .video-ratio-control {
    width: 82px;
    flex: 0 0 82px;
  }

  body.is-video-mode .video-duration-control {
    width: 56px;
    flex: 0 0 56px;
  }
  .video-model-control .model-trigger,
  .video-ratio-control .model-trigger,
  .video-duration-control .model-trigger {
    min-width: 0;
    max-width: 100%;
  }
  .video-model-control .model-popover,
  .video-ratio-control .model-popover,
  .video-duration-control .model-popover {
    width: 148px;
    min-width: 148px;
  }

  .model-trigger {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 34px;
    gap: 6px;
    padding-right: 8px;
    padding-left: 10px;
    font-size: var(--fs-xs);
  }

  #current-model {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .model-popover {
    width: 100%;
    min-width: 0;
    z-index: 90;
  }

  .web-search-button,
  .document-generate-button {
    height: 34px;
    padding: 0 12px;
    font-size: var(--fs-sm);
    white-space: nowrap;
  }

  .model-picker .web-search-button,
  .model-picker .document-generate-button {
    height: 34px;
    width: auto;
    flex: 0 0 auto;
    margin-top: 0;
  }
  .video-model-trigger,
  .video-ratio-trigger,
  .video-duration-trigger {
    padding: 0 7px;
    font-size: var(--fs-xs);
  }
  .video-model-trigger .model-chevron,
  .video-ratio-trigger .model-chevron,
  .video-duration-trigger .model-chevron {
    display: none;
  }

  .file-button {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .composer #send-button {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 34px;
    gap: 0;
    padding: 0;
    font-size: var(--fs-base);
  }

  .composer #send-button span {
    display: none;
  }

  .composer #send-button svg {
    width: 14px;
    height: 14px;
  }

  .message.user {
    display: grid;
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
    justify-items: end;
  }

  .message.user .message-time,
  .message.user .message-actions {
    justify-self: end;
  }

  .message.assistant {
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
  }

  .message.assistant .message-content {
    width: 100%;
    max-width: 100%;
  }

  .message.assistant .message-content p {
    margin-bottom: 14px;
    line-height: 1.72;
  }

  .message.assistant .message-content h2,
  .message.assistant .message-content h3,
  .message.assistant .message-content h4 {
    margin: 22px 0 10px;
    line-height: 1.34;
  }

  .message.assistant .message-content h2 {
    font-size: var(--fs-xl);
  }

  .message.assistant .message-content h3 {
    font-size: var(--fs-lg);
  }

  .message.assistant .message-content h4 {
    font-size: var(--fs-lg);
  }

  .message.assistant .message-content ul,
  .message.assistant .message-content ol {
    margin-bottom: 14px;
    padding-left: 1.2em;
  }

  .message.assistant .message-content li {
    margin: 5px 0;
    line-height: 1.72;
  }

  .message.assistant .message-content pre {
    margin: 10px 0 13px;
    padding: 11px 10px;
    border-radius: var(--radius-xs);
  }

  .message.assistant .message-content pre code {
    font-size: var(--fs-base);
    line-height: 1.58;
  }

  .media-pending-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    width: min(100%, 340px);
    padding: 10px;
    border-radius: var(--radius-sm);
  }

  .media-pending-tile {
    width: 48px;
    height: 56px;
    border-radius: var(--radius-sm);
  }

  .media-pending-tile::after {
    border-radius: var(--radius-xs);
  }

  .media-pending-copy strong {
    font-size: var(--fs-md);
  }

  .media-pending-copy span {
    font-size: var(--fs-sm);
  }

  .media-pending-copy em {
    font-size: var(--fs-xs);
  }

  .document-pending-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    width: min(100%, 340px);
    padding: 10px;
  }

  .document-pending-icon {
    width: 48px;
    height: 56px;
    padding: 12px 8px 8px;
  }

  .document-pending-copy strong {
    font-size: var(--fs-md);
  }

  .document-pending-copy span {
    font-size: var(--fs-sm);
  }

  .message-list {
    gap: 12px;
  }

  body.is-chatting .message-list {
    gap: 14px;
    padding-top: 10px;
  }

  .chat-disclaimer {
    right: 12px;
    bottom: 8px;
    left: 12px;
    font-size: var(--fs-xs);
  }

  .show-sidebar-button {
    top: 10px;
    left: 10px;
  }

  .sidebar-user-panel {
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    gap: 9px;
    min-height: 60px;
    padding: 9px;
  }

  .sidebar-avatar-button {
    width: 38px;
    height: 38px;
  }

  .sidebar-user-name {
    font-size: var(--fs-sm);
  }

  .sidebar-user-points {
    font-size: var(--fs-xs);
  }

  .history-bottom-links a.sidebar-bottom-link {
    min-height: 38px;
    padding: 0 11px;
    font-size: var(--fs-sm);
  }

  .profile-modal {
    padding: 10px;
  }

  .profile-dialog {
    width: min(390px, calc(100vw - 20px));
    max-height: calc(var(--app-viewport-height) - 20px);
    padding: 18px 12px;
    border-radius: var(--radius-md);
  }

  .profile-dialog::-webkit-scrollbar-track {
    margin: 14px 0;
  }

  .profile-dialog h2 {
    margin-right: 38px;
    margin-bottom: 14px;
    font-size: var(--fs-xl);
  }

  .profile-kicker {
    font-size: var(--fs-xs);
  }

  .profile-stats {
    gap: 12px;
  }

  .profile-user-summary {
    padding: 10px 12px;
    border-radius: var(--radius-md);
  }

  .profile-stat-section {
    gap: 8px;
  }

  .profile-stat-section h3 {
    font-size: var(--fs-base);
  }

  .profile-stat-grid,
  .profile-stat-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-cost-grid {
    grid-template-columns: 1fr;
  }

  .profile-stat-card {
    min-height: 62px;
    padding: 10px;
    border-radius: var(--radius-sm);
  }

  .profile-stat-card strong {
    font-size: var(--fs-lg);
  }

  .profile-stat-card span,
  .profile-recent-item span,
  .profile-recent-item em {
    font-size: var(--fs-xs);
  }

  .profile-close {
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
  }

  .profile-recent-item {
    display: grid;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
  }

  .profile-recent-item div:last-child {
    text-align: left;
  }

  .message,
  .composer {
    backdrop-filter: none;
  }
}

@media (max-width: 430px) {
  .chat-shell,
  .composer {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    min-width: 0 !important;
  }

  .composer-footer {
    overflow: visible;
  }

  .model-control {
    width: min(92px, 24vw);
    flex-basis: min(92px, 24vw);
  }

  .model-picker .web-search-button,
  .model-picker .document-generate-button {
    width: auto;
  }

  .composer-actions {
    gap: 4px;
  }

  .file-button {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .composer #send-button {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    height: 30px;
  }

  .message.assistant .message-content {
    font-size: var(--fs-lg);
  }

  .message.assistant .message-content p {
    line-height: 1.72;
  }

  .message.assistant .message-content h2 {
    font-size: var(--fs-xl);
  }

  .message.assistant .message-content h3 {
    font-size: var(--fs-lg);
  }

  .message.assistant .message-content h4 {
    font-size: var(--fs-lg);
  }

  .message.assistant .message-content code {
    padding: 1px 4px;
    font-size: 0.88em;
  }

  .message.assistant .message-content pre {
    padding: 10px 9px;
  }

  body.is-video-mode .video-model-control {
    width: 96px;
    flex: 0 1 96px;
  }

  body.is-video-mode .video-ratio-control {
    width: 74px;
    flex: 0 0 74px;
  }

  body.is-video-mode .video-duration-control {
    width: 52px;
    flex: 0 0 52px;
  }

  .profile-dialog {
    width: calc(100vw - 20px);
    max-height: calc(var(--app-viewport-height) - 20px);
    padding: 16px 10px;
  }

  .profile-user-summary {
    display: grid;
    gap: 4px;
  }

  .profile-stat-grid,
  .profile-stat-grid.compact,
  .profile-cost-grid {
    grid-template-columns: 1fr;
  }

  .profile-recent-pager {
    gap: 7px;
  }

  .profile-recent-pager button {
    min-width: 58px;
  }
}

/* Phase 1/2: keep the primary composer actions reachable on narrow screens. */


.composer #send-button.is-stop {
  background: rgba(255, 255, 255, 0.82) !important;
  color: #171300 !important;
}

.composer #send-button.is-stop svg {
  display: none;
}

.composer #send-button.is-stop::before {
  width: 13px;
  height: 13px;
  border-radius: var(--radius-xs);
  background: currentColor;
  content: "";
}

.message.is-cancelled,
.message.is-interrupted {
  border-color: rgba(115, 120, 126, 0.2);
}

.source-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 35;
  display: grid;
  width: min(400px, calc(100vw - 24px));
  height: var(--app-viewport-height);
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid rgba(226, 220, 205, 0.82);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: -24px 0 70px rgba(31, 27, 18, 0.13);
  backdrop-filter: blur(26px) saturate(145%);
}

.source-drawer[hidden] {
  display: none;
}

.source-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(226, 220, 205, 0.78);
}

.source-drawer-header span,
.source-drawer-list small {
  display: block;
  color: rgba(95, 99, 108, 0.72);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.source-drawer-header strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: var(--fs-lg);
  line-height: 1.25;
}

.source-drawer-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(36, 36, 36, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.68);
  color: rgba(23, 23, 23, 0.74);
  cursor: pointer;
  font-size: var(--fs-xl);
  line-height: 1;
}

.source-drawer-list {
  display: grid;
  align-content: start;
  gap: 0;
  overflow-y: auto;
  padding: 0 18px 24px;
}

.source-brief {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  gap: 5px 10px;
  padding: 13px 2px 14px;
  border: 0;
  border-bottom: 1px solid rgba(226, 220, 205, 0.78);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  transition: background-color var(--motion-med) ease, box-shadow var(--motion-med) ease;
}

.source-brief:hover {
  background: rgba(248, 248, 246, 0.92);
}

.source-brief.is-active {
  background: rgba(255, 248, 204, 0.56);
  box-shadow: inset 3px 0 0 rgba(255, 210, 0, 0.96);
}

.source-brief-index {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: var(--radius-pill);
  background: rgba(229, 232, 235, 0.92);
  color: rgba(73, 77, 85, 0.82);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.source-brief.is-active .source-brief-index {
  background: var(--yellow);
  color: var(--charcoal);
}

.source-brief strong,
.source-brief small,
.source-brief p {
  display: -webkit-box;
  margin: 2px 0 0;
  overflow: hidden;
  color: rgba(23, 23, 23, 0.66);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.source-brief strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.source-brief small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-brief p {
  margin: 3px 0 0;
  color: rgba(23, 23, 23, 0.66);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-line-clamp: 2;
}

.source-brief > :not(.source-brief-index) {
  grid-column: 1;
  grid-row: 1;
}

.source-brief-content {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.source-brief-heading,
.source-brief-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: rgba(73, 77, 85, 0.72);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.source-brief-favicon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: var(--radius-xs);
  object-fit: contain;
}

.source-brief-site {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-brief-date {
  flex: 0 0 auto;
}

.source-brief-date::before {
  margin-right: 7px;
  color: rgba(95, 99, 108, 0.4);
  content: "|";
}

.source-brief-title {
  color: var(--ink);
}

.source-brief-url {
  color: rgba(95, 99, 108, 0.68);
  font-size: var(--fs-sm);
}

.source-summary-button {
  display: inline-flex;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(36, 36, 36, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.78);
  color: rgba(23, 23, 23, 0.78);
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: 650;
  padding: 5px 12px;
  box-shadow: none;
}

.source-summary-button:hover {
  border-color: rgba(255, 225, 0, 0.86);
  background: rgba(255, 250, 222, 0.92);
}

.source-summary-favicons {
  flex: 0 0 auto;
}

.source-summary-label {
  white-space: nowrap;
}

.search-read-status {
  display: flex;
  min-height: 20px;
  align-items: center;
  gap: 7px;
  margin: 0 0 18px;
  color: rgba(73, 77, 85, 0.78);
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 0;
}

.search-read-favicons {
  display: inline-flex;
  min-width: 16px;
  align-items: center;
}

.search-read-favicons img {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: var(--bg);
  object-fit: contain;
}

.search-read-favicons img + img {
  margin-left: -5px;
}

.inline-citation {
  display: inline-grid;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px !important;
  margin: 0 2px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(229, 232, 235, 0.92);
  color: rgba(73, 77, 85, 0.82);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1;
  vertical-align: 0.12em;
}

.inline-citation:hover,
.inline-citation.is-active {
  background: rgba(255, 225, 0, 0.9);
  color: var(--charcoal);
}

.inline-citation:focus-visible {
  outline: 2px solid rgba(47, 107, 255, 0.72);
  outline-offset: 2px;
}

@media (min-width: 1360px) {

  body.sources-open .chat-page {
    padding-right: 16px;
    padding-left: 16px;
  }

  .source-drawer {
    box-shadow: none;
    backdrop-filter: none;
  }
}

@media (min-width: 641px) and (max-width: 1359px) {
  body.sources-open .chat-page::after {
    position: fixed;
    inset: 0;
    z-index: 34;
    background: rgba(18, 18, 18, 0.24);
    content: "";
  }
}


@media (max-width: 640px) {
  body.sources-open .chat-page::after {
    position: fixed;
    inset: 0;
    z-index: 34;
    background: rgba(18, 18, 18, 0.3);
    content: "";
  }

  .source-drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(72vh, 680px);
    border-top: 1px solid rgba(226, 220, 205, 0.82);
    border-left: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -22px 60px rgba(31, 27, 18, 0.18);
  }

  .source-drawer-header {
    padding: 14px 16px 11px;
  }
}

.profile-usage-details {
  padding: 0;
}

.profile-usage-details summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 900;
  list-style: none;
  padding: 12px 0;
}

.profile-usage-details summary::-webkit-details-marker {
  display: none;
}

.profile-usage-details summary::after {
  content: "+";
  color: rgba(95, 99, 108, 0.72);
  font-size: var(--fs-lg);
  line-height: 1;
}

.profile-usage-details[open] summary::after {
  content: "-";
}

.profile-leaderboard {
  display: grid;
  gap: 8px;
}

.profile-leader-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 220, 205, 0.72);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.72);
}

.profile-leader-row span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--yellow);
  color: var(--charcoal);
  font-size: var(--fs-sm);
  font-weight: 900;
}

.profile-leader-name {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.profile-leader-row strong {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--fs-md);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-leader-row small {
  overflow: hidden;
  color: rgba(23, 23, 23, 0.55);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-leader-row em {
  color: rgba(23, 23, 23, 0.68);
  font-size: var(--fs-sm);
  font-style: normal;
  font-weight: 800;
}

/* Token usage modal layout refinement */


.profile-dialog {
  width: min(640px, calc(100vw - 32px));
  padding: 22px;
}

.profile-kicker {
  margin-bottom: 3px;
  font-size: var(--fs-sm);
}

.profile-dialog h2 {
  margin: 0 42px 14px 0;
  font-size: var(--fs-xl);
}

.profile-stats {
  gap: 12px;
}

.profile-user-summary {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.profile-user-summary strong {
  font-size: var(--fs-md);
}

.profile-stat-section {
  gap: 8px;
  padding-top: 2px;
}

.profile-stat-section + .profile-stat-section,
.profile-stat-section + .profile-usage-details,
.profile-usage-details + .profile-stat-section {
  padding-top: 10px;
  border-top: 1px solid rgba(226, 220, 205, 0.58);
}

.profile-stat-section h3 {
  font-size: var(--fs-base);
}

.profile-stat-grid,
.profile-cost-grid {
  gap: 8px;
}

.profile-cost-grid .profile-stat-card,
.profile-stat-card {
  min-height: 70px;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
}

.profile-stat-card strong {
  font-size: var(--fs-xl);
}

.profile-stat-card span,
.profile-stat-card em {
  font-size: var(--fs-xs);
}

.profile-leaderboard {
  gap: 6px;
}

.profile-leader-row {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.profile-leader-row span {
  width: 20px;
  height: 20px;
  font-size: var(--fs-xs);
}

.profile-leader-row strong {
  font-size: var(--fs-base);
}

.profile-leader-row small {
  font-size: var(--fs-xs);
}

.profile-leader-row em {
  font-size: var(--fs-xs);
}

.profile-usage-details {
  border-top: 1px solid rgba(226, 220, 205, 0.58);
  padding-top: 8px;
}

.profile-usage-details summary {
  min-height: 36px;
  padding: 8px 0;
  font-size: var(--fs-md);
}

.profile-usage-details[open] {
  gap: 8px;
}

.profile-recent-list {
  gap: 6px;
}

.profile-recent-item {
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.profile-recent-item strong {
  font-size: var(--fs-sm);
}

@media (max-width: 640px) {
  .profile-dialog {
    padding: 18px;
  }

  .profile-stat-grid,
  .profile-stat-grid.compact,
  .profile-cost-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Token usage summary spacing */


.profile-usage-details summary strong {
  margin-left: 18px;
  margin-right: 28px;
  min-width: 118px;
  text-align: right;
}

.profile-usage-details > h3 {
  margin-top: 16px;
  margin-bottom: 10px;
}

.profile-usage-details > .profile-stat-grid + h3 {
  padding-top: 6px;
}

@media (max-width: 640px) {
  .profile-usage-details summary strong {
    margin-right: 22px;
    min-width: 104px;
    font-size: var(--fs-sm);
  }

  .profile-usage-details > h3 {
    margin-top: 14px;
  }
}

/* Token cost grid compact four-column layout */


.profile-cost-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.profile-cost-grid .profile-stat-card {
  min-height: 58px;
  padding: 8px 9px;
  gap: 2px;
  border-radius: var(--radius-sm);
}

.profile-cost-grid .profile-stat-card span,
.profile-cost-grid .profile-stat-card em {
  font-size: var(--fs-xs);
}

.profile-cost-grid .profile-stat-card strong {
  font-size: var(--fs-lg);
  line-height: 1.08;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .profile-cost-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .profile-cost-grid .profile-stat-card strong {
    font-size: var(--fs-lg);
  }
}

/* 2026-06-07 video composer parameter popover */


.video-param-control[hidden]{
  display: none !important;
}

.video-param-control {
  position: relative;
  z-index: 12;
  width: 88px;
  flex: 0 0 88px;
}

body.is-video-mode .video-param-control {
  display: block;
}

body.is-video-mode .model-picker > #video-resolution-control,
body.is-video-mode .model-picker > #kling-audio-toggle {
  display: none !important;
}

.video-param-trigger,
body.is-video-mode .video-option-toggle#kling-frame-toggle {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 253, 247, 0.36) 54%, rgba(255, 225, 0, 0.1)),
    rgba(255, 253, 247, 0.58);
  color: var(--ink);
  box-shadow:
    0 14px 30px rgba(31, 27, 18, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-size: var(--fs-base);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

body.is-video-mode .video-option-toggle#kling-frame-toggle {
  width: 82px;
  flex: 0 0 82px;
}

body.is-video-mode .video-option-toggle#kling-frame-toggle.active{
  border-color: var(--ink);
  background: var(--ink);
  color: #fffdf7;
}

.video-param-section {
  display: grid;
  gap: 7px;
}

.video-param-label {
  color: rgba(95, 88, 76, 0.82);
  font-size: var(--fs-xs);
  font-weight: 900;
}

.video-param-grid {
  display: grid;
  gap: 6px;
}

.video-param-ratio-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.video-param-duration-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.video-param-kling-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}

.video-param-popover .video-inline-control{
  display: inline-flex;
  width: 100%;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.video-param-popover .video-inline-control[hidden]{
  display: none !important;
}

.video-param-popover .video-inline-control {
  justify-content: space-between;
  padding: 0 10px;
}

.video-param-popover .video-inline-control select {
  max-width: 82px;
}

body.is-video-mode .model-picker {
  gap: 8px;
}

/* 2026-06-07 storyboard modal and final compact video controls */


.kling-storyboard-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.kling-storyboard-modal[hidden] {
  display: none !important;
}

.kling-storyboard-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 21, 28, 0.28);
  backdrop-filter: blur(16px);
}

.kling-storyboard-dialog {
  position: relative;
  width: min(820px, calc(100vw - 28px));
  max-height: min(760px, calc(var(--app-viewport-height) - 28px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(219, 226, 235, 0.92);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(31, 41, 55, 0.24);
}

.kling-storyboard-head,
.kling-storyboard-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.kling-storyboard-foot {
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  border-bottom: 0;
}

.kling-storyboard-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: var(--fs-lg);
  font-weight: 900;
}

.kling-storyboard-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.kling-storyboard-switch i {
  position: relative;
  width: 36px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: #d7dee8;
  transition: background var(--motion-med) ease;
}

.kling-storyboard-switch i::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
  transition: transform var(--motion-med) ease;
}

.kling-storyboard-switch input:checked + i {
  background: var(--ink);
}

.kling-storyboard-switch input:checked + i::after {
  transform: translateX(14px);
}

.kling-storyboard-close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: var(--fs-xxl);
  line-height: 1;
}

.kling-storyboard-close:hover {
  background: #f1f5f9;
  color: var(--ink-1);
}

.kling-storyboard-shot-list {
  flex: 1 1 auto;
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 14px;
  background: #f8fafc;
}

.kling-storyboard-shot {
  display: grid;
  gap: 10px;
}

.kling-storyboard-shot-top {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) 36px;
  align-items: center;
  gap: 8px;
}

.kling-storyboard-shot-top strong {
  min-width: 72px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: #e2e8f0;
  color: var(--ink-2);
  font-size: var(--fs-md);
  font-weight: 900;
}

.kling-storyboard-shot-top label {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}

.kling-storyboard-shot-top input[type="number"] {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 10px;
  background: transparent;
  color: var(--ink-1);
  font-size: var(--fs-md);
  font-weight: 800;
}

.kling-storyboard-shot-top input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--ink);
}

.kling-storyboard-shot-top span {
  min-width: 34px;
  padding-right: 10px;
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 900;
  text-align: right;
}

.kling-storyboard-shot-top button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--fs-xxl);
  line-height: 1;
}

.kling-storyboard-shot-top button:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.kling-storyboard-shot textarea {
  width: 100%;
  min-height: 94px;
  resize: vertical;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  outline: 0;
  padding: 12px;
  background: var(--bg);
  color: var(--ink-1);
  font-size: var(--fs-md);
  line-height: 1.55;
}

.kling-storyboard-shot textarea:focus,
.kling-storyboard-shot-top label:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.kling-storyboard-add-shot {
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 0 18px 16px;
  height: 40px;
  padding: 0 15px;
  border-radius: var(--radius-md);
  background: #e2e8f0;
  color: var(--ink-2);
  font-size: var(--fs-md);
  font-weight: 900;
}

.kling-storyboard-add-shot:hover {
  background: #cbd5e1;
  color: var(--ink-1);
}

.kling-storyboard-clear,
.kling-storyboard-secondary,
.kling-storyboard-primary {
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 900;
}

.kling-storyboard-clear {
  color: var(--ink-2);
}

.kling-storyboard-clear:hover,
.kling-storyboard-secondary:hover {
  background: #f1f5f9;
}

.kling-storyboard-total {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 900;
}

.kling-storyboard-total.is-warning {
  color: #dc2626;
}

.kling-storyboard-secondary {
  background: #f8fafc;
  color: var(--ink-2);
}

.kling-storyboard-primary {
  background: var(--ink);
  color: #fffdf7;
}

.kling-storyboard-dialog {
  width: min(900px, calc(100vw - 28px));
  max-height: min(780px, calc(var(--app-viewport-height) - 28px));
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.98);
}

.kling-storyboard-head {
  min-height: 62px;
  padding: 14px 20px;
}

.kling-storyboard-foot {
  min-height: 64px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.98);
}

.kling-storyboard-switch {
  gap: 12px;
}

.kling-storyboard-switch i {
  order: -1;
}

.kling-storyboard-shot-list {
  padding: 20px;
  gap: 16px;
  background: #f8fafc;
}

.kling-storyboard-shot-list.is-disabled .kling-storyboard-shot-top {
  grid-template-columns: auto;
}

.kling-storyboard-shot-top {
  grid-template-columns: auto 156px 36px;
}

.kling-storyboard-shot-top strong {
  min-width: 78px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.kling-storyboard-shot-top label {
  height: 36px;
}

.kling-storyboard-shot textarea {
  min-height: 120px;
  border-radius: var(--radius-sm);
}

.kling-storyboard-add-shot[hidden] {
  display: none !important;
}

.kling-storyboard-add-shot {
  margin: 0 20px 16px;
}

.kling-storyboard-total {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 180px;
}

.kling-storyboard-total-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid #dbe4ef;
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--ink-2);
  font-size: var(--fs-base);
  font-weight: 800;
  white-space: nowrap;
}

.kling-storyboard-total-control i {
  position: relative;
  width: 15px;
  height: 15px;
  border: 1.6px solid currentColor;
  border-radius: 50%;
  opacity: 0.65;
}

.kling-storyboard-total-control i::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 1.6px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: currentColor;
}

.kling-storyboard-total-control i::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 7px;
  width: 4px;
  height: 1.6px;
  border-radius: var(--radius-pill);
  background: currentColor;
}

.kling-storyboard-total-control input {
  width: 44px;
  height: 30px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-1);
  font-size: var(--fs-md);
  font-weight: 900;
  text-align: right;
}

.kling-storyboard-total-control b {
  font-size: var(--fs-base);
  font-weight: 900;
}

@media (max-width: 640px) {
  .kling-storyboard-dialog {
    width: calc(100vw - 20px);
    max-height: calc(var(--app-viewport-height) - 20px);
  }

  .kling-storyboard-head,
  .kling-storyboard-foot {
    padding: 12px;
  }

  .kling-storyboard-shot-list {
    padding: 12px;
  }

  .kling-storyboard-shot-top {
    grid-template-columns: auto 88px 34px;
  }

  .kling-storyboard-foot {
    flex-wrap: wrap;
  }

  .kling-storyboard-total {
    width: 100%;
    margin-left: 0;
  }

}

/* 2026-06-08 mobile chat readability: keep long text/media inside the viewport. */


.message,
.message-content,
.reasoning-panel,
.search-sources,
.generated-images,
.generated-videos,
.generated-documents,
.user-attachments,
.message-actions {
  min-width: 0;
  max-width: 100%;
}

.message-content,
.message-content * {
  overflow-wrap: anywhere;
  word-break: break-word;
  letter-spacing: 0;
}

.message-content code,
.message-content pre,
.message-content td,
.message-content th {
  overflow-wrap: normal;
  word-break: normal;
}

.message-content a,
.source-brief small,
.document-card-title,
.generated-video-url {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-content td a,
.message-content th a,
.message-content pre a,
.message-content code a {
  overflow-wrap: normal;
  word-break: normal;
}

.message.assistant .message-content p,
.message.assistant .message-content li,
.message.assistant .message-content blockquote {
  min-width: 0;
  max-width: 100%;
}

.message.assistant .message-content .markdown-table-wrap {
  width: 100%;
  max-width: 100%;
}

.message.assistant .message-content table {
  table-layout: auto;
}

.message.user .message-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 640px) {
  body.is-chatting .chat-shell,
  body.is-chat-empty .chat-shell {
    width: 100%;
    max-width: 100%;
  }

  .message-list {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    padding-bottom: 18px;
  }

  .message {
    width: fit-content;
    max-width: 100%;
    font-size: var(--fs-lg);
    line-height: 1.72;
  }

  .message.user {
    max-width: calc(100vw - 34px);
  }

  .message.assistant {
    width: 100%;
    max-width: 100%;
  }

  .message-content {
    max-width: 100%;
  }

  .generated-videos {
    gap: 8px;
    margin-top: 10px;
  }

  .generated-video-card {
    width: 100%;
    max-width: 100%;
  }

  .video-media-shell {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: min(42vh, 280px);
  }

  .generated-video-card video {
    width: 100%;
    height: 100%;
    max-height: min(42vh, 280px);
    object-fit: contain;
  }

  .generated-video-card .media-seq-shell.is-waiting video,
  .generated-video-card .media-seq-shell.is-loading video {
    min-height: 0;
  }

  .message.user .message-content {
    max-width: min(100%, calc(100vw - 42px));
    padding: 12px 13px;
  }

  .message.assistant .message-content .markdown-table-wrap {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .message.assistant .message-content table {
    min-width: 520px;
    width: max-content;
    max-width: none;
  }

  .message.assistant .message-content th,
  .message.assistant .message-content td {
    padding: 8px 9px;
  }

  .vjshi-result-summary {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .vjshi-result-summary small {
    max-width: 100%;
    text-align: left;
  }

  .vjshi-project-heading {
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
    padding: 12px;
  }

  .vjshi-match-badge {
    grid-column: 2;
    justify-self: start;
  }

  .vjshi-material-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
    padding: 12px;
  }

  .vjshi-material-facts {
    gap: 9px 14px;
  }

  .message.assistant .message-content pre {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 420px) {
  .vjshi-material-facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

.message.assistant .message-content .markdown-code-block {
  max-width: 100%;
  margin: 14px 0 18px;
  overflow: hidden;
  border: 1px solid rgba(210, 205, 190, 0.72);
  border-radius: var(--radius-sm);
  background: rgba(255, 251, 235, 0.78);
  box-shadow:
    0 8px 24px rgba(72, 62, 31, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.message.assistant .message-content .markdown-code-toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 6px 16px;
  border-bottom: 1px solid rgba(210, 205, 190, 0.56);
  background: rgba(255, 255, 255, 0.42);
}

.message.assistant .message-content .markdown-code-label {
  min-width: 0;
  overflow: hidden;
  color: rgba(82, 76, 61, 0.78);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message.assistant .message-content .markdown-code-copy {
  display: inline-grid;
  width: 32px;
  min-width: 32px;
  height: 33px;
  min-height: 33px;
  flex: 0 0 33px;
  place-items: center;
  border: 1px solid rgba(185, 177, 153, 0.5);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(37, 34, 27, 0.76);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(72, 62, 31, 0.06);
  transition:
    transform var(--motion-med) cubic-bezier(0.16, 1, 0.3, 1),
    border-color var(--motion-med) ease,
    background var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    color var(--motion-med) ease;
}

.message.assistant .message-content .markdown-code-copy:hover {
  border-color: rgba(194, 168, 0, 0.52);
  background: rgba(255, 249, 196, 0.86);
  color: rgba(23, 23, 23, 0.92);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(72, 62, 31, 0.1);
}

.message.assistant .message-content .markdown-code-copy:active {
  transform: translateY(0) scale(0.94);
}

.message.assistant .message-content .markdown-code-copy.is-done {
  border-color: rgba(194, 168, 0, 0.58);
  background: rgba(255, 225, 0, 0.88);
  color: rgba(23, 23, 23, 0.94);
  box-shadow: 0 7px 18px rgba(160, 132, 0, 0.18);
}

.message.assistant .message-content .markdown-code-copy.is-failed {
  border-color: rgba(220, 38, 38, 0.42);
  background: rgba(254, 226, 226, 0.86);
  color: rgba(153, 27, 27, 0.92);
}

.message.assistant .message-content .markdown-code-copy svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message.assistant .message-content .markdown-code-block pre {
  margin: 0;
  padding: 15px 17px 17px;
  max-width: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.message.assistant .message-content .markdown-code-block pre code {
  font-size: 0.92em;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 640px) {
  .message.assistant .message-content .markdown-code-toolbar {
    min-height: 56px;
    padding: 6px 6px 6px 14px;
  }

  .message.assistant .message-content .markdown-code-copy {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    flex-basis: 44px;
  }

  .message.assistant .message-content .markdown-code-block pre {
    padding: 14px 14px 16px;
    overflow: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  .message.assistant .message-content .markdown-code-copy {
    transition-duration: 0.01ms;
  }
}

/* Composer control primitives; final presentation is scoped to .composer-dock below. */


.model-control {
  flex-shrink: 0;
}


.model-trigger,
.web-search-button,
.document-generate-button,
.file-button,
.composer #send-button,
body.is-video-mode .model-picker > #kling-audio-toggle,
body.is-video-mode .model-picker > #kling-multi-reference-toggle,
body.is-video-mode .model-picker > #kling-storyboard-toggle {
  line-height: 1 !important;
  letter-spacing: 0;
  white-space: nowrap;
}


.model-trigger {
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
  gap: 8px !important;
  padding: 0 11px !important;
}

.model-trigger > span:first-child,
.web-search-button,
.document-generate-button,
body.is-video-mode .model-picker > #kling-audio-toggle,
body.is-video-mode .model-picker > #kling-multi-reference-toggle,
body.is-video-mode .model-picker > #kling-storyboard-toggle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}


.file-button,
body.is-video-mode .file-button,
.composer #send-button,
body.is-video-mode .composer #send-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}


.composer #send-button span {
  display: none;
}


.chat-model-control {
  width: 120px !important;
  flex: 0 0 120px !important;
}
body.is-video-mode .video-model-control {
  width: 120px !important;
  flex: 0 0 120px !important;
}
body.is-video-mode .video-ratio-control {
  width: 88px !important;
  flex: 0 0 88px !important;
}
body.is-video-mode .video-duration-control,
body.is-video-mode .model-picker > #kling-audio-toggle {
  width: 56px !important;
  flex: 0 0 56px !important;
}

.model-popover{
  border-color: rgba(255, 255, 255, 0.8);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(236, 249, 255, 0.44) 50%, rgba(255, 247, 176, 0.26)),
    rgba(255, 255, 255, 0.52);
  box-shadow:
    0 22px 58px rgba(21, 27, 35, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(30px) saturate(1.7);
  -webkit-backdrop-filter: blur(30px) saturate(1.7);
}

.model-option:hover,
.model-option.active{
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(255, 246, 166, 0.32)),
    rgba(255, 255, 255, 0.38);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .composer,
  .mode-tabs,
  .model-trigger,
  .web-search-button,
  .document-generate-button,
  .file-button,
  .model-popover{
    background: rgba(252, 254, 255, 0.92) !important;
  }
}

@media (max-width: 640px) {


  .chat-model-control,
  body.is-video-mode .video-model-control {
    width: 120px !important;
    flex-basis: 120px !important;
  }
  body.is-video-mode .video-ratio-control {
    width: 88px !important;
    flex-basis: 88px !important;
  }
  body.is-video-mode .video-duration-control,
  body.is-video-mode .model-picker > #kling-audio-toggle {
    width: 54px !important;
    flex-basis: 54px !important;
  }


  .model-chevron {
    flex: 0 0 auto;
  }
}

@media (max-width: 430px) {

  body.is-video-mode .video-model-control {
    width: 112px !important;
    flex-basis: 112px !important;
  }
  body.is-video-mode .video-ratio-control {
    width: 82px !important;
    flex-basis: 82px !important;
  }
}

/* Final narrow-screen composer overrides must remain after legacy mobile rules. */
@media (max-width: 640px) {


  body.is-video-mode .video-model-control {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  body.is-video-mode .video-param-control {
    width: 54px;
    min-width: 54px;
    flex: 0 0 54px;
  }
  .video-param-trigger {
    justify-content: center;
    gap: 0 !important;
    padding: 0 6px !important;
  }
  .video-param-trigger .model-chevron {
    display: none;
  }


}

/* Phase 3 interaction and accessibility guardrails. */


[inert] {
  pointer-events: none;
  user-select: none;
}

.sidebar-bottom-link,
.generated-document-card,
.generated-video-download,
.auth-user-option {
  min-height: 44px;
}

/* Attachment chips use a compact icon control instead of inheriting the
   global 44px button height, which distorted the remove button into a pill. */


.attachment-chip {
  overflow: hidden;
  padding-right: 6px;
}

.attachment-name {
  flex: 1 1 auto;
  max-width: 150px;
}

.attachment-remove {
  position: static;
  order: 3;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px !important;
  flex: 0 0 26px;
  border-color: rgba(23, 23, 23, 0.08);
  background: rgba(23, 23, 23, 0.07);
  color: rgba(23, 23, 23, 0.68);
  box-shadow: none;
}

.attachment-remove:hover {
  border-color: rgba(23, 23, 23, 0.14);
  background: rgba(23, 23, 23, 0.12);
  color: #111;
}

.attachment-remove:focus-visible {
  outline: 2px solid rgba(255, 225, 0, 0.9);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .attachment-chip {
    overflow: visible;
    padding: 4px;
  }

  .attachment-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    order: initial;
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px !important;
    flex-basis: 22px;
    border-color: rgba(255, 255, 255, 0.82);
    background: rgba(23, 23, 23, 0.84);
    color: #fffdf7;
    box-shadow: 0 6px 14px rgba(31, 27, 18, 0.16);
  }
}

.sidebar-icon-button,
.show-sidebar-button,
.sidebar-avatar-button,
.sidebar-user-menu-button,
.profile-close,
.kling-storyboard-close,
.image-preview-close,
.image-preview-download,
.source-drawer-close {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
}

.history-row {
  grid-template-columns: minmax(0, 1fr) 28px;
  min-height: 42px;
}

body :where(button, a[href], input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #171717 !important;
  outline-offset: 3px !important;
}

.history-sidebar :where(button, a[href], input, select, textarea, [tabindex]):focus-visible,
.image-preview-modal :where(button, a[href], [tabindex]):focus-visible {
  outline-color: #ffe100 !important;
}

[role="option"].is-keyboard-active {
  border-color: rgba(23, 23, 23, 0.34) !important;
  background: rgba(255, 225, 0, 0.3) !important;
  color: #171717 !important;
  box-shadow: inset 3px 0 0 #171717;
}

.model-card-popover [role="option"].is-keyboard-active {
  border-color: rgba(255, 225, 0, 0.84) !important;
  background: var(--yellow) !important;
  color: #171717 !important;
  box-shadow: none;
}

.model-popover.model-card-popover {
  width: min(304px, calc(100vw - 28px));
  min-width: 0;
}

.archive-note {
  color: rgba(255, 255, 255, 0.74);
}

.message-time,
.chat-disclaimer {
  color: #626a76;
}

.generated-video-card {
  display: grid;
  gap: 9px;
}

.generated-image-tool {
  justify-content: center;
  text-decoration: none;
}

.media-intent-confirmation {
  max-width: min(520px, 92%);
}

.media-intent-confirmation-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 225, 0, 0.48);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface, #fffdf7) 94%, #ffe100);
  box-shadow: 0 10px 26px rgba(28, 24, 8, 0.12);
}

.media-intent-confirmation-card strong {
  color: var(--ink, #171300);
  font-size: var(--fs-base);
}

.media-intent-confirmation-card p {
  margin: 0;
  color: var(--muted, #626a76);
  line-height: 1.5;
}

.media-intent-confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

.media-intent-confirmation-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(24, 19, 0, 0.16);
  border-radius: 6px;
  background: transparent;
  color: var(--ink, #171300);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.media-intent-confirmation-actions button[data-action="media-intent-accept"] {
  border-color: #ffe100;
  background: #ffe100;
}

.media-intent-confirmation-actions button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.chat-notice {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: auto;
  bottom: auto;
  left: 50%;
  z-index: 90;
  display: flex;
  min-height: 44px;
  max-width: min(440px, calc(100vw - 64px));
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill);
  background: #24231f;
  color: #fffdf7;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  font-size: var(--fs-base);
  font-weight: 800;
  transform: translateX(-50%);
}

.chat-notice[hidden] {
  display: none;
}

.chat-notice span {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: normal;
}

.chat-notice-action {
  flex: 0 0 auto;
  min-width: 58px;
  height: 32px;
  min-height: 32px !important;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-xs);
  background: #ffe100;
  color: #171300;
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 850;
}

.chat-notice-close {
  flex: 0 0 auto;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px !important;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: rgba(255, 253, 247, 0.58);
  cursor: pointer;
  font: 400 20px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.sources-open .chat-notice {
  z-index: 33;
}

@media (max-width: 640px) {
  .chat-notice {
    right: 12px;
    left: 56px;
    top: max(12px, env(safe-area-inset-top));
    max-width: none;
    gap: 6px;
    padding: 6px 6px 6px 10px;
    font-size: var(--fs-sm);
    transform: none;
  }

  .chat-notice-action {
    min-width: 54px;
    padding: 0 10px;
  }

  .chat-notice-close {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px !important;
    font-size: var(--fs-lg);
  }

  .generated-image-toolbar {
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .generated-image-tool {
    flex: 0 0 auto;
    min-height: 30px !important;
    height: 30px;
    padding-inline: 8px;
    font-size: var(--fs-xs);
  }
}

/* 2026-07-14: restore the compact pre-readability chat and source-panel visuals. */


.chat-shell,
.chat-shell:has(.message-list:empty) {
  width: min(760px, 100%);
}

.composer textarea:focus-visible {
  outline: none !important;
}

.source-drawer {
  width: min(360px, calc(100vw - 24px));
  background: rgba(255, 255, 255, 0.92);
}

.source-drawer-list {
  gap: 7px;
  padding: 10px;
}

.source-brief {
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 2px 8px;
  padding: 9px 10px;
  border: 1px solid rgba(226, 220, 205, 0.68);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.68);
  box-shadow: none;
}

.source-brief:hover,
.source-brief.is-active {
  border-color: rgba(255, 225, 0, 0.86);
  background: rgba(255, 250, 222, 0.9);
  box-shadow: none;
}

.source-brief-index,
.source-brief.is-active .source-brief-index {
  grid-column: 1;
  grid-row: 1;
  background: var(--yellow);
  color: var(--charcoal);
  font-size: var(--fs-xs);
  font-weight: 900;
}

.source-brief > .source-brief-content {
  grid-column: 2;
  grid-row: 1;
  gap: 1px;
}

.source-brief-heading,
.source-brief-meta {
  gap: 5px;
  font-size: var(--fs-sm);
  line-height: 1.35;
}

.source-brief-favicon {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.source-brief-date::before {
  margin-right: 5px;
}

.source-brief-title {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: var(--fs-base);
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-line-clamp: initial;
}

.source-brief-snippet {
  margin: 4px 0 0;
  color: rgba(23, 23, 23, 0.72);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-line-clamp: 2;
}

.source-brief-url {
  margin-top: 2px;
  font-size: var(--fs-sm);
  line-height: 1.35;
}

.search-sources {
  margin: 7px 0 2px;
}

.source-summary-button {
  min-width: 96px;
  min-height: 30px;
  padding: 5px 11px;
  font-size: var(--fs-sm);
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(31, 27, 18, 0.05);
}

@media (min-width: 1200px) and (max-width: 1679px) {
  .chat-shell,
  body.is-chat-empty .chat-shell,
  .chat-shell:has(.message-list:empty) {
    width: min(690px, 100%);
  }

  body.is-chatting .chat-shell {
    width: min(760px, 100%);
  }
}

@media (min-width: 1680px) {
  .chat-shell,
  body.is-chat-empty .chat-shell,
  .chat-shell:has(.message-list:empty) {
    width: min(660px, 100%);
  }

  body.is-chatting .chat-shell {
    width: min(720px, 100%);
  }
}

@media (min-width: 641px) and (max-width: 1100px) {
  .chat-shell {
    width: min(760px, 100%);
  }
}

@media (min-width: 1360px) {
  body.sources-open .chat-layout {
    grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr) 360px;
  }

  body.sources-open.sidebar-collapsed .chat-layout {
    grid-template-columns: 0 minmax(0, 1fr) 360px;
  }
}

@media (min-width: 641px) and (pointer: fine) {
  .mode-tab,
  .mode-tab.active {
    height: 30px;
    min-height: 30px !important;
  }

  .message-action {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px !important;
  }

  .source-summary-button {
    min-height: 30px !important;
  }

  .source-drawer-close {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px !important;
  }

  .sidebar-icon-button,
  .show-sidebar-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px !important;
  }

  .sidebar-avatar-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px !important;
  }

  .sidebar-user-menu-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px !important;
  }

  .history-row {
    grid-template-columns: minmax(0, 1fr) 24px;
    height: 42px;
    min-height: 42px;
  }

  .history-list {
    grid-auto-rows: 42px;
  }

  .history-delete {
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 24px !important;
  }

  .archive-toggle-button {
    min-height: 28px !important;
  }
}

@media (max-width: 640px) {
  .source-drawer {
    width: 100%;
  }

  .source-drawer-list {
    padding: 10px 12px max(16px, env(safe-area-inset-bottom));
  }
}

/* AIChat product polish v158: restrained substrate, calmer controls, feedback-only motion. */


body,
.chat-layout {
  background:
    radial-gradient(520px 280px at 72% -10%, rgba(255, 225, 0, 0.12), transparent 62%),
    var(--page);
  color: var(--ink-2);
}

.message {
  line-height: 1.66;
}

.message.assistant .message-content {
  color: var(--ink-1);
}

.message.assistant .message-content blockquote {
  margin: 12px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 191, 0, 0.22);
  border-radius: var(--radius-md);
  background: rgba(255, 248, 204, 0.34);
  color: rgba(40, 38, 31, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 253, 247, 0.62);
}


.model-popover{
  border-color: rgba(48, 32, 20, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.94), rgba(250, 246, 240, 0.86)),
    var(--bg);
  box-shadow:
    0 26px 62px -42px rgba(60, 38, 20, 0.46),
    inset 0 1px 0 rgba(255, 253, 247, 0.72);
  backdrop-filter: blur(16px) saturate(1.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
  transition:
    opacity var(--motion-fast) var(--ease-out),
    transform var(--motion-med) var(--ease-out);
}

.model-option:hover,
.model-option.active{
  background: rgba(255, 225, 0, 0.16);
}

.chat-notice {
  border-color: rgba(255, 253, 247, 0.16);
  border-radius: var(--radius-sm);
  background: #24231f;
  color: #fffdf7;
  box-shadow: 0 12px 30px rgba(24, 20, 16, 0.24);
  animation: chatNoticeIn var(--motion-med) var(--ease-out) both;
}

.chat-notice-action {
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--on-accent);
}

.chat-notice-close {
  background: transparent;
  color: rgba(255, 253, 247, 0.58);
}

@keyframes chatNoticeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* AIChat motion polish v159: feedback-only motion for the five reviewed stages. */


.message.motion-enter,
.message.motion-enter-assistant {
  will-change: opacity, transform;
}

.message.motion-enter {
  animation: messageEnterUser var(--motion-slow) var(--ease-out) both;
  transform-origin: right bottom;
}

.message.motion-enter-assistant {
  animation: messageEnterAssistant var(--motion-slow) var(--ease-out) both;
  transform-origin: left bottom;
}

.message.is-thinking-motion .message-content {
  animation: thinkingPanelBreath 2.35s ease-in-out infinite;
}

.message.is-thinking-motion .text-stream-thinking {
  position: relative;
  animation: thinkingStatusIn var(--motion-slow) var(--ease-out) both;
}

.message.is-media-result-entering .generated-images,
.message.is-media-result-entering .generated-videos,
.message.is-media-result-entering .generated-documents {
  animation: mediaResultCompleteIn var(--motion-slow) var(--ease-out) both;
}

.message.is-media-result-entering :is(.generated-image-card, .generated-video-card, .generated-document-card) {
  animation: resultCardSettle var(--motion-slow) var(--ease-out) both;
  will-change: opacity, transform;
}

.model-popover{
  transform-origin: left bottom;
  will-change: opacity, transform;
}

.model-popover.is-open{
  animation: popoverSettleIn var(--motion-med) var(--ease-out) both;
}

.chat-notice.is-showing {
  animation: chatNoticeLiftIn var(--motion-med) var(--ease-out) both;
}

.chat-notice.is-release {
  border-color: rgba(255, 253, 247, 0.14);
  box-shadow: 0 12px 30px rgba(24, 20, 16, 0.24);
}

.chat-notice.is-release::before {
  display: none;
  content: none;
}

@keyframes composerFocusSweep {
  from {
    background-position: 115% 50%, 70% 50%, 100% 50%;
  }
  to {
    background-position: -55% 50%, 0% 50%, -80% 50%;
  }
}

@keyframes messageEnterUser {
  from {
    opacity: 0.001;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes messageEnterAssistant {
  from {
    opacity: 0.001;
    transform: translateY(10px) scale(0.982);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes thinkingStatusIn {
  from {
    opacity: 0.001;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes thinkingPanelBreath {
  0%,
  100% {
    box-shadow: 0 14px 34px -30px rgba(60, 38, 20, 0.32);
  }
  50% {
    box-shadow: 0 18px 42px -30px rgba(217, 191, 0, 0.38);
  }
}

@keyframes mediaResultCompleteIn {
  from {
    opacity: 0.001;
    transform: translateY(8px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes resultCardSettle {
  from {
    opacity: 0.001;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popoverSettleIn {
  0% {
    opacity: 0.001;
    transform: translateY(8px) scale(0.965);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mobileModelPopoverSettleIn {
  0% {
    opacity: 0.001;
    transform: translate(-50%, 8px) scale(0.965);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes chatNoticeLiftIn {
  from {
    opacity: 0.001;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes chatNoticeMobileLiftIn {
  from {
    opacity: 0.001;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .chat-notice.is-showing {
    animation-name: chatNoticeMobileLiftIn;
  }
}

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

  .model-popover,
  .chat-notice {
    transform: translateX(-50%);
  }

  .model-popover{
    transform: none;
  }

  body.motion-ready .composer:focus-within::before,
  .message.motion-enter,
  .message.motion-enter-assistant,
  .message.is-thinking-motion .message-content,
  .message.is-thinking-motion .text-stream-thinking,
  .message.is-media-result-entering .generated-images,
  .message.is-media-result-entering .generated-videos,
  .message.is-media-result-entering .generated-documents,
  .message.is-media-result-entering :is(.generated-image-card, .generated-video-card, .generated-document-card),
  .model-popover.is-open,
  .chat-notice.is-showing {
    animation: none !important;
    opacity: 1 !important;
  }
}
.video-param-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center !important;
  text-align: center;
}
.video-param-trigger > span:first-child {
  width: 100%;
  text-align: center;
}
.video-param-trigger .model-chevron {
  position: absolute;
  right: 12px;
}

/* AIChat composer control refinement v161. */


.model-control,
.video-param-control {
  z-index: 24;
}

body.is-video-mode .video-ratio-control {
  width: 78px !important;
  flex: 0 0 78px !important;
}
body.is-video-mode .video-duration-control,
body.is-video-mode .model-picker > #kling-audio-toggle {
  width: 50px !important;
  flex: 0 0 50px !important;
}


.model-trigger,
.web-search-button,
.document-generate-button,
.file-button,
.composer #send-button,
.mode-tab,
.video-param-trigger,
body.is-video-mode .model-picker > #kling-audio-toggle,
body.is-video-mode .model-picker > #kling-multi-reference-toggle,
body.is-video-mode .model-picker > #kling-storyboard-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center;
}

.model-trigger {
  position: relative;
  gap: 0 !important;
  padding: 0 27px 0 11px !important;
}

.model-trigger > span:first-child,
.video-param-trigger > span:first-child {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-trigger .model-chevron,
.video-param-trigger .model-chevron {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-58%) rotate(45deg);
}

.model-trigger[aria-expanded="true"] .model-chevron,
.video-param-trigger[aria-expanded="true"] .model-chevron {
  transform: translateY(-42%) rotate(225deg);
}


@media (max-width: 640px) {


  body.is-video-mode .video-param-control {
    width: 50px !important;
    min-width: 50px;
    flex: 0 0 50px !important;
  }

  .model-popover.model-card-popover {
    left: calc(50vw - 25px);
    transform: translate(-50%, 10px) scale(0.96);
    transform-origin: center bottom;
  }

  .model-popover.model-card-popover.is-open {
    transform: translate(-50%, 0) scale(1);
    animation-name: mobileModelPopoverSettleIn;
  }
  .video-param-trigger {
    padding: 0 7px !important;
  }
}

/* Generation modes do not display text-only or legacy video quick actions. */


body.is-image-mode .web-search-button,
body.is-video-mode .web-search-button,
body.is-image-mode .document-generate-button,
body.is-video-mode .document-generate-button,
body.is-video-mode .model-picker > #kling-audio-toggle,
body.is-video-mode .model-picker > #kling-multi-reference-toggle,
body.is-video-mode .model-picker > #kling-storyboard-toggle {
  display: none !important;
}

body.is-video-mode .video-model-control {
  width: 116px !important;
  flex: 0 0 116px !important;
}

body.is-video-mode .video-param-control {
  width: 66px !important;
  flex: 0 0 66px !important;
}

.video-param-popover .video-param-kling-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 640px) {
  body.is-video-mode .video-model-control {
    width: 92px !important;
    flex: 0 0 92px !important;
  }
  body.is-video-mode .video-param-control {
    width: 50px !important;
    flex: 0 0 50px !important;
  }
}

body,
.chat-layout {
  background: var(--page);
  color: var(--ink-2);
}

body::before,
body::after,
.composer::before,
.composer::after {
  display: none !important;
}

.chat-page {
  padding: 24px;
  background: var(--page);
}

body.is-chatting .chat-page {
  padding: 34px 24px 68px;
}

.chat-shell,
body.is-chatting .chat-shell,
body.is-chat-empty .chat-shell,
.chat-shell:has(.message-list:empty) {
  width: min(900px, 100%);
}

body.is-chatting .chat-shell {
  height: calc(var(--app-viewport-height) - 112px);
}

.history-sidebar {
  padding: 22px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: #252522;
  box-shadow: none;
}

.history-brand img {
  width: 54px;
  height: 42px;
}

.history-brand strong {
  font-size: var(--fs-md);
}

.history-brand span {
  color: rgba(245, 245, 241, 0.54);
}

.new-chat-button {
  justify-content: flex-start;
  margin: 28px 0 18px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(249, 251, 248, 0.92);
  box-shadow: none;
}

.new-chat-button span {
  color: rgba(249, 251, 248, 0.76);
}

.new-chat-button:hover,
.new-chat-button:focus-visible {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
  color: #fffdf7;
  transform: none;
}

.history-list {
  grid-auto-rows: 42px;
  gap: 4px;
  mask-image: none;
}

.history-row {
  height: 42px;
  min-height: 42px;
  border-color: transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.history-row:hover,
.history-row.active {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  transform: none;
}

.history-row.active {
  background: rgba(255, 255, 255, 0.12);
}

.history-row .history-item {
  font-weight: 570;
}

.history-row.active .history-item {
  font-weight: 680;
}

.history-row-archived {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.035);
}

.history-title {
  text-align: center;
}

.history-time {
  color: rgba(245, 245, 241, 0.48);
}

.sidebar-user-panel,
.sidebar-tools-panel {
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar-avatar-button {
  border-color: rgba(255, 225, 0, 0.58);
  background: var(--yellow);
  box-shadow: none;
}

.history-bottom-links a.sidebar-bottom-link {
  min-height: 36px;
}

.history-bottom-links a.sidebar-admin-link,
.history-bottom-links a.sidebar-admin-link:hover {
  border-left: 2px solid var(--yellow);
  background: rgba(255, 225, 0, 0.08);
  color: rgba(249, 251, 248, 0.92);
  box-shadow: none;
}

.sidebar-admin-link .sidebar-link-icon,
.sidebar-admin-link .sidebar-link-arrow,
.sidebar-admin-link:hover .sidebar-link-icon,
.sidebar-admin-link:hover .sidebar-link-arrow {
  color: var(--yellow);
}

.message-list {
  gap: 20px;
  padding: 18px 10px 12px 2px;
}

body.is-chatting .message-list {
  gap: 22px;
  padding: 18px 10px 12px 2px;
}

.message {
  max-width: min(760px, 100%);
  color: var(--ink-1);
  line-height: 1.72;
}

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

.message.assistant .message-content {
  color: var(--ink-1);
}

.message.assistant .message-content strong {
  color: #292923;
}

.message.assistant .message-content a {
  color: #4a4a42;
  text-decoration-color: rgba(74, 74, 66, 0.36);
}

.message.assistant .message-content a:hover {
  color: #2d2d28;
}

.message.assistant .message-content blockquote {
  border-color: rgba(255, 225, 0, 0.3);
  background: rgba(255, 225, 0, 0.1);
  box-shadow: none;
}

.message.user .message-content {
  border-color: rgba(52, 52, 46, 0.12);
  border-radius: 15px 15px 5px 15px;
  background: #efefeb;
  color: var(--ink-1);
  box-shadow: none;
}

.message-action {
  border-color: rgba(52, 52, 46, 0.14);
  background: transparent;
  color: rgba(70, 70, 62, 0.72);
  box-shadow: none;
}

.message-action:hover,
.message-action.is-done,
.message.user .message-action:hover,
.message.user .message-action.is-done {
  border-color: rgba(255, 225, 0, 0.58);
  background: rgba(255, 225, 0, 0.13);
  box-shadow: none;
  color: #5d4a12;
}


.model-popover{
  border-color: rgba(52, 52, 46, 0.14);
  background: var(--bg);
  box-shadow: 0 18px 40px -26px rgba(42, 42, 38, 0.36);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.model-option:hover,
.model-option.active{
  background: rgba(255, 225, 0, 0.17);
}

.skill-menu button {
  height: 44px !important;
  min-height: 44px !important;
}

.source-drawer {
  width: min(360px, calc(100vw - 24px));
  border-left-color: rgba(52, 52, 46, 0.14);
  background: var(--bg);
  box-shadow: -16px 0 34px -26px rgba(42, 42, 38, 0.38);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.source-drawer-header {
  border-bottom-color: var(--line);
}

.source-brief {
  border-bottom-color: var(--line);
}

.source-brief:hover,
.source-brief.is-active {
  background: rgba(255, 225, 0, 0.08);
}

.source-drawer-close {
  border-color: rgba(52, 52, 46, 0.14);
  background: transparent;
}

.chat-history-loading,
.message.is-typing {
  border-color: rgba(52, 52, 46, 0.12);
  background: #f8f8f5;
  box-shadow: var(--shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-history-loader i,
.typing span {
  background: var(--yellow);
  box-shadow: none;
}

/* The global 44px touch-target guard must not stretch compact upload actions
   into the dark vertical block seen on narrow attachment cards. */


.attachment-chip.has-upload .media-upload-actions {
  min-height: 24px !important;
}

.attachment-chip.has-upload .media-upload-actions button {
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  padding: 0 !important;
}

.attachment-chip.has-upload .media-upload-feedback {
  background: rgba(255, 254, 251, 0.95);
  color: var(--ink-1);
}

.attachment-chip.has-upload .media-upload-feedback .media-upload-spinner {
  border-color: rgba(52, 52, 46, 0.18);
  border-top-color: var(--yellow);
}

.attachment-chip.has-upload .media-upload-feedback .media-upload-progress {
  background: rgba(255, 225, 0, 0.16);
}

.attachment-chip.has-upload .media-upload-feedback .media-upload-progress > i {
  background: var(--yellow);
}

@media (max-width: 640px) {
  .source-summary-button {
    min-height: 44px !important;
  }

  .chat-page,
  body.is-chatting .chat-page {
    padding: 52px 12px calc(24px + var(--app-keyboard-inset));
  }

  .chat-shell,
  body.is-chatting .chat-shell,
  body.is-chat-empty .chat-shell,
  .chat-shell:has(.message-list:empty) {
    width: 100%;
    max-width: 100%;
  }

  body.is-chatting .chat-shell {
    height: calc(var(--app-viewport-height) - 86px);
  }


  .message-list,
  body.is-chatting .message-list {
    gap: 18px;
    padding: 14px 2px 12px;
  }

  .message.user .message-content {
    max-width: min(560px, calc(100vw - 34px));
  }

  .source-drawer {
    width: 100%;
    border-top-color: rgba(52, 52, 46, 0.14);
    box-shadow: 0 -16px 34px -26px rgba(42, 42, 38, 0.38);
  }
}

@media (prefers-reduced-motion: reduce) {
  .new-chat-button:hover,
  .composer #send-button:hover,
  .model-trigger:hover,
  .message-action:hover {
    transform: none !important;
  }
}

/* v194: calm workspace visual pass. Keep the three primary modes visible
   while reducing decorative chrome and reserving the accent for intent. */


:root {
  --yellow: #e7b83f;
  --yellow-soft: rgba(231, 184, 63, 0.16);
  --accent: var(--yellow);
  --accent-soft: rgba(231, 184, 63, 0.14);
  --glow-accent: rgba(231, 184, 63, 0.12);
  --page: #f3f3f0;
  --bg: #fffefa;
  --panel-2: #f7f7f4;
  --sidebar: #292824;
  --sidebar-soft: #34322e;
  --border: rgba(42, 42, 38, 0.12);
  --line: rgba(52, 52, 46, 0.12);
  --shadow-lg: 0 16px 38px -30px rgba(42, 42, 38, 0.3);
}

.chat-page {
  background: var(--page) !important;
}

.chat-shell,
body.is-chatting .chat-shell {
  width: min(780px, 100%) !important;
}

.history-sidebar {
  padding: 20px 16px !important;
  background: var(--sidebar) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none !important;
}

.history-header {
  min-height: 48px;
}

.history-brand {
  gap: 9px;
}

.history-brand img {
  width: 52px;
  height: 40px;
}

.sidebar-icon-button,
.show-sidebar-button {
  width: 34px;
  height: 34px;
  border-color: rgba(255, 255, 255, 0.14) !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: rgba(255, 253, 247, 0.78) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.sidebar-icon-button:hover,
.show-sidebar-button:hover,
.sidebar-icon-button:focus-visible,
.show-sidebar-button:focus-visible {
  border-color: rgba(231, 184, 63, 0.52) !important;
  background: rgba(231, 184, 63, 0.12) !important;
  color: #fffdf7 !important;
}

.new-chat-button {
  min-height: 40px;
  margin: 24px 0 18px;
  justify-content: flex-start;
  padding: 0 12px;
  border: 1px solid rgba(231, 184, 63, 0.46);
  border-radius: var(--radius-sm);
  background: rgba(231, 184, 63, 0.12);
  color: #fffdf7;
  font-size: var(--fs-base);
  font-weight: 760;
}

.new-chat-button:hover,
.new-chat-button:focus-visible {
  border-color: rgba(231, 184, 63, 0.7);
  background: rgba(231, 184, 63, 0.18);
  transform: none;
}

.new-chat-button span {
  color: var(--yellow);
}

.history-row {
  border-radius: var(--radius-sm) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.history-row:hover,
.history-row:focus-within,
.history-row.active {
  background: rgba(255, 255, 255, 0.075) !important;
  box-shadow: inset 2px 0 0 var(--yellow) !important;
}

.sidebar-user-panel,
.sidebar-tools-panel {
  border-color: rgba(255, 255, 255, 0.1) !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(255, 255, 255, 0.035) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.sidebar-version {
  display: none;
}


.model-trigger:hover,
.model-trigger[aria-expanded="true"],
.web-search-button:hover,
.web-search-button.active,
.document-generate-button:hover,
.document-generate-button.active,
.file-button:hover,
.file-button.has-file {
  border-color: rgba(231, 184, 63, 0.65) !important;
  background: #fffdf4 !important;
  box-shadow: none !important;
  transform: none !important;
}


.composer #send-button:hover {
  background: #efc759 !important;
  box-shadow: 0 5px 14px rgba(198, 154, 36, 0.22) !important;
  transform: none !important;
}

.model-popover{
  border-radius: 10px !important;
  background: var(--bg) !important;
  box-shadow: 0 18px 40px -26px rgba(42, 42, 38, 0.38) !important;
  backdrop-filter: none !important;
}

.message {
  font-size: 15px !important;
  line-height: 1.68 !important;
}

.message.user .message-content {
  border: 1px solid rgba(42, 42, 38, 0.1) !important;
  border-radius: 12px 12px 4px 12px !important;
  background: #eeeee9 !important;
  box-shadow: none !important;
}

.message-actions {
  opacity: 0;
  pointer-events: auto;
  transition: opacity var(--motion-fast) ease;
}

.message:hover .message-actions,
.message:focus-within .message-actions,
.message-actions:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.message-action {
  width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  border: 1px solid rgba(42, 42, 38, 0.12) !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--ink-3) !important;
  box-shadow: none !important;
}

.message-action:hover,
.message-action:focus-visible,
.message-action.is-done {
  border-color: rgba(231, 184, 63, 0.55) !important;
  background: rgba(231, 184, 63, 0.12) !important;
  color: var(--ink-1) !important;
  transform: none !important;
}

.aichat-execution-trace {
  border-color: rgba(42, 42, 38, 0.1) !important;
  border-radius: 8px !important;
  background: #f7f7f3 !important;
  box-shadow: none !important;
}

@media (max-width: 640px) {
  .chat-page,
  body.is-chatting .chat-page {
    padding: 52px 12px calc(24px + var(--app-keyboard-inset)) !important;
  }


  .message-actions {
    opacity: 0.82;
    pointer-events: auto;
  }

  .message-action {
    width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .message-actions {
    transition: none;
  }
}

/* AIChat prompt callout: keep the yellow prompt readable while exposing one
   predictable, keyboard-accessible copy action. */


.message.assistant .message-content blockquote.prompt-callout {
  position: relative;
  padding: 11px 52px 11px 13px;
}

.prompt-callout-copy {
  min-width: 0;
}

.prompt-callout-copy p {
  margin: 0;
}

.prompt-callout-copy p + p {
  margin-top: 6px;
}

.prompt-callout-copy-button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-grid;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  place-items: center;
  border: 1px solid rgba(126, 103, 0, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 231, 0.76);
  color: #5d4a12;
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}

.prompt-callout-copy-button:hover,
.prompt-callout-copy-button.is-done {
  border-color: rgba(126, 103, 0, 0.42);
  background: rgba(255, 253, 231, 0.98);
  transform: translateY(-1px);
}

.prompt-callout-copy-button:active {
  transform: scale(0.94);
}

.prompt-callout-copy-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aichat-trace-item {
  will-change: opacity, transform;
}

@media (max-width: 640px) {
  .prompt-callout-copy-button {
    top: 4px;
    right: 4px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
}

/* AIChat control alignment v184.
   Keep the existing product shell, but give every media control one quiet
   surface, one active state, and enough width for its value to remain legible. */


:root {
  --chat-control-height: 38px;
  --chat-control-radius: 10px;
  --chat-popover-radius: 12px;
  --chat-popover-gap: 8px;
  --chat-option-height: 36px;
}

@media (min-width: 641px) {
  body.sidebar-collapsed .chat-layout {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  body.sidebar-collapsed .history-sidebar {
    margin-left: calc(-1 * var(--app-sidebar-width));
    opacity: 0;
    pointer-events: none;
    transform: translateX(-8px);
    visibility: hidden;
  }

  body:not(.sidebar-collapsed) .history-sidebar {
    transform: none;
    visibility: visible;
  }
}

.model-trigger,
.video-param-trigger{
  height: var(--chat-control-height) !important;
  min-height: var(--chat-control-height) !important;
  border-radius: var(--chat-control-radius) !important;
  padding: 0 24px 0 10px !important;
  font-size: var(--fs-sm) !important;
  font-weight: 760 !important;
}

body.is-video-mode .video-model-control {
  width: 128px !important;
  flex: 0 0 128px !important;
}

body.is-video-mode .video-param-control {
  width: 72px !important;
  flex: 0 0 72px !important;
}

.model-popover{
  min-width: 0 !important;
  padding: 12px !important;
  gap: var(--chat-popover-gap) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--chat-popover-radius) !important;
  background: var(--bg) !important;
  box-shadow: 0 18px 40px -26px rgba(42, 42, 38, 0.36) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.model-popover.model-card-popover {
  width: min(304px, calc(100vw - 28px)) !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.model-card-popover-label,
.video-param-label {
  color: var(--ink-3) !important;
  font-size: var(--fs-xs) !important;
  font-weight: 760 !important;
  letter-spacing: 0 !important;
}

.model-option{
  min-height: var(--chat-option-height) !important;
  border: 1px solid rgba(52, 52, 46, 0.12) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--panel-2) !important;
  color: var(--ink-2) !important;
  box-shadow: none !important;
  transform: none !important;
}
.model-popover.model-card-popover [role="option"].is-keyboard-active {
  border-color: rgba(255, 225, 0, 0.78) !important;
  background: var(--accent-soft) !important;
  color: var(--ink-1) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 225, 0, 0.14) !important;
}

.model-option:hover,
.model-option:focus-visible{
  border-color: rgba(255, 225, 0, 0.64) !important;
  background: #fffdf4 !important;
  box-shadow: none !important;
  transform: none !important;
}

.model-option.active,
body.is-video-mode .video-option-toggle#kling-frame-toggle.active {
  border-color: rgba(255, 225, 0, 0.78) !important;
  background: var(--accent-soft) !important;
  color: var(--ink-1) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 225, 0, 0.14) !important;
  transform: none !important;
}

.video-param-section {
  gap: var(--chat-popover-gap) !important;
}

.video-param-grid {
  gap: 6px !important;
}

@media (max-width: 640px) {
  .history-row {
    grid-template-columns: minmax(0, 1fr) 28px;
    height: 54px;
    min-height: 54px;
    padding-block: 0;
  }

  .history-item,
  .history-copy,
  .history-title,
  .history-time {
    min-height: 0 !important;
    line-height: 20px;
  }

  .history-delete {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px !important;
  }

  .message-action {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px !important;
  }

  .model-trigger,
  .video-param-trigger{
    height: 44px !important;
    min-height: 44px !important;
  }
  body.is-video-mode .video-model-control {
    width: 92px !important;
    flex: 0 0 92px !important;
  }
  body.is-video-mode .video-param-control {
    width: 58px !important;
    min-width: 58px !important;
    flex: 0 0 58px !important;
  }

  .model-popover.model-card-popover {
    width: min(304px, calc(100vw - 28px)) !important;
  }
}

/* v190: interaction hierarchy. Primary actions carry the brand signal;
   utility controls stay stable so the content remains the focus. */
@media (hover: hover) {
  .sidebar-icon-button:hover,
  .show-sidebar-button:hover,
  .archive-toggle-button:hover,
  .history-row:hover,
  .history-delete:hover,
  .message-action:hover,
  .profile-recent-pager button:not(:disabled):hover,
  .prompt-callout-copy-button:hover,
  .attachment-remove:hover,
  .file-button:hover {
    transform: none !important;
  }

  .new-chat-button:hover,
  .composer #send-button:hover,
  .model-trigger:hover,
  .model-trigger[aria-expanded="true"] {
    transform: translateY(-1px);
    box-shadow: 0 0 0 3px var(--glow-accent), 0 12px 28px rgba(255, 225, 0, 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer #send-button.is-send-confirmed {
    animation: none !important;
  }
}

/* v194 final cascade: visual hierarchy for the production stylesheet. */


.chat-page,
.composer,
.mode-tabs,
.model-popover,
.message-content,
.aichat-execution-trace {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.chat-page {
  background: var(--page) !important;
}


.history-sidebar {
  padding: 20px 16px !important;
  background: var(--sidebar) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

.sidebar-version {
  display: none !important;
}

.new-chat-button {
  min-height: 40px !important;
  margin: 24px 0 18px !important;
  border: 1px solid rgba(231, 184, 63, 0.46) !important;
  border-radius: 8px !important;
  background: rgba(231, 184, 63, 0.12) !important;
  color: #fffdf7 !important;
  box-shadow: none !important;
}

.message-actions {
  opacity: 0;
  pointer-events: auto;
  transition: opacity var(--motion-fast) ease;
}

.message:hover .message-actions,
.message:focus-within .message-actions,
.message-actions:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.message-action {
  border: 1px solid rgba(42, 42, 38, 0.12) !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--ink-3) !important;
  box-shadow: none !important;
}

.message-action:hover,
.message-action:focus-visible,
.message-action.is-done {
  border-color: rgba(231, 184, 63, 0.55) !important;
  background: rgba(231, 184, 63, 0.12) !important;
  color: var(--ink-1) !important;
  transform: none !important;
}


@media (max-width: 640px) {


  .message-actions {
    opacity: 0.82;
    pointer-events: auto;
  }
}

/* v195: generated video state choreography. Keep the poster as the stable
   visual anchor while the playable stream is signed, decoded, and revealed. */


.video-media-shell {
  border: 1px solid rgba(42, 42, 38, 0.14);
  box-shadow: 0 14px 34px rgba(31, 27, 18, 0.08);
  transition:
    border-color var(--motion-med) ease,
    box-shadow var(--motion-med) ease,
    transform var(--motion-med) var(--ease-out);
}

.video-media-shell.is-waiting {
  border-color: rgba(42, 42, 38, 0.1);
}

.video-media-shell.is-loading {
  border-color: rgba(198, 154, 36, 0.44);
  background: #f2f0e8;
  box-shadow: 0 16px 38px rgba(198, 154, 36, 0.14);
}

.video-media-shell.is-loading::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: calc(var(--radius-md) - 4px);
  background: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, 0.22) 50%, transparent 72%);
  background-size: 220% 100%;
  pointer-events: none;
  animation: videoPlaybackSweep 1.8s ease-in-out infinite;
}

.video-media-shell.is-loaded .video-poster-placeholder {
  opacity: 0;
  transform: scale(1.025);
  pointer-events: none;
  transition: opacity var(--motion-med) ease, transform var(--motion-slow) var(--ease-out);
}

.video-media-shell.is-loaded .video-poster {
  filter: saturate(0.96) contrast(0.98);
  transform: scale(1);
}

.video-media-shell.is-frame-ready {
  border-color: rgba(42, 42, 38, 0.18);
  box-shadow: 0 18px 42px rgba(31, 27, 18, 0.13);
}

.video-media-shell.is-frame-ready video {
  animation: videoFrameReveal var(--motion-slow) var(--ease-out) both;
}

.video-media-shell.is-playing::after {
  opacity: 0;
  animation-play-state: paused;
}

.video-media-shell.is-error {
  border-color: rgba(180, 35, 24, 0.34);
  box-shadow: 0 12px 28px rgba(180, 35, 24, 0.1);
}

@keyframes videoPlaybackSweep {
  0%, 18% { background-position: 160% 0; opacity: 0; }
  42% { opacity: 1; }
  76%, 100% { background-position: -60% 0; opacity: 0; }
}

@keyframes videoFrameReveal {
  from { opacity: 0; transform: scale(1.018); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .video-media-shell,
  .video-media-shell.is-loaded .video-poster-placeholder,
  .video-media-shell.is-frame-ready video {
    transition: none;
    animation: none;
  }

  .video-media-shell.is-loading::after {
    display: none;
  }
}

/* v195: final AIChat interaction layer. Glass is reserved for the composer
   and its popovers; messages and media stay matte for reading stability. */


#show-sidebar-button.show-sidebar-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin-top: env(safe-area-inset-top, 0px);
  border: 1px solid rgba(255, 255, 255, 0.24) !important;
  border-radius: 10px !important;
  background: #292923 !important;
  color: #fffdf7 !important;
  box-shadow: 0 8px 22px rgba(20, 20, 16, 0.18) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#show-sidebar-button.show-sidebar-button:hover,
#show-sidebar-button.show-sidebar-button:focus-visible {
  border-color: var(--yellow) !important;
  background: #3b3931 !important;
  color: #fffdf7 !important;
}

#show-sidebar-button.show-sidebar-button:focus-visible {
  outline: 3px solid rgba(255, 225, 0, 0.72);
  outline-offset: 3px;
}


.model-popover{
  border: 1px solid rgba(255, 255, 255, 0.78) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.84) !important;
  box-shadow: 0 20px 48px rgba(21, 27, 35, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(22px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.25) !important;
}

@supports (backdrop-filter: blur(1px)) {
  .composer,
  .model-popover{
    background-color: rgba(255, 255, 255, 0.68) !important;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  .composer,
  .model-popover{
    background: #fffefb !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

.message.assistant.is-streaming {
  position: relative;
}

.message.is-streaming {
  transition: opacity 180ms ease, transform 180ms var(--ease-out);
}

.message.assistant.is-streaming .message-content {
  border-inline-start: 2px solid rgba(198, 154, 36, 0.52);
  padding-inline-start: 14px;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.message.assistant.is-streaming .message-content::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 7px 2px 0;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 225, 0, 0.16);
  animation: assistantStreamPulse 1.4s ease-in-out infinite;
}

.message.assistant.is-answer-settling .message-content {
  animation: assistantAnswerSettle 380ms var(--ease-out) both;
}

.media-seq-shell {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #ecece8;
}

.media-seq-shell img,
.media-seq-shell video {
  filter: blur(10px);
  transform: scale(1.02);
  transition: opacity 240ms ease, filter 360ms var(--ease-out), transform 360ms var(--ease-out);
}

.media-seq-shell.is-loaded {
  filter: none;
  transform: translateZ(0);
  transition: filter 360ms var(--ease-out), transform 360ms var(--ease-out);
}

.media-seq-shell.is-loaded img,
.media-seq-shell.is-loaded video {
  filter: blur(0);
  transform: scale(1);
}

.media-pending-card.is-failing {
  opacity: 1 !important;
  border-color: rgba(180, 35, 24, 0.36) !important;
  background: rgba(254, 242, 240, 0.94) !important;
  animation: mediaFailureNotice 260ms ease-out both;
}

.is-media-result-entering .media-seq-shell {
  animation: mediaResultEnter 360ms var(--ease-out) both;
}

@keyframes assistantStreamPulse {
  0%, 100% { opacity: 0.46; transform: scale(0.86); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes assistantAnswerSettle {
  from { opacity: 0.78; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes mediaResultEnter {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mediaFailureNotice {
  from { opacity: 0.55; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  #show-sidebar-button.show-sidebar-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .message.assistant.is-streaming .message-content::before,
  .message.assistant.is-answer-settling .message-content,
  .media-pending-card.is-failing,
  .is-media-result-entering .media-seq-shell {
    animation: none !important;
  }

  .media-seq-shell img,
  .media-seq-shell video,
  .media-seq-shell.is-loaded {
    transition: opacity 1ms linear, filter 1ms linear, transform 1ms linear;
  }
}

/* AIChat media menus: one portal, one visual system, all model capabilities. */
.aichat-media-popover {
  box-sizing: border-box;
  position: fixed;
  right: auto;
  bottom: auto;
  z-index: 1000;
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(49, 50, 45, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 252, 0.97);
  color: var(--ink);
  box-shadow: 0 24px 48px -30px rgba(37, 38, 34, 0.34), 0 3px 10px rgba(37, 38, 34, 0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.aichat-media-popover[hidden],
.aichat-media-popover [hidden],
.image-model-control[hidden],
.image-ratio-control[hidden],
.image-size-control[hidden],
.image-quality-control[hidden],
.image-param-control[hidden],
body.is-image-mode .model-picker > [hidden] {
  display: none !important;
}

.aichat-media-popover.is-open {
  animation: aichatMediaMenuEnter 160ms ease-out;
}

@keyframes aichatMediaMenuEnter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.aichat-media-models {
  grid-template-columns: minmax(0, 1fr);
}

.aichat-media-choices,
.aichat-media-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.aichat-duration-popover {
  padding: 12px 14px;
}

.aichat-duration-popover .chat-video-duration-slider {
  --video-duration-accent: var(--yellow);
  --line: rgba(49, 50, 45, 0.16);
  --card: #fffefb;
  --text: var(--ink);
  --muted: var(--ink-3);
  width: 100%;
  min-width: 0;
  max-width: none;
  grid-template-rows: 16px 38px;
}

.aichat-duration-popover .video-duration-row {
  grid-template-columns: minmax(0, 1fr) 34px 10px;
  height: 38px;
}

.aichat-duration-popover .video-duration-slider-shell,
.aichat-duration-popover .video-duration-slider {
  height: 38px !important;
}

.aichat-duration-popover .video-duration-value {
  width: 34px;
  height: 26px;
  border: 0;
  background: #f0f1ee;
}

#image-param-quality-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.aichat-media-section,
.aichat-media-grid {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.aichat-media-parameters {
  gap: 12px;
}

.aichat-media-popover .model-card-popover-label {
  grid-column: 1 / -1;
}

.aichat-media-label,
.aichat-image-field > span,
.aichat-media-popover .video-param-label {
  color: #62655f;
  font-size: var(--fs-xs);
  font-weight: 760;
}

.aichat-media-popover :is([role="option"], .video-option-toggle) {
  display: inline-flex;
  box-sizing: border-box;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid transparent !important;
  border-radius: 10px;
  background: transparent !important;
  color: var(--ink-2);
  box-shadow: none !important;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 530;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: normal;
  cursor: pointer;
}

.aichat-media-models [role="option"] {
  position: relative;
  min-height: 44px;
  justify-content: flex-start;
  padding-inline: 14px 36px;
  text-align: left;
}

.aichat-media-models [role="option"].active::after {
  position: absolute;
  right: 16px;
  content: "✓";
  color: #3d403b;
  font-size: 16px;
}

.aichat-media-popover :is([role="option"], .video-option-toggle):hover,
.aichat-media-popover :is([role="option"], .video-option-toggle):focus-visible,
.aichat-media-popover .is-keyboard-active {
  border-color: transparent !important;
  background: #f0f1ee !important;
  box-shadow: none !important;
}

.aichat-media-popover :is(.active, [aria-selected="true"], [aria-pressed="true"]) {
  border-color: transparent !important;
  background: #f0f1ee !important;
  color: var(--ink-1);
  font-weight: 650;
}

.aichat-media-popover :is([role="option"], .video-option-toggle):focus-visible {
  outline: 2px solid #77785c;
  outline-offset: -2px;
}

.aichat-media-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.aichat-image-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.aichat-image-field.is-wide,
.aichat-image-count {
  grid-column: 1 / -1;
}

.aichat-image-field input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.aichat-image-field input:focus-visible {
  outline: 2px solid rgba(198, 154, 36, 0.64);
  outline-offset: 1px;
}

.aichat-image-count {
  margin: 0;
  color: var(--ink-3);
  font-size: var(--fs-xs);
}

body.is-image-mode .image-model-control,
body.is-image-mode .image-ratio-control,
body.is-image-mode .image-size-control,
body.is-image-mode .image-quality-control {
  display: block;
}

body.is-image-mode .image-model-control {
  width: 150px !important;
  min-width: 0;
  flex: 0 1 150px !important;
}

body.is-image-mode .image-ratio-control {
  width: 78px !important;
  flex: 0 0 78px !important;
}

body.is-image-mode .image-size-control,
body.is-image-mode .image-quality-control {
  width: 64px !important;
  flex: 0 0 64px !important;
}

.image-param-control {
  position: relative;
  display: none;
}

body.is-image-mode .image-param-control.has-style-params {
  display: block;
  width: 72px;
  flex: 0 0 72px;
}

body.is-image-mode .composer-dock :is(.image-size-control, .image-quality-control) {
  display: none !important;
}

body.is-image-mode .composer-dock .image-param-control:not([hidden]) {
  display: block !important;
}

@media (max-width: 640px) {
  body.is-image-mode .image-model-control {
    width: 124px !important;
    flex: 1 1 124px !important;
  }

  body.is-image-mode .image-ratio-control {
    width: 68px !important;
    flex: 0 0 68px !important;
  }

  body.is-image-mode .image-size-control,
  body.is-image-mode .image-quality-control {
    display: none;
  }

  body.is-image-mode .image-param-control:not([hidden]) {
    display: block;
    width: 54px;
    flex: 0 0 54px;
  }

  .image-param-trigger {
    padding: 0 20px 0 7px !important;
  }

  .aichat-media-popover {
    background: rgba(255, 255, 252, 0.97);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .aichat-media-popover :is([role="option"], .video-option-toggle) {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aichat-media-popover.is-open {
    animation: none;
  }
}

/* AIChat composer: the authoritative borderless visual layer. */
.history-sidebar .new-chat-button {
  border-color: transparent !important;
  background: rgba(255, 255, 255, 0.055) !important;
  box-shadow: none !important;
  font-weight: 620;
}

.history-sidebar .new-chat-button:is(:hover, :focus-visible) {
  border-color: transparent !important;
  background: rgba(255, 255, 255, 0.105) !important;
}

.history-sidebar .new-chat-button span {
  color: #d6d8cf;
}

.history-sidebar .history-row:is(.active, :hover, :focus-within) {
  background: rgba(255, 255, 255, 0.075) !important;
  box-shadow: none !important;
}

.chat-shell {
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.chat-shell:has(.message-list:empty) {
  grid-template-rows: auto auto auto;
}

.composer-dock {
  position: relative;
  z-index: 2;
  min-width: 0;
  padding: 7px 11px 8px;
  border: 1px solid rgba(45, 47, 43, 0.09);
  border-radius: 22px;
  background: rgba(255, 255, 252, 0.97);
  box-shadow:
    0 22px 46px -32px rgba(37, 38, 34, 0.27),
    0 2px 8px rgba(37, 38, 34, 0.035);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.composer-dock::before {
  display: none;
}

.composer-dock:has(.skill-menu:not([hidden])) {
  z-index: 220;
}

.composer-dock:focus-within {
  border-color: rgba(75, 77, 67, 0.28);
  box-shadow:
    0 22px 46px -32px rgba(37, 38, 34, 0.27),
    0 0 0 3px rgba(45, 47, 43, 0.035);
}

.composer-head {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 3px 2px;
  border-bottom: 0;
}

.composer-dock .mode-tabs {
  z-index: 1;
  display: inline-flex;
  width: auto;
  max-width: 100%;
  flex: 0 0 auto;
  justify-self: auto !important;
  gap: 2px;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.composer-dock .mode-tab,
.composer-dock .mode-tab.active {
  position: relative;
  display: inline-flex !important;
  min-width: 70px;
  height: 32px !important;
  min-height: 32px !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 9px !important;
  color: #73756f !important;
  font-size: 12px;
  font-weight: 560;
  line-height: 1;
  transition: background-color 160ms ease, color 160ms ease;
}

.composer-dock .mode-tab.active,
.composer-dock .mode-tab.active:hover,
.composer-dock .mode-tab.active:focus-visible {
  background: #f0f1ee !important;
  color: #2f322f !important;
  box-shadow: none !important;
  font-weight: 680;
}

.composer-dock .mode-tab.active::after {
  position: absolute;
  right: calc(50% - 9px);
  bottom: 3px;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: #dfc322;
  content: "";
}

.composer-dock .mode-tab:not(.active):hover,
.composer-dock .mode-tab:not(.active):focus-visible {
  background: #f4f4f1 !important;
  color: #292d29 !important;
}

.composer-dock .mode-tab svg,
.composer-privacy svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #69665d;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.composer-privacy svg {
  width: 14px;
  height: 14px;
}

.chat-disclaimer {
  position: static;
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 12px;
}

.chat-disclaimer .composer-privacy {
  color: inherit;
  font-size: inherit;
}

.composer-dock .composer {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  gap: 7px !important;
  padding: 7px 4px 2px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transform: none;
}

.composer-dock .composer:focus-within {
  border: 0 !important;
  box-shadow: none !important;
}

.composer-dock .composer::before,
.composer-dock .composer::after {
  display: none !important;
}

.composer-dock .composer > .skill-menu {
  bottom: calc(100% + 54px);
  border-color: rgba(45, 47, 43, 0.1);
  border-radius: 16px;
  background: #fffefa;
  box-shadow: 0 22px 46px -28px rgba(37, 38, 34, 0.28);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.composer-dock .skill-menu button {
  border-radius: 9px;
  font-weight: 550;
}

.composer-dock .skill-menu button:is(:hover, .is-active) {
  background: #f0f1ee;
}

.composer-dock .composer textarea {
  min-height: 70px;
  padding: 2px 3px 0;
  color: #292923 !important;
  font-size: 16px;
  font-weight: 420;
  line-height: 1.55;
  text-shadow: none;
}

.composer-dock .composer textarea::placeholder {
  color: #7b7e78 !important;
}

.composer-dock :is(.web-search-button, .document-generate-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.composer-dock :is(.web-search-button, .document-generate-button) svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-dock :is(.web-search-button, .document-generate-button).active::before {
  display: none;
}

.composer-dock .composer-footer {
  gap: 12px !important;
  min-height: 32px !important;
}

.composer-dock .model-picker,
.composer-dock .composer-actions {
  gap: 3px !important;
}

.composer-dock .model-picker {
  flex: 1 1 auto !important;
}

.composer-dock .chat-model-status {
  display: inline-flex;
  min-width: 0;
  height: 32px !important;
  margin-left: auto;
  align-items: center;
  gap: 6px;
  color: #686b66;
  font-size: 13px;
  font-weight: 530;
  white-space: nowrap;
  pointer-events: none;
}

.composer-dock .chat-model-status small {
  color: #999b96;
  font-size: 12px;
  font-weight: 480;
}

body.is-image-mode .composer-dock .chat-model-status,
body.is-video-mode .composer-dock .chat-model-status {
  display: none;
}

.composer-dock .web-search-button {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: 0 0 auto !important;
  padding: 0 10px !important;
}

.composer-dock :is(.model-trigger, .web-search-button, .document-generate-button, .file-button),
.composer-dock .composer #send-button,
body.is-video-mode .composer-dock .model-picker > :is(#kling-audio-toggle, #kling-multi-reference-toggle, #kling-storyboard-toggle) {
  height: 32px !important;
  min-height: 32px !important;
  border: 1px solid transparent !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: #61645f !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  font-size: 12px !important;
  font-weight: 540 !important;
  transition: background-color 160ms ease, color 160ms ease;
}

.composer-dock .file-button,
body.is-video-mode .composer-dock .file-button,
.composer-dock .composer #send-button {
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  flex: 0 0 32px !important;
}

.composer-dock .file-button svg {
  width: 16px;
  height: 16px;
}

.composer-dock .composer #send-button svg {
  width: 15px;
  height: 15px;
}

body.is-image-mode .composer-dock .image-model-control,
body.is-video-mode .composer-dock .video-model-control {
  width: 140px !important;
  min-width: 0 !important;
  margin-left: auto !important;
  flex: 0 1 140px !important;
}

body.is-image-mode .composer-dock .image-param-control:not([hidden]),
body.is-video-mode .composer-dock .video-param-control:not([hidden]) {
  width: 56px !important;
  min-width: 56px !important;
  flex: 0 0 56px !important;
}

body.is-image-mode .composer-dock .image-ratio-control:not([hidden]),
body.is-video-mode .composer-dock .video-ratio-control:not([hidden]) {
  display: block !important;
  width: 64px !important;
  min-width: 64px !important;
  flex: 0 0 64px !important;
}

body.is-video-mode .composer-dock .video-duration-control:not([hidden]) {
  display: block !important;
  width: 52px !important;
  min-width: 52px !important;
  flex: 0 0 52px !important;
}

body.is-video-mode .composer-dock .video-param-control[hidden] {
  display: none !important;
}

.composer-dock :is(.image-ratio-trigger, .video-ratio-trigger, .video-duration-trigger, .image-param-trigger, .video-param-trigger) {
  width: 100%;
  padding: 0 15px 0 6px !important;
}

.composer-dock :is(.image-ratio-trigger, .video-ratio-trigger, .video-duration-trigger, .image-param-trigger, .video-param-trigger) .model-chevron {
  right: 5px;
}

.composer-dock .video-duration-trigger:disabled {
  opacity: 0.55;
  cursor: default;
}

.composer-dock :is(.model-trigger, .web-search-button, .document-generate-button, .file-button):is(:hover, [aria-expanded="true"], .active, .has-file),
body.is-video-mode .composer-dock .model-picker > :is(#kling-audio-toggle, #kling-multi-reference-toggle, #kling-storyboard-toggle):is(:hover, .active) {
  border-color: transparent !important;
  background: #f0f1ee !important;
  color: #292d29 !important;
  box-shadow: none !important;
}

.composer-dock .composer #send-button {
  border-color: transparent !important;
  border-radius: 50% !important;
  background: #747a7b !important;
  color: #fffefb !important;
  box-shadow: none !important;
}

.composer-dock .composer #send-button:hover {
  background: #4d5353 !important;
  box-shadow: none !important;
}

.composer-dock :is(.mode-tab, .model-trigger, .web-search-button, .document-generate-button, .file-button, #send-button):focus-visible {
  outline: 2px solid #77785c;
  outline-offset: 2px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .composer-dock {
    background: #f8f8f4;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (max-width: 640px) {
  .composer-dock {
    width: 100%;
    padding: 6px;
    border-radius: 21px;
    background: #f9f9f6;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .composer-head {
    padding: 0 1px 5px;
  }

  .composer-dock .mode-tabs {
    width: auto !important;
    flex: 0 1 auto;
    overflow: visible;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .composer-dock .mode-tab,
  .composer-dock .mode-tab.active {
    min-width: 72px;
    height: 44px !important;
    min-height: 44px !important;
    flex: 0 1 72px;
    padding: 0 5px;
    font-size: 12px;
  }

  .composer-dock .mode-tab.active,
  .composer-dock .mode-tab.active:hover,
  .composer-dock .mode-tab.active:focus-visible {
    background: linear-gradient(#f0f1ee, #f0f1ee) center / calc(100% - 8px) 36px no-repeat !important;
    box-shadow: none !important;
  }

  .chat-disclaimer {
    gap: 0 10px;
    font-size: 11px;
  }

  .composer-dock .composer {
    gap: 6px !important;
    padding: 7px 3px 2px !important;
  }

  .composer-dock .composer textarea {
    min-height: 64px;
    max-height: min(220px, 30dvh);
    font-size: 16px;
  }

  .composer-dock .composer-footer {
    min-height: 44px !important;
    gap: 10px !important;
  }

  .composer-dock .model-picker,
  .composer-dock .composer-actions {
    gap: 4px !important;
  }

  .composer-dock .web-search-button {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    padding: 0 10px !important;
    border-color: transparent !important;
    background: transparent !important;
  }

  .composer-dock .file-button {
    border-color: transparent !important;
    background: transparent !important;
  }

  .composer-dock :is(.model-trigger, .web-search-button, .document-generate-button, .file-button),
  .composer-dock .composer #send-button,
  body.is-video-mode .composer-dock .model-picker > :is(#kling-audio-toggle, #kling-multi-reference-toggle, #kling-storyboard-toggle) {
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 12px !important;
  }

  .composer-dock .file-button,
  body.is-video-mode .composer-dock .file-button,
  .composer-dock .composer #send-button {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex: 0 0 44px !important;
  }

  .composer-dock .chat-model-status {
    font-size: 12px;
  }

  .composer-dock .chat-model-status small {
    display: none;
  }

  .composer-dock .composer #send-button {
    position: relative;
    border-radius: 50% !important;
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .composer-dock .composer #send-button::after {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #747a7b;
    content: "";
  }

  .composer-dock .composer #send-button:hover::after {
    background: #4d5353;
  }

  .composer-dock .composer #send-button.is-stop::before {
    position: relative;
    z-index: 1;
    color: #fffefb;
  }

  .composer-dock .composer #send-button svg {
    position: relative;
    z-index: 1;
  }

  body.is-image-mode .composer-dock .image-model-control {
    width: 140px !important;
    min-width: 0 !important;
    flex: 0 1 140px !important;
  }

  body.is-video-mode .composer-dock .video-model-control {
    width: 120px !important;
    min-width: 0 !important;
    flex: 0 1 120px !important;
  }

  body.is-image-mode .composer-dock .image-param-control:not([hidden]),
  body.is-image-mode .composer-dock .image-ratio-control:not([hidden]),
  body.is-video-mode .composer-dock .video-ratio-control:not([hidden]) {
    width: 52px !important;
    min-width: 52px !important;
    flex: 0 0 52px !important;
  }

  body.is-video-mode .composer-dock .video-duration-control:not([hidden]) {
    width: 44px !important;
    min-width: 44px !important;
    flex: 0 0 44px !important;
  }

  body.is-video-mode .composer-dock .video-param-control:not([hidden]) {
    width: 44px !important;
    min-width: 44px !important;
    flex: 0 0 44px !important;
  }

  .composer-dock :is(.image-param-trigger, .video-param-trigger) {
    padding: 0 5px !important;
  }

  .composer-dock :is(.image-param-trigger, .video-param-trigger) .model-chevron {
    display: none;
  }

  .composer-dock .composer > .skill-menu {
    bottom: calc(100% + 56px);
  }

  .scroll-latest-button {
    bottom: 230px;
  }
}

@media (max-width: 360px) {
  .composer-dock .composer-footer,
  body.is-video-mode .composer-dock .composer-footer {
    flex-wrap: nowrap !important;
  }

  .composer-dock .model-picker {
    width: auto;
    flex: 1 1 auto !important;
  }

  .composer-dock .composer-actions {
    width: auto;
    justify-content: flex-end;
  }

  .composer-dock .web-search-button {
    padding-inline: 6px !important;
  }
}

@media (max-width: 360px) {
  body.is-video-mode .composer-dock .composer-footer {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 64px 56px 64px;
    grid-template-rows: 44px 44px;
    gap: 8px 4px !important;
  }

  body.is-video-mode .composer-dock .model-picker,
  body.is-video-mode .composer-dock .composer-actions {
    display: contents !important;
  }

  body.is-video-mode .composer-dock .file-button {
    grid-area: 1 / 1;
  }

  body.is-video-mode .composer-dock .video-model-control {
    grid-area: 1 / 2 / 2 / 5;
    justify-self: end;
    width: 140px !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }

  body.is-video-mode .composer-dock #send-button {
    grid-area: 1 / 5;
    justify-self: end;
  }

  body.is-video-mode .composer-dock .video-ratio-control:not([hidden]) {
    grid-area: 2 / 3;
    width: 64px !important;
    min-width: 64px !important;
  }

  body.is-video-mode .composer-dock .video-duration-control:not([hidden]) {
    grid-area: 2 / 4;
    width: 56px !important;
  }

  body.is-video-mode .composer-dock .video-param-control:not([hidden]) {
    grid-area: 2 / 5;
    width: 64px !important;
  }

  body.is-video-mode .composer-dock .model-picker:has(.video-param-control[hidden]) .video-ratio-control:not([hidden]) {
    grid-area: 2 / 4;
    width: 56px !important;
    min-width: 56px !important;
  }

  body.is-video-mode .composer-dock .model-picker:has(.video-param-control[hidden]) .video-duration-control:not([hidden]) {
    grid-area: 2 / 5;
    justify-self: end;
  }

  .scroll-latest-button {
    bottom: 230px;
  }
}

@media (max-width: 360px) {
  body:not(.is-image-mode):not(.is-video-mode) .composer-dock .composer-footer {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-rows: 44px 44px;
    gap: 8px 4px !important;
  }

  body:not(.is-image-mode):not(.is-video-mode) .composer-dock .model-picker,
  body:not(.is-image-mode):not(.is-video-mode) .composer-dock .composer-actions {
    display: contents !important;
  }

  body:not(.is-image-mode):not(.is-video-mode) .composer-dock .file-button {
    grid-area: 1 / 1;
  }

  body:not(.is-image-mode):not(.is-video-mode) .composer-dock .web-search-button {
    grid-area: 1 / 2;
    justify-self: end;
  }

  body:not(.is-image-mode):not(.is-video-mode) .composer-dock #send-button {
    grid-area: 1 / 3;
    justify-self: end;
  }

  body:not(.is-image-mode):not(.is-video-mode) .composer-dock .chat-model-status {
    grid-area: 2 / 2 / 3 / 4;
    justify-self: end;
    align-self: center;
    margin-left: 0;
  }

  body.is-image-mode .composer-dock .composer-footer {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 64px 64px;
    grid-template-rows: 44px 44px;
    gap: 8px 4px !important;
  }

  body.is-image-mode .composer-dock .model-picker,
  body.is-image-mode .composer-dock .composer-actions {
    display: contents !important;
  }

  body.is-image-mode .composer-dock .file-button {
    grid-area: 1 / 1;
  }

  body.is-image-mode .composer-dock .image-model-control {
    grid-area: 1 / 2 / 2 / 4;
    justify-self: end;
    width: 140px !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }

  body.is-image-mode .composer-dock #send-button {
    grid-area: 1 / 4;
    justify-self: end;
  }

  body.is-image-mode .composer-dock .image-ratio-control:not([hidden]) {
    grid-area: 2 / 3;
    width: 64px !important;
    min-width: 64px !important;
  }

  body.is-image-mode .composer-dock .image-param-control:not([hidden]) {
    grid-area: 2 / 4;
    width: 64px !important;
    min-width: 64px !important;
  }

  .scroll-latest-button {
    bottom: 230px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer-dock::before,
  .composer-dock :is(.mode-tab, .model-trigger, .web-search-button, .document-generate-button, .file-button, #send-button) {
    transition: none !important;
  }
  .composer-dock .composer .web-search-button.is-tap-feedback,
  .composer-dock .composer .web-search-button.is-tap-feedback svg {
    animation: none !important;
  }
}

@keyframes webSearchTapFeedback {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(.94); }
}

@keyframes webSearchTapIcon {
  0%, 100% { transform: scale(1); }
  42% { transform: scale(1.2); }
}

/* AIChat ThoughtLine: one reply status, real steps, no React runtime. */
.aichat-execution-trace.thought-line {
  width: min(100%, 560px);
  max-width: 100%;
  margin: 0 0 10px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ink-2, var(--muted));
  box-shadow: none !important;
  overflow: visible;
  font-size: 15px;
  line-height: 1.4;
}

.thought-line .thought-line__head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0;
  font: inherit;
  cursor: default;
}

.thought-line .thought-line__head::before { content: none; }
.thought-line[data-toggle="true"] .thought-line__head { cursor: pointer; }
.thought-line .thought-line__head:focus-visible {
  outline: 2px solid var(--ink-2);
  outline-offset: 4px;
  border-radius: 4px;
}

.thought-line__glyph {
  display: inline-flex;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  color: var(--ink-2);
  opacity: .55;
  transition: opacity 350ms ease;
}
.thought-line__glyph svg,
.thought-line__chevron svg { width: 100%; height: 100%; }
.thought-line[data-working="true"] .thought-line__glyph {
  animation: thoughtGlyphBreath 1.6s cubic-bezier(.77,0,.175,1) infinite;
}

.thought-line__label {
  display: grid;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
}
.thought-line .thought-line__work,
.thought-line .thought-line__done {
  grid-area: 1 / 1;
  min-width: 0;
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
  letter-spacing: 0;
  animation: none;
  transition: opacity 350ms cubic-bezier(.23,1,.32,1), filter 350ms ease, visibility 0s 350ms;
}
.thought-line .thought-line__done {
  visibility: hidden;
  opacity: 0;
  filter: blur(2px);
}
.thought-line[data-working="false"] .thought-line__work {
  visibility: hidden;
  opacity: 0;
  filter: blur(2px);
}
.thought-line[data-working="false"] .thought-line__done {
  visibility: visible;
  opacity: .75;
  filter: none;
  transition-delay: 0s;
}
.thought-line[data-working="true"] .thought-line__work {
  background: linear-gradient(100deg, var(--ink-3) 30%, var(--ink-1) 50%, var(--ink-3) 70%);
  background-size: 250% 100%;
  background-position: 125% 0;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: thoughtLabelShimmer 1.8s linear infinite;
}
.thought-line .skill-invocation-detail {
  grid-area: 2 / 1;
  color: var(--muted);
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}
.thought-line .skill-invocation-detail[hidden] { display: none; }
.thought-line__timer {
  flex: 0 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: .6;
  transition: opacity 350ms ease;
}
.thought-line[data-working="false"] .thought-line__timer { opacity: .75; }
.thought-line__chevron {
  display: inline-flex;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity 200ms ease, transform 350ms cubic-bezier(.23,1,.32,1);
}
.thought-line[data-toggle="true"] .thought-line__chevron { opacity: .55; }
.thought-line[data-open="true"] .thought-line__chevron { transform: rotate(180deg); }
.thought-line__trace { overflow: hidden; }
.thought-line .aichat-trace-list { gap: 4px; padding: 7px 0 3px 26px; }
.thought-line .aichat-trace-item { grid-template-columns: 12px minmax(0, 1fr); gap: 8px; }
.thought-line .aichat-trace-copy strong { font-size: 13px; font-weight: 400; }
.thought-line .aichat-trace-copy small { font-size: 11px; }
.thought-line .aichat-trace-item .aichat-trace-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--muted);
}
.thought-line .aichat-trace-state::after { content: "·"; font-size: 17px; }
.thought-line .aichat-trace-item[data-status="running"] .aichat-trace-state::after {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
  animation: thoughtGlyphBreath 1.6s ease infinite;
}
.thought-line .aichat-trace-item[data-status="completed"] .aichat-trace-state::after { content: "✓"; font-size: 12px; }
.thought-line .aichat-trace-item[data-status="completed"] .aichat-trace-copy { opacity: .65; }
.thought-line .aichat-trace-item[data-status="failed"] .aichat-trace-state::after { content: "×"; color: #a9493f; }
.thought-line .aichat-trace-notice { padding: 4px 0 5px 26px; }
.thought-line__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.message.has-aichat-execution-trace.is-typing {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.message.has-aichat-execution-trace.is-thinking-motion .message-content { animation: none; }
.message.has-aichat-execution-trace .message-content:empty { display: none; }

@keyframes thoughtGlyphBreath { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes thoughtLabelShimmer { to { background-position: -125% 0; } }

@media (max-width: 520px) {
  .thought-line .thought-line__head { min-height: 44px; gap: 6px; }
  .aichat-execution-trace.thought-line { font-size: 14px; }
  .thought-line__timer { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .thought-line *,
  .thought-line[data-working="true"] .thought-line__work {
    animation: none !important;
    transition: none !important;
    filter: none !important;
  }
  .thought-line[data-working="true"] .thought-line__work {
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

/* PromptBar skin is shared by the three AIChat modes; geometry stays above. */
:root {
  --composer-accent: #fee903;
  --composer-accent-soft: rgba(254,233,3,.16);
  --pb-bg: #fff;
  --pb-menu: #fff;
  --pb-ink: #27272a;
  --pb-muted: #707077;
  --pb-hover: rgba(39,39,42,.06);
  --pb-accent-ink: #756600;
  --pb-ease: cubic-bezier(.23,1,.32,1);
}
.composer-dock, .composer-dock:focus-within {
  --composer-spark: var(--composer-accent);
  isolation: isolate; color: var(--pb-ink); color-scheme: light;
  border-color: transparent; border-radius: 16px;
  background: var(--pb-bg); box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.composer-dock .composer textarea { color: var(--pb-ink) !important; caret-color: var(--composer-accent); }
.composer-dock .composer textarea::placeholder { color: var(--pb-muted) !important; }
.composer-dock .mode-tabs .mode-tab,
.composer-dock .composer :is(.model-trigger, .web-search-button, .document-generate-button, .file-button),
body.is-video-mode .composer-dock .model-picker > .video-option-toggle {
  color: var(--pb-muted) !important; background: transparent !important;
  border-radius: 8px !important; box-shadow: none !important;
  transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--pb-ease);
}
.composer-dock .mode-tabs .mode-tab:is(.active, :hover, :focus-visible),
.composer-dock .composer :is(.model-trigger, .web-search-button, .document-generate-button, .file-button):is(:hover, [aria-expanded="true"], .active, .has-file),
body.is-video-mode .composer-dock .model-picker > .video-option-toggle:is(:hover, .active) {
  color: var(--pb-ink) !important; background: var(--pb-hover) !important;
}
.composer-dock .composer .web-search-button.is-tap-feedback {
  background: var(--composer-accent-soft) !important;
  color: var(--pb-accent-ink) !important;
  animation: webSearchTapFeedback 420ms ease-out;
}
.composer-dock .composer .web-search-button.is-tap-feedback svg {
  animation: webSearchTapIcon 360ms cubic-bezier(.23, 1, .32, 1);
  transform-box: fill-box;
  transform-origin: center;
}
.composer-dock .mode-tab.active::after { display: none; }
.composer-dock .model-chevron { border-color: currentColor; color: inherit; }
.composer-dock button:focus-visible,
:is(.effort-popover, .aichat-media-popover, .skill-menu) :is(button, input, [role="listbox"]):focus-visible {
  outline: 2px solid var(--composer-accent) !important; outline-offset: 2px;
}
@media (hover: none), (pointer: coarse) {
  .composer-dock .composer .web-search-button:hover:not(.active):not(.is-tap-feedback) {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--pb-muted) !important;
    box-shadow: none !important;
    transform: none !important;
  }
  .composer-dock .composer .web-search-button:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
  }
}
.composer-dock .composer #send-button,
.composer-dock .composer #send-button:hover {
  border-radius: 8px !important; background: #ededef !important; color: #77777c !important;
  transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--pb-ease);
  animation: none !important;
}
.composer-dock .composer #send-button:is([data-armed="true"], .is-stop) {
  background: var(--pb-ink) !important; color: var(--pb-bg) !important;
}
.composer-dock .composer #send-button::before,
.composer-dock .composer #send-button::after { display: none !important; }
.composer-dock .composer #send-button svg,
.composer-dock .composer #send-button.is-stop svg {
  display: block; width: 18px; height: 18px; fill: currentColor; stroke: none;
  transform-origin: center;
}
.composer-dock .composer #send-button:active { transform: scale(.96); }
.composer-dock :is(.attachment-item, .skill-selection, .kling-frame-slot, .kling-frame-swap, .kling-storyboard-panel) {
  color: var(--pb-ink); background: var(--pb-hover); border-color: transparent; border-radius: 8px;
}
.composer-dock :is(.attachment-name, .attachment-meta, .kling-frame-slot small, #selected-skill-label) { color: var(--pb-muted); }
.composer-dock #clear-skill-button { color: var(--pb-muted); }
.composer-dock .kling-frame-slot strong { color: var(--pb-ink); }
.composer-dock .kling-storyboard-panel textarea { background: transparent; }
.composer-dock::before {
  display: block; content: ""; position: absolute; inset: 0; z-index: -1;
  border: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(140% 120% at 0% 100%, rgba(254,233,3,.26), transparent 62%);
  opacity: 0; transition: opacity 500ms ease;
}
.composer-dock[data-effort="xhigh"]::before { opacity: 1; }
.composer-spark-layer {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
  border-radius: inherit; pointer-events: none;
}
.composer-spark-layer canvas { display: block; width: 100%; height: 100%; }
.composer-dock #effort-trigger {
  pointer-events: auto; padding: 0 5px; border: 0; border-radius: 8px;
  background: transparent; color: var(--pb-muted); cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}
.composer-dock #effort-trigger:hover,
.composer-dock #effort-trigger[aria-expanded="true"] { background: var(--pb-hover); color: var(--pb-ink); }
.composer-dock #effort-trigger small { display: inline; color: var(--pb-muted); }
.composer-dock[data-effort="xhigh"] #effort-trigger small { color: var(--pb-accent-ink); }
#effort-trigger svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.effort-popover,
.aichat-media-popover,
.composer-dock .composer > .skill-menu {
  padding: 4px; gap: 0; border: 0; border-radius: 12px;
  background: var(--pb-menu); color: var(--pb-ink); color-scheme: light;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.08);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  transform-origin: bottom center;
}
.effort-popover:not([hidden]), .aichat-media-popover.is-open, .skill-menu:not([hidden]) {
  animation: effortPopoverEnter 180ms var(--pb-ease);
}
.composer-dock .composer > .skill-menu { bottom: calc(100% + 54px); }
.composer-dock .skill-menu button,
.aichat-media-popover .aichat-media-option,
.aichat-media-popover .video-param-option {
  position: relative; z-index: 1; min-height: 36px; border: 0 !important;
  border-radius: 8px !important; padding: 0 8px;
  color: var(--pb-ink) !important; background: transparent !important;
  box-shadow: none !important; font-size: 13px; font-weight: 500;
}
.composer-dock .skill-menu button { height: 36px !important; min-height: 36px !important; gap: 10px; }
.composer-dock .skill-option-icon { width: 20px; height: 20px; color: var(--pb-muted); background: none; border: 0; border-radius: 0; }
.composer-dock .skill-option-copy { display: flex; align-items: center; min-width: 0; gap: 10px; }
.composer-dock .skill-option-copy strong { flex: none; font-size: 13px; color: var(--pb-ink); font-weight: 500; }
.composer-dock .skill-option-copy > span { color: var(--pb-muted); font-size: 12px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aichat-media-popover .aichat-media-option[aria-selected="true"],
.aichat-media-popover .video-param-option[aria-selected="true"] { color: var(--pb-accent-ink) !important; }
.aichat-media-popover .aichat-media-option::after { color: var(--pb-accent-ink); }
.aichat-media-popover.aichat-media-parameters { padding: 12px; gap: 12px; }
.aichat-media-popover :is(.aichat-media-label, .video-param-label, .aichat-image-field span, .aichat-image-count, .video-duration-label, .video-duration-unit) {
  color: var(--pb-muted);
}
.aichat-media-popover :is(.aichat-image-field input, .video-option-toggle) {
  border: 1px solid rgba(39,39,42,.15); border-radius: 8px;
  background: var(--pb-bg); color: var(--pb-ink);
}
.aichat-media-popover .video-option-toggle.active { background: var(--composer-accent-soft); color: var(--pb-accent-ink); }
.aichat-media-popover .video-option-toggle:is(:hover, :focus-visible, .active) { background: var(--pb-hover) !important; color: var(--pb-ink); }
.aichat-media-popover .video-option-toggle[aria-pressed="true"] { background: var(--composer-accent-soft) !important; color: var(--pb-accent-ink); }
.aichat-media-popover.aichat-duration-popover { padding: 12px 14px; }
.aichat-media-popover .video-duration-track { height: 22px; border-radius: 11px; background: var(--pb-hover); }
.aichat-media-popover .video-duration-fill { background: rgba(254,233,3,.35); }
.aichat-media-popover .video-duration-value { color: var(--pb-ink); background: transparent; }
.aichat-media-popover .video-duration-slider::-webkit-slider-runnable-track { height: 22px; }
.aichat-media-popover .video-duration-slider::-moz-range-track { height: 22px; }
.aichat-media-popover .video-duration-slider::-webkit-slider-thumb { width: 14px; height: 28px; margin-top: -3px; border: 0; border-radius: 7px; background: var(--pb-ink); }
.aichat-media-popover .video-duration-slider::-moz-range-thumb { width: 14px; height: 28px; border: 0; border-radius: 7px; background: var(--pb-ink); }
.effort-popover { position: fixed; z-index: 1001; width: 248px; padding: 12px 14px 8px; overflow: auto; }
.effort-popover-head { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; }
.effort-popover-head strong { color: var(--pb-muted); font-weight: 400; }
.effort-popover-head span { font-weight: 500; }
.effort-popover[data-max="true"] .effort-popover-head span { color: var(--pb-accent-ink); }
.effort-ends { display: flex; justify-content: space-between; margin-top: 12px; color: var(--pb-muted); font-size: 12px; line-height: 16px; }
.effort-track { position: relative; height: 22px; margin-top: 8px; border-radius: 11px; background: var(--pb-hover); }
.effort-fill { position: absolute; inset: 0 auto 0 0; width: calc(7px + (100% - 14px) * var(--effort-position)); border-radius: inherit; background: rgba(39,39,42,.15); transition: width 220ms var(--pb-ease), background-color 300ms ease; }
.effort-dot { position: absolute; top: 9px; left: calc(7px + (100% - 14px) * var(--stop)); width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: rgba(39,39,42,.3); }
.effort-thumb { position: absolute; top: -3px; left: calc(7px + (100% - 14px) * var(--effort-position)); width: 14px; height: 28px; margin-left: -7px; border-radius: 7px; background: var(--pb-ink); box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: left 220ms var(--pb-ease), background-color 300ms ease; }
.effort-popover[data-max="true"] .effort-fill { background: rgba(254,233,3,.35); }
.effort-popover[data-max="true"] .effort-thumb { background: var(--composer-accent); }
#effort-slider {
  position: absolute; inset: -11px 0; width: 100%; height: 44px; margin: 0;
  appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer;
}
#effort-slider::-webkit-slider-runnable-track { height: 22px; background: transparent; }
#effort-slider::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 14px; height: 28px; margin-top: -3px; background: transparent; border: 0; }
#effort-slider::-moz-range-track { height: 22px; background: transparent; }
#effort-slider::-moz-range-thumb { width: 14px; height: 28px; background: transparent; border: 0; }
#effort-slider:focus-visible { outline: none !important; }
.effort-track:has(#effort-slider:focus-visible) { outline: 2px solid var(--composer-accent); outline-offset: 4px; }
.effort-stops { display: flex; justify-content: space-between; margin: 9px -3px 0; }
.effort-stops button {
  height: 32px; min-width: 28px; padding: 0 3px; border: 0; border-radius: 6px;
  background: transparent; font: inherit; font-size: 12px; color: var(--pb-muted); cursor: pointer;
}
.effort-stops button[aria-pressed="true"] { color: var(--pb-ink); background: var(--pb-hover); }
.effort-popover[data-max="true"] .effort-stops button[aria-pressed="true"] { color: var(--pb-accent-ink); }
.has-moving-highlight { isolation: isolate; }
.composer-menu-glow {
  position: absolute; z-index: 0; top: 0; left: 0;
  border-radius: 8px; background: var(--pb-hover); pointer-events: none;
  transition: transform 220ms var(--pb-ease), width 220ms var(--pb-ease), height 220ms var(--pb-ease);
}
.has-moving-highlight [role="option"]:hover,
.has-moving-highlight [role="option"]:focus-visible,
.has-moving-highlight [role="option"].is-active,
.has-moving-highlight [role="option"].is-keyboard-active { background: transparent !important; }
.message.assistant[data-answer-stage="preparing"] > :is(.message-content, .reasoning-panel) { display: none; }
.message.assistant[data-answer-stage="preparing"] > :is(.message-time, .search-sources, .message-actions),
.message.assistant[data-answer-stage="answer"] > :is(.message-time, .search-sources, .message-actions) { display: none; }
@keyframes effortPopoverEnter {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 640px) {
  .composer-dock #effort-trigger { height: 44px !important; gap: 4px; padding: 0 3px; }
  .composer-dock #effort-trigger small { font-size: 11px; }
  .effort-stops button { height: 44px; min-width: 44px; }
  .composer-dock .composer > .skill-menu { bottom: calc(100% + 56px); }
  .composer-dock .skill-menu button, .aichat-media-popover .aichat-media-option, .aichat-media-popover .video-param-option { min-height: 44px !important; }
  .composer-dock .skill-option-copy { gap: 6px; }
  .composer-dock .skill-option-copy strong { max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .effort-popover:not([hidden]), .aichat-media-popover.is-open, .skill-menu:not([hidden]) { animation: none; }
  .composer-menu-glow, .effort-fill, .effort-thumb, .composer-dock::before, .composer-dock button { transition: none !important; }
  .composer-dock .composer #send-button:active { transform: none; }
}
