:root {
  --work-nav-height: 96px;
  --blue-50: #eff6ff;
  --blue-75: #eaf3ff;
  --blue-100: #dcecff;
  --blue-200: #bdd8ff;
  --blue-500: #1677ff;
  --blue-600: #0866e8;
  --blue-700: #0757c8;
  --ink-950: #0b1220;
  --ink-800: #1f2a3d;
  --ink-700: #334155;
  --ink-500: #52647c;
  --ink-400: #64748b;
  --line: #d9e5f7;
  --line-strong: #c4d6ef;
  --surface: #ffffff;
  --sidebar: #f7fbff;
  --shadow-soft: 0 18px 44px rgba(30, 91, 175, 0.12);
  --shadow-popover: 0 22px 48px rgba(15, 52, 104, 0.16), 0 2px 10px rgba(15, 52, 104, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --sidebar-width: 240px;
  --panel-width: 240px;
  color: var(--ink-950);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-width: 320px;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #ffffff;
  -webkit-font-smoothing: auto;
  text-rendering: optimizeLegibility;
}

body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--work-nav-height) minmax(0, 1fr);
}

body.work-nav-failed {
  --work-nav-height: 0px;
}

.work-global-nav {
  position: relative;
  z-index: 500;
  display: block;
  width: 100%;
  height: var(--work-nav-height);
  min-height: var(--work-nav-height);
  overflow: visible;
  background: #ffffff;
}

.work-global-nav[aria-busy="true"]::after {
  position: absolute;
  inset: 0;
  background: #ffffff;
  content: "";
}

body.work-nav-failed .work-global-nav {
  display: none;
}

* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  width: 0;
  height: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(22, 119, 255, 0.28);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 120;
  width: max-content;
  max-width: 180px;
  padding: 5px 8px;
  border: 1px solid #d8e6f7;
  border-radius: 7px;
  color: #1f2a3d;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 24px rgba(18, 49, 91, 0.14);
  content: attr(data-tooltip);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: nowrap;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ui-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon-chat { --icon: url("./assets/icons/chat.svg"); }
.icon-image { --icon: url("./assets/icons/image.svg"); }
.icon-video { --icon: url("./assets/icons/video.svg"); }
.icon-file { --icon: url("./assets/icons/file.svg"); }
.icon-folder { --icon: url("./assets/icons/folder.svg"); }
.icon-users { --icon: url("./assets/icons/users.svg"); }
.icon-plus { --icon: url("./assets/icons/plus.svg"); }
.icon-search { --icon: url("./assets/icons/search.svg"); }
.icon-trash { --icon: url("./assets/icons/trash.svg"); }
.icon-settings { --icon: url("./assets/icons/settings.svg"); }
.icon-chevron-down { --icon: url("./assets/icons/chevron-down.svg"); }
.icon-refresh { --icon: url("./assets/icons/refresh.svg"); }
.icon-star { --icon: url("./assets/icons/star.svg"); }
.icon-share { --icon: url("./assets/icons/share.svg"); }
.icon-heart { --icon: url("./assets/icons/heart.svg"); }
.icon-ban { --icon: url("./assets/icons/ban.svg"); }
.icon-copy { --icon: url("./assets/icons/copy.svg"); }
.icon-download { --icon: url("./assets/icons/download.svg"); }
.icon-upload { --icon: url("./assets/icons/upload.svg"); }
.icon-send { --icon: url("./assets/icons/send.svg"); }
.icon-stop { --icon: url("./assets/icons/stop.svg"); }
.icon-restore { --icon: url("./assets/icons/restore.svg"); }
.icon-x { --icon: url("./assets/icons/x.svg"); }
.icon-sparkles { --icon: url("./assets/icons/sparkles.svg"); }

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 62% 0%, rgba(226, 240, 255, 0.78), transparent 32%),
    linear-gradient(180deg, #f9fcff 0%, #ffffff 32%, #ffffff 100%);
}

.sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: var(--sidebar-width);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbff 0%, #f5f9ff 100%);
}

.sidebar-panel {
  display: flex;
  height: 100%;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 10px 10px;
}

.sidebar-panel > * {
  max-width: 100%;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--ink-950);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.sidebar-close,
.mobile-sidebar-toggle {
  display: none;
}

.brand-row strong {
  font-weight: 700;
}

.brand-row img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  max-width: 100%;
  height: 36px;
  margin-bottom: 10px;
  border-radius: 9px;
  color: #ffffff;
  background: linear-gradient(180deg, #1b7cff, #0566ef);
  box-shadow: 0 8px 18px rgba(8, 102, 232, 0.18);
  font-weight: 700;
  font-size: 12px;
}

.new-chat:hover {
  background: linear-gradient(180deg, #2b87ff, #075fe0);
}

.plus {
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
}

.search-box {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  height: 32px;
  margin-bottom: 12px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink-400);
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-800);
  font-size: 12px;
}

.search-box input::placeholder {
  color: #667990;
}

kbd {
  padding: 1px 5px;
  border-radius: 6px;
  background: #f4f8ff;
  color: #8a98ab;
  font-size: 10px;
  font-weight: 600;
}

.sidebar-smart-filter {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 32px;
  margin: -4px 0 5px;
  padding: 0 8px;
  border-radius: 8px;
  color: #52657c;
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.sidebar-smart-filter:hover,
.sidebar-smart-filter.active {
  color: #0f6fff;
  background: #eaf3ff;
}

.sidebar-smart-filter.active {
  font-weight: 700;
}

.sidebar-smart-filter small {
  min-width: 18px;
  color: #60738a;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.sidebar-smart-filter.active small {
  color: #7292bc;
}

.category-panel {
  flex: 0 0 auto;
  margin: 0 0 10px;
  padding: 0 0 7px;
  border-bottom: 1px solid #e4edf8;
}

.category-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 1px;
}

.category-toggle {
  display: flex;
  min-width: 0;
  height: 30px;
  flex: 1;
  align-items: center;
  gap: 7px;
  padding: 0 6px;
  border-radius: 8px;
  color: #718299;
  background: transparent;
  text-align: left;
}

.category-toggle:hover {
  color: #0f6fff;
  background: #edf5ff;
}

.category-toggle strong {
  color: #5b6e85;
  font-size: 12px;
  font-weight: 700;
}

.category-toggle:hover strong {
  color: inherit;
}

.category-chevron {
  width: 12px;
  height: 12px;
  transform: rotate(-90deg);
  transition: transform 160ms ease;
}

.category-panel.is-expanded .category-chevron {
  transform: rotate(0deg);
}

.category-panel-heading .category-add {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 7px;
  color: #6c7f97;
  background: transparent;
}

.category-panel-heading .category-add:hover {
  color: #0f6fff;
  background: #e9f3ff;
}

.category-body {
  padding-top: 3px;
}

.active-category-chip {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  margin: 2px 1px 4px;
  padding: 2px 3px 2px 8px;
  border: 1px solid #cfe1fa;
  border-radius: 8px;
  color: #0f6fff;
  background: #edf5ff;
  font-size: 11px;
  font-weight: 700;
}

.active-category-chip > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-category-chip small {
  color: #7292bc;
  font-size: 9.5px;
  font-weight: 600;
}

.active-category-chip button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #6f88aa;
  background: transparent;
}

.active-category-chip button:hover {
  color: #0f6fff;
  background: #ffffff;
}

.category-list {
  display: grid;
  max-height: 132px;
  gap: 2px;
  overflow-x: hidden;
  overflow-y: auto;
}

.empty-category-toggle {
  width: 100%;
  height: 26px;
  margin-top: 3px;
  padding: 0 7px;
  border-radius: 7px;
  color: #7a8ba1;
  background: transparent;
  font-size: 10px;
  text-align: left;
}

.empty-category-toggle:hover {
  color: #0f6fff;
  background: #edf5ff;
}

.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
}

.category-row:hover,
.category-row.active {
  background: #eaf3ff;
}

.category-filter {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 24px;
  padding: 0 7px;
  border-radius: 8px;
  color: #52657c;
  background: transparent;
  text-align: left;
  font-size: 11px;
}

.category-row.active .category-filter {
  color: #0f6fff;
  font-weight: 700;
}

.category-filter > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-filter small {
  min-width: 18px;
  color: #8b9bb0;
  font-size: 9.5px;
  text-align: right;
}

.category-actions {
  display: flex;
  align-items: center;
  padding-right: 3px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.category-row:hover .category-actions,
.category-row:focus-within .category-actions {
  opacity: 1;
}

.category-actions button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  color: #8292a7;
  background: transparent;
}

.category-actions button:hover {
  color: #0f6fff;
  background: #ffffff;
}

.category-actions button:last-child:hover {
  color: #d33f49;
}

.category-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 4px;
  margin-top: 6px;
}

.category-editor input {
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #bcd4f4;
  border-radius: 7px;
  outline: none;
  color: #334155;
  background: #ffffff;
  font-size: 10.5px;
}

.category-editor button {
  height: 28px;
  padding: 0 7px;
  border-radius: 7px;
  color: #506176;
  background: #edf4fd;
  font-size: 10px;
  font-weight: 700;
}

.category-editor button[type="submit"] {
  color: #ffffff;
  background: #1677ff;
}

.conversation-list {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  padding-right: 2px;
  scrollbar-gutter: auto;
}

.conversation-list section {
  margin-bottom: 12px;
}

.conversation-list h2 {
  margin: 0 0 6px;
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
}

.conversation {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
  gap: 7px;
  width: 100%;
  max-width: 100%;
  min-height: 38px;
  margin: 1px 0;
  padding: 6px 7px;
  border-radius: 8px;
  color: var(--ink-700);
  background: transparent;
  text-align: left;
  transition: background 160ms ease, color 160ms ease;
  overflow: hidden;
}

.conversation:hover {
  background: rgba(235, 244, 255, 0.76);
}

.conversation.active {
  color: #0f6fff;
  background: #e8f2ff;
}

.row-icon {
  display: grid;
  place-items: center;
  color: currentColor;
  padding-top: 0;
  font-size: 12px;
}

.row-thumb {
  width: 22px;
  height: 22px;
  overflow: hidden;
  border: 1px solid #cfe0f6;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(26, 83, 160, 0.08);
}

.row-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-copy {
  min-width: 0;
}

.conversation strong {
  display: block;
  overflow: hidden;
  color: inherit;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #566980;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation time {
  color: #566980;
  padding-top: 1px;
  font-size: 11px;
  font-weight: 500;
}

.row-meta {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 30px;
  max-width: 84px;
  overflow: hidden;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
}

.row-action {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  color: #8a98ab;
  font-size: 11px;
  opacity: 0;
  transition: opacity 140ms ease, color 140ms ease, background 140ms ease;
}

.conversation:hover .row-action,
.conversation.active .row-action {
  opacity: 1;
}

.row-action:hover {
  color: #d33f49;
  background: #fff0f2;
}

.row-action.is-favorite {
  color: #e6a100;
  opacity: 1;
}

.row-category {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  margin-top: 3px;
  padding: 1px 5px;
  overflow: hidden;
  border-radius: 6px;
  color: #6f8198;
  background: #edf4fd;
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-category .ui-icon {
  width: 9px;
  height: 9px;
}

.category-assign-menu {
  display: grid;
  gap: 2px;
  margin: 3px 4px 7px 31px;
  padding: 7px;
  border: 1px solid #d5e3f5;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 28px rgba(23, 68, 130, 0.12);
}

.category-assign-menu > strong {
  padding: 2px 5px 5px;
  color: #7c8da3;
  font-size: 9.5px;
}

.category-assign-menu > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  padding: 0 7px;
  border-radius: 7px;
  color: #4c5e74;
  background: transparent;
  font-size: 10.5px;
  text-align: left;
}

.category-assign-menu > button:hover,
.category-assign-menu > button.selected {
  color: #0f6fff;
  background: #edf5ff;
}

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

.trash-header h2 {
  margin: 0;
}

.trash-header button {
  padding: 3px 7px;
  border-radius: 7px;
  color: #64748b;
  background: #eef5ff;
  font-size: 10px;
  font-weight: 700;
}

.trash-conversation {
  cursor: default;
}

.trash-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.trash-actions button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  color: #64748b;
  background: #eef5ff;
  font-size: 12px;
}

.trash-actions button:hover {
  color: #0f6fff;
  background: #e4f0ff;
}

.conversation-empty {
  margin-top: 8px;
  padding: 14px 8px;
  color: #8a98ab;
  font-size: 12px;
  text-align: center;
}

.sidebar-footer {
  flex: 0 0 auto;
  padding-top: 7px;
  border-top: 1px solid #e5eef9;
}

.trash {
  width: 100%;
  margin-bottom: 0;
  padding: 5px 7px;
  color: var(--ink-500);
  background: transparent;
  text-align: left;
  font-size: 11.5px;
}

.trash:hover {
  color: #0f6fff;
  background: #eef6ff;
}

.workspace {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  flex: 0 0 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid #e2ebf7;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
}

.topbar-title-group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.title-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-950);
  font-size: 16px;
  font-weight: 700;
}

.title-button span {
  color: var(--ink-500);
  font-size: 15px;
}

.title-button .title-text {
  max-width: min(46vw, 520px);
  overflow: hidden;
  color: var(--ink-950);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-canvas {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(16px, 2.8vh, 26px) clamp(24px, 3vw, 44px) 18px;
}

.message {
  display: flex;
  width: 100%;
}

.message + .message {
  margin-top: 12px;
}

.user-message {
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 0;
}

.user-bubble {
  max-width: 660px;
  padding: 13px 16px 12px;
  border: 1px solid #d7e7ff;
  border-radius: 14px;
  background: linear-gradient(180deg, #eaf3ff 0%, #e8f2ff 100%);
  color: #182235;
  font-size: 14px;
  line-height: 1.58;
  box-shadow: 0 12px 30px rgba(72, 122, 190, 0.08);
}

.user-bubble time {
  display: block;
  margin-top: 6px;
  color: #6d7f95;
  font-size: 12px;
  text-align: right;
}

.user-attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 132px));
  justify-content: end;
  gap: 8px;
  margin-top: 10px;
}

.user-attachment-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid #c8dcf8;
  border-radius: 9px;
  object-fit: cover;
  cursor: zoom-in;
  background: #f8fbff;
}

.image-load-fallback {
  display: flex;
  width: 100%;
  min-height: 88px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
  border: 1px dashed #c8dcf8;
  border-radius: 9px;
  color: #71839a;
  background: #f8fbff;
  font-size: 12px;
  text-align: center;
}

.user-attachment-grid .image-load-fallback {
  aspect-ratio: 1;
}

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

.user-file-attachments a {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 7px;
  max-width: 280px;
  padding: 7px 9px;
  border: 1px solid #c8dcf8;
  border-radius: 8px;
  color: #315274;
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.user-file-attachments a span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-message {
  align-items: flex-start;
  gap: 0;
  margin-top: 0;
}

.assistant-card {
  width: min(100%, 1080px);
  padding: 16px 18px 14px;
  border: 1px solid #d8e6f7;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 34px rgba(35, 79, 135, 0.06);
}

.assistant-card.media-result-card {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.media-result-card .poster-grid,
.media-result-card .video-grid {
  margin-top: 0;
}

.assistant-card p {
  margin: 0 0 10px;
  color: #152033;
  font-size: 14px;
  line-height: 1.55;
}

.message-content {
  color: #152033;
  font-size: 14px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.message-content > :first-child {
  margin-top: 0;
}

.message-content > :last-child {
  margin-bottom: 0;
}

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

.message-content ul,
.message-content ol {
  margin: 6px 0 12px;
  padding-left: 22px;
}

.message-content li + li {
  margin-top: 6px;
}

.message-content code {
  padding: 2px 5px;
  border: 1px solid #dce7f5;
  border-radius: 5px;
  color: #174a8f;
  background: #f3f7fc;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.message-content pre {
  margin: 10px 0;
  overflow-x: auto;
  padding: 12px;
  border-radius: 9px;
  color: #e2e8f0;
  background: #172033;
}

.message-content pre code {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
}

.dynamic-message {
  margin-top: 0;
}

.chat-reply-card {
  width: min(100%, 760px);
  padding: 13px 16px;
}

.chat-reply-card .message-content {
  margin: 0;
  white-space: pre-wrap;
}

.chat-reply-card.is-loading .message-content {
  color: #66768c;
}

.chat-reply-card.is-error {
  border-color: #ffd3d8;
  background: #fff7f8;
}

.chat-reply-card.is-error .message-content {
  color: #af1f3a;
}

.assistant-card ul {
  margin: 0 0 18px;
  padding-left: 24px;
  color: #172236;
  font-size: 14px;
  line-height: 1.68;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 340px));
  align-items: start;
  gap: 14px;
  margin-top: 6px;
}

.poster-grid figure {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid #cfdded;
  border-radius: 9px;
  background: #f8fbff;
  box-shadow: 0 8px 22px rgba(15, 44, 82, 0.08);
}

.poster-grid img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(520px, 58vh);
  object-fit: contain;
  cursor: zoom-in;
  background: #f8fbff;
}

.poster-grid .image-load-fallback {
  min-height: 180px;
  border: 0;
  border-radius: 0;
}

.poster-download-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 10px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.72);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 150ms ease, background 150ms ease;
}

.generated-image-figure:hover .poster-download-button,
.generated-image-figure:focus-within .poster-download-button,
.poster-download-button:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.poster-download-button:hover,
.lightbox-download:hover,
.lightbox-close:hover {
  background: rgba(15, 23, 42, 0.94);
}

.poster-download-button:disabled,
.lightbox-download:disabled {
  cursor: wait;
  opacity: 0.72;
}

.poster-download-button.is-downloading .ui-icon,
.lightbox-download.is-downloading .ui-icon {
  animation: spin 0.8s linear infinite;
}

.video-grid {
  display: grid;
  grid-template-columns: minmax(220px, 520px);
  gap: 12px;
  margin-top: 12px;
}

.video-grid figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid #cfdded;
  border-radius: 9px;
  background: #0f172a;
  aspect-ratio: 16 / 9;
  box-shadow: 0 8px 22px rgba(15, 44, 82, 0.08);
}

.video-grid video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0f172a;
}

.analysis-panel {
  margin-top: 12px;
  border: 1px solid #d7e5f8;
  border-radius: 9px;
  background: #f8fbff;
}

.analysis-panel summary {
  cursor: pointer;
  padding: 9px 11px;
  color: #30425a;
  font-size: 13px;
  font-weight: 800;
}

.analysis-panel pre {
  overflow: auto;
  max-height: 260px;
  margin: 0;
  padding: 0 11px 11px;
  color: #3f5168;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(9, 18, 34, 0.78);
  backdrop-filter: blur(10px);
}

.image-lightbox img {
  display: block;
  max-width: min(92vw, 1180px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.lightbox-actions {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-close,
.lightbox-download {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.72);
}

.lightbox-download {
  width: auto;
  min-width: 40px;
  padding: 0 12px;
  gap: 7px;
}

.lightbox-download::after {
  content: "下载";
  font-size: 13px;
  font-weight: 700;
}

@media (hover: none), (pointer: coarse) {
  .poster-download-button {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.result-actions button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #526176;
  background: transparent;
  font-size: 17px;
}

.result-actions button:hover,
.result-actions button.active {
  color: var(--blue-600);
  background: #edf5ff;
}

.composer {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  flex: 0 0 auto;
  margin: 0 clamp(24px, 3vw, 44px) clamp(18px, 3vh, 34px) 24px;
  z-index: 10;
}

.composer.popover-visible {
  z-index: 130;
}

.input-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: clamp(88px, 10vh, 100px);
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid #9ec4ff;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  overflow: visible;
}

.input-shell.is-drag-over {
  border-color: #1677ff;
  background: #f4f8ff;
  box-shadow: 0 18px 46px rgba(22, 119, 255, 0.18);
}

.chat-canvas.is-drag-over {
  background:
    linear-gradient(rgba(244, 248, 255, 0.74), rgba(244, 248, 255, 0.74)),
    var(--canvas-bg, transparent);
  outline: 1px dashed rgba(22, 119, 255, 0.38);
  outline-offset: -18px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  max-width: 100%;
}

.attachment-list[hidden] {
  display: none;
}

.generation-mode-notice {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #bcd7ff;
  border-radius: 10px;
  color: #164786;
  background: #edf5ff;
}

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

.input-shell[data-mode="video"] .generation-mode-notice {
  border-color: #d8c9ff;
  color: #5635a5;
  background: #f5f1ff;
}

.generation-mode-icon {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
}

.generation-mode-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.generation-mode-copy strong {
  font-size: 12px;
  line-height: 1.3;
}

.generation-mode-copy small {
  color: #6d7f95;
  font-size: 10px;
  line-height: 1.3;
}

.generation-mode-notice button {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 5px 9px;
  border: 1px solid currentColor;
  border-radius: 7px;
  color: inherit;
  background: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  font-weight: 700;
}

.generation-mode-notice button:hover {
  background: #ffffff;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 220px;
  height: 30px;
  padding: 0 7px 0 9px;
  border: 1px solid #d7e5f8;
  border-radius: 9px;
  color: #314156;
  background: #f8fbff;
  font-size: 12px;
  font-weight: 700;
}

.attachment-chip.is-media {
  position: relative;
  width: 74px;
  height: 74px;
  max-width: 74px;
  padding: 5px;
  border-radius: 12px;
  background: #ffffff;
}

.attachment-preview {
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid #dbe8f8;
  background: #f4f8ff;
}

.attachment-preview.is-loading {
  display: block;
}

.attachment-preview.is-loading::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 21px auto;
  border: 2px solid #cfe1ff;
  border-top-color: #1677ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.attachment-chip.is-media .attachment-name,
.attachment-chip.is-media .attachment-size,
.attachment-chip.is-media .attachment-status {
  display: none;
}

.attachment-chip.is-media button {
  position: absolute;
  top: -6px;
  right: -6px;
  color: #ffffff;
  background: #24344d;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.attachment-chip > .ui-icon {
  width: 14px;
  height: 14px;
  color: #1677ff;
}

.attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-size {
  flex: 0 0 auto;
  color: #8a98ab;
  font-size: 11px;
  font-weight: 600;
}

.attachment-status {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 5px;
  color: #0f6fff;
  background: #e8f2ff;
  font-size: 10px;
  font-weight: 800;
}

.attachment-chip.is-uploading .attachment-status {
  color: #8a5a00;
  background: #fff5d8;
}

.attachment-chip.is-error {
  border-color: #ffd3d8;
  background: #fff7f8;
}

.attachment-chip.is-error .attachment-status {
  color: #b91c1c;
  background: #ffe4e8;
}

.attachment-chip button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  color: #8a98ab;
  background: transparent;
}

.attachment-chip button:hover {
  color: #e2485d;
  background: #fff0f3;
}

.attachment-chip.is-media button {
  position: absolute;
  top: -6px;
  right: -6px;
  color: #ffffff;
  background: #24344d;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.attachment-chip.is-media button:hover {
  color: #ffffff;
  background: #e2485d;
}

.attachment-chip.is-media.has-role {
  flex-direction: column;
  width: 118px;
  max-width: 118px;
  height: 104px;
}

.attachment-role-select {
  width: 106px;
  height: 24px;
  padding: 0 5px;
  border: 1px solid #d2e0f2;
  border-radius: 6px;
  color: #526176;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 34px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink-800);
  font-size: 14px;
  line-height: 1.5;
}

textarea:focus-visible {
  outline: none;
}

textarea::placeholder {
  color: #8a98ab;
}

.composer-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  overflow: visible;
}

.utility-actions,
.generation-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.generation-actions {
  position: relative;
  z-index: 30;
  max-width: 100%;
  --generation-control-height: 44px;
  --generation-control-radius: 9px;
  --generation-control-font-size: 14px;
  --generation-control-font-weight: 700;
}

.credit-estimate-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--generation-control-height);
  min-height: var(--generation-control-height);
  padding: 0 12px;
  border: 1px solid #c7d8ef;
  border-radius: var(--generation-control-radius);
  color: #3e5f88;
  background: #f4f8fd;
  font-size: var(--generation-control-font-size);
  font-weight: var(--generation-control-font-weight);
  line-height: 1;
  white-space: nowrap;
}

.credit-estimate-chip[hidden] {
  display: none;
}

.utility-actions button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  color: #4f5f75;
  background: transparent;
  font-size: 17px;
}

.utility-actions button:hover {
  background: #f0f6ff;
  color: var(--blue-600);
}

.attachment-menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.attachment-menu {
  position: absolute;
  left: 0;
  right: auto;
  margin: 0;
  transform: none;
  bottom: calc(100% + 8px);
  z-index: 70;
  width: 240px;
  padding: 7px;
  border: 1px solid #d8e5f5;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(26, 57, 98, 0.16);
}

.utility-actions .attachment-menu > button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  gap: 9px;
  width: 100%;
  height: auto;
  min-height: 52px;
  padding: 9px;
  border-radius: 9px;
  color: #35465b;
  background: transparent;
  text-align: left;
}

.utility-actions .attachment-menu > button > span:last-child {
  width: 100%;
}

.utility-actions .attachment-menu > button:hover {
  color: #126af0;
  background: #eff6ff;
}

.attachment-menu > button > .ui-icon {
  width: 17px;
  height: 17px;
  margin: auto;
}

.attachment-menu strong,
.attachment-menu small {
  display: block;
}

.attachment-menu strong {
  font-size: 12px;
}

.attachment-menu small {
  margin-top: 2px;
  color: #8a98ab;
  font-size: 10px;
  font-weight: 500;
}

.composer-status {
  max-width: 220px;
  color: #7b8ba0;
  font-size: 11px;
  line-height: 1.35;
}

.mode-button,
.generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--generation-control-height, 44px);
  min-height: var(--generation-control-height, 44px);
  white-space: nowrap;
  border-radius: var(--generation-control-radius, 9px);
  font-size: var(--generation-control-font-size, 14px);
  font-weight: var(--generation-control-font-weight, 700);
  min-width: 0;
}

.chat-model-control {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
}

.chat-mode-button {
  width: 100%;
  min-width: 218px;
}

.chat-mode-button[aria-expanded="true"] {
  border-color: #6aa7ff;
  color: #0f6fff;
  background: #eaf3ff;
}

.chat-current-model {
  max-width: 118px;
  overflow: hidden;
  color: currentColor;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-mode-divider {
  color: #9aa8ba;
}

.chat-model-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 70;
  width: 290px;
  padding: 8px;
  border: 1px solid #d8e5f5;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 46px rgba(26, 57, 98, 0.18);
}

.chat-model-menu-title {
  padding: 5px 7px 9px;
  color: #73849a;
  font-size: 11px;
  font-weight: 700;
}

.chat-model-menu > button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 8px;
  border-radius: 9px;
  color: #28384c;
  background: transparent;
  text-align: left;
}

.chat-model-menu > button:hover,
.chat-model-menu > button.selected {
  background: #eff6ff;
}

.model-option-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d7e4f4;
  border-radius: 9px;
  color: #1677ff;
  background: #ffffff;
}

.chat-model-menu strong,
.chat-model-menu small {
  display: block;
}

.chat-model-menu strong {
  font-size: 12px;
}

.chat-model-menu small {
  margin-top: 3px;
  color: #8493a7;
  font-size: 10px;
}

.mode-button {
  min-width: 104px;
  padding: 0 10px;
  border: 1px solid #c7d8ef;
  color: #58687d;
  background: #ffffff;
  transition: border 160ms ease, color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

#imageModeBtn,
#videoModeBtn {
  -webkit-font-smoothing: antialiased;
  font-weight: 700;
}

.mode-button:hover,
.mode-button.active {
  border-color: #6aa7ff;
  color: var(--blue-600);
  background: #eaf3ff;
  box-shadow: 0 8px 22px rgba(8, 102, 232, 0.1);
}

.mode-label-short {
  display: none;
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: currentColor;
  font-size: 16px;
}

.mode-thumb {
  display: block;
  width: 18px;
  height: 18px;
  overflow: hidden;
  border: 1px solid #cfe0f6;
  border-radius: 6px;
  object-fit: cover;
}

.chevron {
  margin-left: 1px;
  font-size: 16px;
  width: 18px;
  height: 18px;
  padding: 2px;
  border-radius: 6px;
  opacity: 0.82;
  transition: background 160ms ease, opacity 160ms ease;
}

.generate-button {
  min-width: 86px;
  padding: 0 14px;
  color: #ffffff;
  background: linear-gradient(180deg, #157cff, #0667e9);
  box-shadow: 0 12px 28px rgba(8, 102, 232, 0.24);
}

.generate-button:hover {
  background: linear-gradient(180deg, #2989ff, #075fde);
}

.generate-button[data-action-kind="image"] {
  background: linear-gradient(180deg, #1686f7, #0868dd);
}

.generate-button[data-action-kind="video"] {
  background: linear-gradient(180deg, #7357e8, #5638c8);
  box-shadow: 0 12px 28px rgba(86, 56, 200, 0.24);
}

.generate-button[data-action-kind="video"]:hover {
  background: linear-gradient(180deg, #8065ec, #4f31bb);
}

.generate-button.is-working {
  cursor: pointer;
  background: linear-gradient(180deg, #ef4444, #dc2626);
  box-shadow: 0 12px 28px rgba(220, 38, 38, 0.22);
}

.generate-button.is-working:hover {
  background: linear-gradient(180deg, #f05252, #c91f1f);
}

.generate-button.is-disabled {
  border: 1px solid #d5dfeb;
  color: #8492a5;
  background: #e9eef5;
  opacity: 1;
  cursor: default;
  box-shadow: none;
}

.generate-button.is-disabled:hover {
  color: #8492a5;
  background: #e9eef5;
}

.model-popover {
  position: absolute;
  z-index: 20;
  left: 0;
  right: auto;
  top: 0;
  bottom: auto;
  width: min(470px, calc(100% - 16px));
  max-height: min(78vh, 760px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #dce7f5;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-popover);
  backdrop-filter: blur(18px);
}

.model-popover[data-anchor="image"],
.model-popover[data-anchor="video"] {
  width: min(760px, calc(100% - 16px));
  height: min(620px, 78vh);
  max-height: min(620px, 78vh);
  overflow: hidden;
}

.image-popover-tabs {
  display: none;
}

.image-popover-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.image-model-pane,
.image-settings-pane {
  min-width: 0;
  min-height: 0;
}

.image-model-pane {
  display: flex;
  flex-direction: column;
  padding-right: 10px;
  border-right: 1px solid #e7eef8;
  overflow: hidden;
}

.image-model-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  padding: 4px 2px 4px 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.image-settings-pane {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

.image-pane-heading {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid #edf3fb;
  background: rgba(255, 255, 255, 0.98);
}

.image-pane-heading strong,
.image-pane-heading small {
  display: block;
}

.image-pane-heading strong {
  color: #223047;
  font-size: 14px;
  font-weight: 800;
}

.image-pane-heading small {
  margin-top: 3px;
  color: #607087;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.image-settings-pane > .parameter-panel {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 14px 12px 12px;
  border-top: 0;
}

.pricing-summary {
  position: sticky;
  z-index: 5;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid #dce8f7;
  background: rgba(248, 251, 255, 0.98);
  box-shadow: 0 -10px 24px rgba(37, 76, 129, 0.07);
  backdrop-filter: blur(12px);
}

.pricing-summary-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 9px;
  color: #ffffff;
  background: linear-gradient(145deg, #2b8aff, #0e67e6);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(14, 103, 230, 0.2);
}

.pricing-summary-copy {
  min-width: 0;
  text-align: right;
}

.pricing-summary-total,
.pricing-summary-breakdown {
  display: block;
}

.pricing-summary-total {
  color: #1e3350;
  font-size: 14px;
  font-weight: 900;
}

.pricing-summary-breakdown {
  margin-top: 3px;
  overflow: hidden;
  color: #667a93;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-mobile-header {
  display: none;
}

.popover-backdrop,
.sidebar-backdrop {
  display: none;
}

.model-popover::after {
  position: absolute;
  left: calc(var(--arrow-left, 50%) - 9px);
  bottom: -5px;
  width: 18px;
  height: 18px;
  border-right: 1px solid #dce7f5;
  border-bottom: 1px solid #dce7f5;
  background: rgba(255, 255, 255, 0.96);
  content: "";
  transform: rotate(45deg);
}

.model-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 7px 9px;
  border-radius: 9px;
  color: var(--ink-700);
  background: transparent;
  text-align: left;
}

.model-copy {
  min-width: 0;
}

.model-meta {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 62px;
}

.model-price {
  color: #72829a;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.model-row.selected .model-price {
  color: #3973bd;
}

.model-row:hover {
  background: #f3f8ff;
}

.model-row.selected {
  background: #eaf3ff;
  color: #0d63dd;
}

.model-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #c9d9ee;
  border-radius: 8px;
  color: #1b6ff2;
  background: #ffffff;
  font-size: 16px;
}

.model-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: cover;
}

.model-row.selected .model-mark {
  border-color: #8bbaff;
  background: #f8fbff;
}

.model-copy strong,
.model-copy span {
  display: block;
}

.model-copy strong {
  color: #1f2a3d;
  font-size: 13px;
  font-weight: 800;
}

.model-copy span {
  margin-top: 3px;
  overflow: hidden;
  color: #607087;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-quality {
  max-width: none;
  padding: 3px 7px;
  border-radius: 7px;
  color: #1170ee;
  background: #dfedff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.model-row:nth-child(2) .model-quality {
  color: #078f7f;
  background: #ddf7f0;
}

.model-row:nth-child(3) .model-quality {
  color: #7c3feb;
  background: #eee7ff;
}

.selected-check {
  color: var(--blue-600);
  font-size: 19px;
  font-weight: 900;
}

.parameter-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding: 12px;
  border-top: 1px solid #edf3fb;
}

.parameter-group {
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: start;
  gap: 10px;
}

.parameter-title-wrap {
  display: grid;
  gap: 3px;
}

.parameter-title {
  color: #63758b;
  font-size: 12px;
  font-weight: 800;
}

.parameter-hint {
  color: #63758b;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
}

.parameter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.video-range-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #63758b;
  font-size: 12px;
  font-weight: 700;
}

.video-range-control input {
  width: 92px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d2e0f2;
  border-radius: 8px;
  color: #33455c;
  background: #fff;
  font: inherit;
}

.parameter-chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d2e0f2;
  border-radius: 8px;
  color: #526176;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.parameter-chip:hover,
.parameter-chip.active {
  border-color: #7fb2ff;
  color: #0f6fff;
  background: #eaf3ff;
}

.advanced-parameters {
  border-top: 1px solid #edf3fb;
}

.advanced-parameters summary {
  padding: 10px 0 2px;
  color: #315171;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style-position: inside;
}

.advanced-parameter-content {
  display: grid;
  gap: 12px;
  padding: 12px 0 2px;
}

.advanced-field {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.advanced-label {
  padding-top: 8px;
  color: #63758b;
  font-size: 12px;
  font-weight: 800;
}

.advanced-control {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.advanced-input {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #d2e0f2;
  border-radius: 8px;
  color: #33455c;
  background: #fff;
  font: inherit;
  font-size: 12px;
  outline: none;
}

.advanced-input:focus {
  border-color: #7fb2ff;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.1);
}

.advanced-input[aria-invalid="true"] {
  border-color: #ef4444;
}

.advanced-input:disabled {
  color: #9aa7b7;
  background: #f3f6fa;
  cursor: not-allowed;
}

.advanced-textarea {
  resize: vertical;
  line-height: 1.45;
}

.advanced-hint {
  color: #8b9aaf;
  font-size: 10px;
  line-height: 1.4;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: #526176;
  font-size: 12px;
  cursor: pointer;
}

.toggle-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-visual {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #cbd7e6;
  transition: background 160ms ease;
}

.toggle-visual::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(31, 42, 61, 0.24);
  content: "";
  transition: transform 160ms ease;
}

.toggle-control input:checked + .toggle-visual {
  background: #1677ff;
}

.toggle-control input:checked + .toggle-visual::after {
  transform: translateX(14px);
}

.toggle-control.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.palette-editor {
  display: grid;
  gap: 7px;
}

.palette-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 6px;
}

.palette-row input[type="color"] {
  width: 34px;
  height: 32px;
  padding: 2px;
  border: 1px solid #d2e0f2;
  border-radius: 7px;
  background: #fff;
}

.palette-remove,
.palette-add {
  min-height: 30px;
  border: 1px solid #d2e0f2;
  border-radius: 7px;
  color: #526176;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.palette-remove {
  color: #d14343;
}

.palette-add:hover,
.palette-remove:hover {
  border-color: #8ab8f7;
  background: #f1f7ff;
}

.structured-editor,
.external-reference-list {
  display: grid;
  gap: 8px;
}

.structured-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 66px 28px;
  align-items: center;
  gap: 6px;
}

.structured-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #0f6fff;
  background: #eaf3ff;
  font-size: 11px;
  font-weight: 800;
}

.structured-duration {
  min-width: 0;
}

.structured-add,
.structured-remove {
  min-height: 30px;
  border: 1px solid #d2e0f2;
  border-radius: 7px;
  color: #526176;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.structured-add {
  padding: 0 10px;
}

.structured-remove {
  width: 28px;
  color: #d14343;
}

.structured-add:hover,
.structured-remove:hover {
  border-color: #8ab8f7;
  background: #f1f7ff;
}

.element-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #e0e9f5;
  border-radius: 10px;
  background: #f9fbfe;
}

.element-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #40546c;
  font-size: 11px;
}

.element-card input[type="file"] {
  max-width: 100%;
  color: #63758b;
  font-size: 10px;
}

.external-reference-form {
  display: grid;
  grid-template-columns: 74px 88px minmax(0, 1fr) auto;
  gap: 7px;
}

.external-reference-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 8px;
  color: #526176;
  background: #f5f8fc;
  font-size: 10px;
}

.external-reference-row span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Keep image/video creation panels visually light; emphasis comes from selection color. */
.model-popover {
  -webkit-font-smoothing: antialiased;
}

.model-popover .image-pane-heading strong,
.model-popover .model-copy strong,
.model-popover .pricing-summary-total {
  color: #34465d;
  font-weight: 500;
}

.model-popover .model-price,
.model-popover .pricing-summary-breakdown,
.model-popover .parameter-hint {
  font-weight: 400;
}

.model-popover .model-quality,
.model-popover .parameter-title,
.model-popover .video-range-control,
.model-popover .parameter-chip,
.model-popover .advanced-parameters summary,
.model-popover .advanced-label,
.model-popover .palette-add,
.model-popover .palette-remove,
.model-popover .structured-index,
.model-popover .structured-add,
.model-popover .structured-remove {
  font-weight: 500;
}

.empty-chat {
  display: grid;
  place-items: start center;
  min-height: 0;
  padding: clamp(24px, 5vh, 54px) 0 28px;
  color: #8a98ab;
  text-align: left;
}

.empty-chat-card {
  width: min(100%, 980px);
  padding: 0 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.empty-chat-card > strong,
.empty-chat-card > span {
  display: block;
}

.empty-chat p {
  margin: 12px 0 24px;
  max-width: 620px;
  color: #687a91;
  font-size: 14px;
  line-height: 1.6;
}

.empty-prompts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.empty-prompt {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid #d7e5f8;
  border-radius: 12px;
  color: #40536c;
  background: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.empty-prompt:hover {
  border-color: #8ab8f7;
  color: var(--blue-600);
  background: #eff6ff;
}

.empty-chat-card > strong {
  color: #233044;
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.empty-chat-card > span {
  margin-top: 8px;
  color: #5f7188;
  font-size: 13px;
  font-weight: 500;
}

.empty-chat-brand {
  display: block;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  object-fit: contain;
}

.empty-prompt-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin: auto;
  color: #1677ff;
}

.empty-prompt strong,
.empty-prompt small {
  display: block;
}

.empty-prompt strong {
  color: #2f4055;
  font-size: 12px;
  font-weight: 800;
}

.empty-prompt small {
  margin-top: 3px;
  color: #8795a8;
  font-size: 10px;
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 10px 14px;
  border: 1px solid #d5e5f7;
  border-radius: 10px;
  color: #1f2a3d;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 34px rgba(22, 55, 98, 0.14);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .chat-canvas {
    padding-right: 34px;
    padding-left: 34px;
  }

  .composer {
    margin-right: 34px;
    margin-left: 20px;
  }

  .poster-grid {
    gap: 10px;
  }
}

@media (max-height: 820px) {
  .topbar {
    flex-basis: 58px;
  }

  .chat-canvas {
    padding-top: 16px;
    padding-bottom: 12px;
  }

  .assistant-card {
    padding: 14px 16px 12px;
  }

  .assistant-card ul {
    margin-bottom: 12px;
    line-height: 1.5;
  }

  .poster-grid figure {
    max-height: none;
  }

  .result-actions {
    margin-top: 10px;
  }

  .input-shell {
    min-height: 94px;
    padding: 12px 16px;
  }

  textarea {
    min-height: 30px;
  }

  .mode-button,
  .generate-button {
    height: 44px;
  }
}

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

  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 120;
    display: grid;
    width: min(86vw, var(--sidebar-width));
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: 24px 0 52px rgba(15, 35, 68, 0.2);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop,
  .popover-backdrop {
    position: absolute;
    inset: 0;
    z-index: 110;
    display: block;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
  }

  .popover-backdrop {
    position: fixed;
    z-index: 80;
  }

  .sidebar-close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border-radius: 10px;
    color: #53657b;
    background: transparent;
  }

  .topbar {
    gap: 6px;
    padding: 0 10px;
  }

  .mobile-sidebar-toggle {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 10px;
    color: var(--blue-600);
    background: #edf5ff;
  }

  .title-button {
    min-width: 0;
    font-size: 15px;
  }

  .title-button .title-text {
    max-width: 30vw;
  }

  .chat-canvas {
    padding: 24px 18px 18px;
  }

  .composer {
    margin: 0 10px 10px;
  }

  .composer-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .generation-actions {
    display: grid;
    grid-template-columns: minmax(118px, 1.35fr) repeat(2, minmax(64px, 1fr)) minmax(74px, auto);
    gap: 6px;
    width: 100%;
  }

  .generation-actions.has-credit-estimate .credit-estimate-chip {
    grid-row: 1;
    grid-column: 1 / -1;
    justify-self: end;
  }

  .generation-actions.has-credit-estimate .chat-model-control {
    grid-row: 2;
    grid-column: 1;
  }

  .generation-actions.has-credit-estimate #imageModeBtn {
    grid-row: 2;
    grid-column: 2;
  }

  .generation-actions.has-credit-estimate #videoModeBtn {
    grid-row: 2;
    grid-column: 3;
  }

  .generation-actions.has-credit-estimate .generate-button {
    grid-row: 2;
    grid-column: 4;
  }

  .chat-model-control {
    grid-row: 1;
    grid-column: 1;
  }

  .generate-button {
    grid-row: 1;
    grid-column: 4;
  }

  .utility-actions {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .composer-status {
    max-width: none;
  }

  .input-shell {
    min-height: 136px;
    padding: 12px;
  }

  .mode-button {
    min-width: 0;
    padding: 0 6px;
    gap: 5px;
  }

  .mode-label-long {
    display: none;
  }

  .mode-label-short {
    display: inline;
  }

  .chat-mode-button {
    min-width: 0;
  }

  .chat-mode-button .mode-label-long,
  .chat-mode-divider {
    display: none;
  }

  .chat-current-model {
    max-width: 76px;
    font-size: 10px;
  }

  .chevron {
    display: none;
  }

  .generate-button {
    min-width: 74px;
    padding: 0 10px;
  }

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

  .model-popover {
    position: fixed;
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 130;
    width: 100%;
    max-height: min(72vh, 620px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 14px max(16px, env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .model-popover[data-anchor="image"],
  .model-popover[data-anchor="video"] {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: min(72vh, 620px);
    max-height: min(72vh, 620px);
    overflow: hidden;
  }

  .image-popover-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 auto;
    gap: 6px;
    margin-bottom: 8px;
    padding: 4px;
    border-radius: 10px;
    background: #f2f6fb;
  }

  .image-popover-tabs button {
    min-height: 36px;
    border-radius: 8px;
    color: #66788f;
    background: transparent;
    font-size: 12px;
    font-weight: 800;
  }

  .image-popover-tabs button.active {
    color: #0f6fff;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(28, 74, 132, 0.1);
  }

  .image-popover-layout {
    display: block;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  .image-model-pane,
  .image-settings-pane {
    height: 100%;
  }

  .image-model-pane {
    padding-right: 0;
    border-right: 0;
  }

  .model-popover[data-image-tab="models"] [data-image-pane="parameters"],
  .model-popover[data-image-tab="parameters"] [data-image-pane="models"] {
    display: none;
  }

  .image-pane-heading {
    display: none;
  }

  .image-settings-pane > .parameter-panel {
    padding: 6px 0 12px;
  }

  .pricing-summary {
    margin: auto -2px 0;
    padding: 10px 4px 4px;
    box-shadow: 0 -8px 18px rgba(37, 76, 129, 0.06);
  }

  .model-popover::after {
    display: none;
  }

  .popover-mobile-header {
    position: sticky;
    top: -12px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -2px -2px 8px;
    padding: 4px 2px 10px;
    border-bottom: 1px solid #edf3fb;
    background: rgba(255, 255, 255, 0.98);
  }

  .popover-mobile-header strong {
    font-size: 15px;
  }

  .popover-close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    color: #526176;
    background: #f3f7fc;
  }

  .parameter-group {
    grid-template-columns: 72px 1fr;
  }

  .advanced-field {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .parameter-chip {
    min-width: 44px;
    height: 36px;
  }

  .result-actions button,
  .utility-actions button {
    width: 44px;
    height: 44px;
  }

  .empty-chat {
    min-height: 0;
    padding: 24px 0;
  }

  .empty-chat-card {
    padding: 0 4px;
  }

  .empty-prompts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  :root {
    --work-nav-height: 94px;
  }
}

@media (max-width: 600px) {
  .empty-prompts {
    grid-template-columns: 1fr;
  }

  .chat-model-menu,
  .attachment-menu {
    width: min(290px, calc(100vw - 44px));
  }

  .external-reference-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .external-url-input,
  .external-reference-form .structured-add {
    grid-column: 1 / -1;
  }

  .structured-row {
    grid-template-columns: 24px minmax(0, 1fr) 58px 28px;
  }
}

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

.search-box .ui-icon,
.trash .ui-icon,
.title-button .ui-icon {
  width: 13px;
  height: 13px;
}

.result-actions button .ui-icon,
.utility-actions button .ui-icon,
.generate-button .ui-icon {
  width: 16px;
  height: 16px;
}

.row-thumb {
  overflow: hidden;
  color: #1474ff;
}

.row-thumb img,
.mode-thumb,
.model-mark img {
  display: none;
}

.row-thumb .ui-icon {
  width: 13px;
  height: 13px;
}

.row-action .ui-icon,
.trash-actions button .ui-icon {
  width: 12px;
  height: 12px;
}

.trash {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.trash-back-icon {
  transform: rotate(90deg);
}

.mode-icon {
  width: 17px;
  height: 17px;
}

.chevron {
  width: 14px;
  height: 14px;
}

.model-mark .ui-icon {
  width: 15px;
  height: 15px;
}
