:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f0f4f7;
  --text: #17191f;
  --muted: #667080;
  --line: #dde3ea;
  --line-strong: #c7d0da;
  --accent: #e0477b;
  --accent-strong: #bd2d61;
  --accent-soft: #fff0f5;
  --teal: #0f9b8e;
  --warning: #b46b00;
  --danger: #b3261e;
  --shadow: 0 18px 48px rgba(35, 43, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  overflow: hidden;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
textarea {
  border-radius: 8px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.hidden {
  display: none !important;
}

.app-shell {
  --resource-header-offset: 0px;
  position: relative;
  display: block;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  position: absolute;
  top: 0;
  right: var(--resource-header-offset);
  left: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  height: 62px;
  padding: 0 22px 0 292px;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  transition: right 0.18s ease;
}

.topbar .brand {
  display: none;
}

.topbar-actions {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  font-weight: 760;
}

.brand img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
}

.brand-mark,
.xlike-logo-shell {
  --xlike-logo-size: 56px;
  --xlike-logo-height: 40px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  box-sizing: border-box;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--xlike-logo-size);
  min-width: var(--xlike-logo-size);
  height: var(--xlike-logo-height);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(126, 153, 255, 0.26);
  border-radius: 13px;
  background:
    radial-gradient(circle at 36% 18%, rgba(105, 240, 255, 0.13), transparent 36%),
    linear-gradient(145deg, rgba(17, 23, 54, 0.78), rgba(6, 9, 28, 0.72));
  color: transparent;
  font-size: 0;
  letter-spacing: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -10px 22px rgba(25, 39, 92, 0.24),
    0 0 18px rgba(79, 109, 255, 0.18);
  transform-origin: 50% 60%;
  animation: xlike-logo-enter 800ms ease-out both;
}

.xlike-logo-shell::before {
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), transparent 42%);
  content: "";
  pointer-events: none;
}

.xlike-logo-mark {
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: block;
  width: min(56px, calc(var(--xlike-logo-size) - 2px));
  max-height: calc(var(--xlike-logo-size) - 10px);
  overflow: visible;
  aspect-ratio: 330 / 128;
  line-height: 0;
}

.xlike-logo-mark::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("assets/brand/xlike-logo.webp") center / contain no-repeat;
  content: "";
  filter: brightness(0) saturate(100%) invert(24%) sepia(78%) saturate(926%) hue-rotate(166deg) brightness(82%) contrast(96%);
  opacity: 0.46;
  transform: translate(-3px, 3px) scale(1.018);
  transform-origin: center;
  pointer-events: none;
}

.xlike-logo-image {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.24));
  pointer-events: none;
  user-select: none;
}

.xlike-logo-edge {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  mix-blend-mode: screen;
  pointer-events: none;
}

.xlike-logo-edge-trace {
  fill: none;
  stroke: rgba(99, 224, 255, 0.14);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.xlike-logo-edge-spark {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(235, 255, 255, 0.98) 0 18%, rgba(91, 235, 255, 0.96) 34%, rgba(35, 190, 255, 0.72) 56%, rgba(35, 190, 255, 0) 74%);
  box-shadow:
    0 0 6px rgba(118, 244, 255, 0.9),
    0 0 13px rgba(39, 190, 255, 0.6);
  opacity: 0;
  offset-anchor: 50% 50%;
  offset-path: path("M 3.3 12 L 9 4 L 14.6 4.1 L 11.9 7.7 L 16.9 13.1 L 11.1 13.3 L 8.4 9.6 L 3.3 13.5 L 0.9 12.2 L 6.1 8.1 L 2.5 4.2 L 7.7 4.2 L 10.1 6.8 L 12.7 4 L 19.7 4 L 19.7 12 L 24.9 12 L 25.3 4 L 30.4 4 L 29.7 7.7 L 34.3 4 L 40.4 4 L 36.3 7.4 L 42.4 7.4 L 41.7 9.5 L 35.3 9.6 L 34.3 11.9 L 42.6 12 L 41.7 14.1 L 31.3 14.1 L 31.7 9.9 L 26.8 14.1 L 22.1 14.1 L 23 4.1 L 21.9 14.1 L 16.1 14.1 L 11.9 8.9 L 6.2 14.1 L 1.4 14.1 Z");
  offset-distance: 0%;
  offset-rotate: auto;
  pointer-events: none;
  will-change: offset-distance, opacity;
  animation: xlike-logo-edge-run 8s linear 1.15s infinite;
}

@keyframes xlike-logo-enter {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.88);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes xlike-logo-edge-run {
  0% {
    opacity: 0.82;
    offset-distance: 0%;
  }

  100% {
    opacity: 0.82;
    offset-distance: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xlike-logo-shell {
    animation: none;
  }

  .xlike-logo-edge,
  .xlike-logo-edge-spark {
    display: none;
  }
}

.brand-mark.xlike-logo-shell {
  animation: none;
  opacity: 1;
  transform: none;
}

.sidebar-brand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 4px;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.sidebar-home-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transform: translateY(-4px);
}

.sidebar-home-link:focus-visible,
.sidebar-collapsed-home:focus-visible {
  outline: 2px solid rgba(88, 69, 255, 0.34);
  outline-offset: 3px;
}

.sidebar-brand-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-collapsed-home {
  display: none;
}

.sidebar-toggle-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #7f8894;
  padding: 0;
}

.sidebar-toggle-mark:hover {
  background: rgba(23, 25, 31, 0.06);
  color: #475467;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  margin: 8px 0 22px;
  padding: 0 2px;
}

.sidebar-nav-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  gap: 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #17191f;
  padding: 0 10px;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}

.sidebar-nav-button:hover,
.sidebar-nav-button:focus-visible,
.sidebar-nav-button.active {
  background: #f2f3f5;
  color: #101828;
}

.sidebar-nav-button:focus-visible {
  outline: 2px solid rgba(88, 69, 255, 0.26);
  outline-offset: 2px;
}

.sidebar-nav-icon {
  display: inline-flex;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  color: currentColor;
}

.sidebar-nav-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-toggle-mark > .sidebar-toggle-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 17px;
  border: 1.8px solid currentColor;
  border-radius: 5px;
}

.sidebar-toggle-mark > .sidebar-toggle-icon::before {
  content: "";
  position: absolute;
  top: -1.8px;
  left: 5px;
  bottom: -1.8px;
  width: 1.8px;
  background: currentColor;
}

.sidebar-toggle-mark > .sidebar-toggle-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 2px;
  width: 6px;
  height: 6px;
  border-left: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.sidebar-collapsed-logo.xlike-logo-shell {
  display: none;
  animation: none;
  opacity: 1;
  transform: none;
}

.workspace.sidebar-collapsed .settings-panel {
  overflow: visible;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  background: transparent;
  pointer-events: none;
}

.workspace.sidebar-collapsed .sidebar-brand {
  display: block;
  min-height: 0;
  padding: 0;
}

.workspace.sidebar-collapsed .sidebar-home-link,
.workspace.sidebar-collapsed .sidebar-nav,
.workspace.sidebar-collapsed .history-group {
  display: none;
}

.workspace.sidebar-collapsed .sidebar-collapsed-home {
  position: fixed;
  top: 18px;
  left: 27px;
  z-index: 60;
  display: inline-flex;
  width: 56px;
  height: 40px;
  border-radius: 13px;
  pointer-events: auto;
}

.workspace.sidebar-collapsed .sidebar-toggle-mark {
  position: fixed;
  top: 32px;
  left: 92px;
  z-index: 60;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #7f8894;
  box-shadow: none;
  pointer-events: auto;
}

.workspace.sidebar-collapsed .sidebar-toggle-mark:hover {
  background: rgba(23, 25, 31, 0.06);
  color: #475467;
}

.workspace.sidebar-collapsed .sidebar-toggle-mark > .sidebar-toggle-icon {
  display: block;
}

.workspace.sidebar-collapsed .sidebar-toggle-mark::before {
  content: none;
}

.workspace.sidebar-collapsed .sidebar-collapsed-home .sidebar-collapsed-logo.xlike-logo-shell {
  display: inline-flex;
  --xlike-logo-size: 56px;
  --xlike-logo-height: 40px;
}

.workspace.sidebar-collapsed .sidebar-toggle-mark::after {
  content: "展开历史";
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  min-width: 64px;
  padding: 6px 9px;
  border-radius: 8px;
  background: #17191f;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.workspace.sidebar-collapsed .sidebar-toggle-mark:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

.topbar-actions,
.button-row,
.composer-actions,
.action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions[hidden] {
  display: none !important;
}

.agent-notice {
  position: absolute;
  left: 330px;
  right: 174px;
  overflow: hidden;
  color: #687184;
  font-size: 16px;
  line-height: 36px;
  white-space: nowrap;
  pointer-events: none;
}

.agent-notice span {
  display: inline-block;
  min-width: 100%;
  padding-left: 100%;
  text-align: center;
  animation: agent-notice-scroll 16s linear infinite;
}

@keyframes agent-notice-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
  .agent-notice span {
    padding-left: 0;
    animation: none;
  }
}

@media (max-width: 820px) {
  .agent-notice {
    display: none;
  }
}

.agent-language {
  position: relative;
  width: 138px;
  pointer-events: auto;
}

.agent-language-button {
  position: relative;
  display: flex;
  width: 100%;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  color: #17191f;
  font-size: 16.9px;
  font-weight: 650;
  cursor: pointer;
}

.agent-language-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.agent-language-button [data-agent-language-label] {
  min-width: 0;
  line-height: 1;
  white-space: nowrap;
}

.agent-language-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: 100%;
  max-height: 360px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(33, 38, 50, 0.14);
}

.agent-language-dropdown[hidden] {
  display: none;
}

.agent-language-dropdown button {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #17191f;
  font-size: 15.7px;
  text-align: center;
  cursor: pointer;
}

.agent-language-dropdown button:hover,
.agent-language-dropdown button.active {
  background: #f0f1f3;
}

.plain-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 680;
}

.plain-link:hover {
  text-decoration: underline;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-chip.ok {
  border-color: rgba(15, 155, 142, 0.24);
  background: rgba(15, 155, 142, 0.08);
  color: var(--teal);
}

.status-chip.error {
  border-color: rgba(179, 38, 30, 0.26);
  background: rgba(179, 38, 30, 0.08);
  color: var(--danger);
}

.status-chip.muted {
  background: var(--surface-soft);
}

.workspace {
  --resource-width: 420px;
  --storyboard-chat-width: 300px;
  --storyboard-detail-width: 48vw;
  --chat-rail-width: 820px;
  --chat-rail-offset-x: -57px;
  --history-sidebar-width: 304px;
  --history-sidebar-collapsed-width: 0px;
  --splitter-track-width: 8px;
  display: grid;
  grid-template-columns: var(--history-sidebar-width) minmax(620px, 1fr) 0;
  gap: 0;
  min-height: 0;
  height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 8px 0.2cm 8px 8px;
  transition: grid-template-columns 0.18s ease;
}

.workspace.resource-open {
  grid-template-columns: var(--history-sidebar-width) minmax(300px, 1fr) var(--splitter-track-width) minmax(320px, var(--resource-width));
}

.workspace.sidebar-collapsed {
  grid-template-columns: var(--history-sidebar-collapsed-width) minmax(620px, 1fr) 0;
}

.workspace.sidebar-collapsed.resource-open {
  grid-template-columns: var(--history-sidebar-collapsed-width) minmax(300px, 1fr) var(--splitter-track-width) minmax(320px, var(--resource-width));
}

.workspace:not(.sidebar-collapsed):not(.storyboard-open) {
  --chat-rail-offset-x: 0px;
}

.workspace:not(.sidebar-collapsed):not(.storyboard-open) .message-stream {
  padding-left: 11px;
  padding-right: 11px;
}

.workspace:not(.sidebar-collapsed):not(.storyboard-open) .message,
.workspace:not(.sidebar-collapsed):not(.storyboard-open) .composer {
  width: calc(var(--chat-rail-width) + 32px);
}

.workspace.storyboard-open {
  --chat-rail-offset-x: 0px;
  --chat-rail-width: 100%;
  grid-template-columns: var(--storyboard-chat-width) var(--splitter-track-width) minmax(420px, 1fr) minmax(420px, var(--storyboard-preview-width));
}

.workspace.resource-open.storyboard-open,
.workspace.sidebar-collapsed.resource-open.storyboard-open {
  grid-template-columns: var(--storyboard-chat-width) var(--splitter-track-width) minmax(420px, 1fr) minmax(420px, var(--storyboard-preview-width));
}

.workspace.storyboard-open .settings-panel {
  display: none;
}

.workspace.storyboard-open .chat-panel {
  grid-column: 1;
  padding-top: 64px;
}

.workspace.storyboard-open .message-stream {
  padding: 18px 6px 132px;
}

.workspace.storyboard-open .message {
  width: calc(100% - 10px);
  max-width: none;
  margin-right: auto;
  margin-left: auto;
  transform: none;
}

.workspace.storyboard-open .bubble {
  max-width: 100%;
}

.workspace.storyboard-open .message-text {
  font-size: 14px;
  line-height: 1.65;
}

.workspace.storyboard-open .composer {
  width: calc(100% - 10px);
  margin: 0 auto 12px;
  transform: none;
  border-radius: 18px;
  padding: 10px;
}

.workspace.storyboard-open .composer textarea {
  min-height: 84px;
  padding: 8px 6px;
}

.workspace.storyboard-open .composer-actions {
  gap: 8px;
}

.workspace.storyboard-open .composer-control-slot,
.workspace.storyboard-open .composer-control-slot.duration {
  flex: 1 1 calc(50% - 4px);
  width: auto;
  min-width: 0;
}

.workspace.storyboard-open .composer-control-slot.wide {
  flex: 1 1 100%;
  min-width: 0;
}

.workspace.storyboard-open .composer-actions #sendButton {
  flex: 1 1 100%;
  margin-left: 0;
}

.settings-panel,
.chat-panel,
.resource-panel {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: -8px -0.1cm -0.1cm;
  border: 1px solid rgba(221, 227, 234, 0.82);
  border-radius: 0 0 8px 8px;
  background: #fff;
  padding: 20px 12px 18px 18px;
  overflow: auto;
}

.settings-panel .session-box,
.settings-panel .control-group,
.settings-panel .upload-group,
.settings-panel .action-group {
  display: none;
}

.chat-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 62px;
  background: linear-gradient(to bottom, #fff 0 62px, #f0f1f3 62px 100%);
}

.asset-library-view[hidden] {
  display: none;
}

.asset-library-view {
  position: absolute;
  inset: 62px 0 0;
  z-index: 55;
  overflow: auto;
  background: #f5f6f7;
  padding: 34px clamp(28px, 4vw, 72px) 54px;
}

.chat-panel.asset-library-open > :not(.asset-library-view) {
  visibility: hidden;
  pointer-events: none;
}

.workspace.asset-library-active .resource-toggle-button,
.workspace.asset-library-active .resource-panel {
  display: none;
}

.asset-library-head,
.asset-library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.asset-library-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.asset-library-tabs,
.asset-library-filters,
.asset-library-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.asset-library-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.asset-library-tabs,
.asset-library-filters {
  flex: 0 0 auto;
  border-radius: 6px;
  background: #eceeef;
  padding: 3px;
}

.asset-library-tabs button,
.asset-library-filters button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0 18px;
  color: #5d6570;
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
}

.asset-library-tabs button.active,
.asset-library-filters button.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.08);
}

.asset-library-add {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: #111;
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
}

.asset-library-add-icon {
  display: inline-block;
  font-size: 130%;
  line-height: 1;
  vertical-align: -0.04em;
}

.asset-library-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 190px;
  min-height: 40px;
  border: 1px solid #d9dee5;
  border-radius: 8px;
  background: #fff;
  padding: 0 14px;
}

.asset-library-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.asset-library-toolbar {
  margin: 18px 0 22px;
  flex-wrap: wrap;
}

.asset-library-sort {
  flex: 0 0 132px;
  width: 132px;
  min-height: 40px;
  border: 1px solid #d9dee5;
  border-radius: 8px;
  background: #fff;
  padding: 0 14px;
  cursor: pointer;
}

.asset-library-view-control {
  position: relative;
  flex: 0 0 auto;
}

.asset-library-view-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 88px;
  min-height: 40px;
  border: 1px solid #d9dee5;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
}

.asset-library-view-button:hover,
.asset-library-view-button[aria-expanded="true"] {
  background: #eceeef;
}

.asset-library-view-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 244px;
  border: 1px solid #dde1e7;
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px 16px;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.14);
}

.asset-library-view-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
}

.asset-library-view-title span {
  color: #7b8490;
}

.asset-library-view-popover input[type="range"] {
  width: 100%;
  accent-color: #111827;
  cursor: ew-resize;
}

.asset-library-grid {
  --asset-card-min-width: 190px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--asset-card-min-width)), 1fr));
  gap: 26px 18px;
}

.asset-library-card {
  min-width: 0;
  cursor: default;
}

.asset-library-card[data-history-key] {
  cursor: pointer;
}

.asset-library-card[data-media-preview] {
  cursor: pointer;
}

.asset-detail-open {
  overflow: hidden;
}

.asset-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 18, 0.42);
}

.asset-detail-modal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 255px;
  width: min(1180px, calc(100vw - 40px));
  height: min(760px, calc(100vh - 40px));
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(8, 12, 18, 0.3);
}

.asset-detail-media-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 28px;
  background: #000;
}

.asset-detail-media {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  border-radius: 10px;
}

.asset-detail-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  padding: 28px 24px 24px;
  border-left: 1px solid #e7e8eb;
  background: #fff;
}

.asset-detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f2f3f5;
  color: #20242b;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.asset-detail-close:hover {
  background: #e8e9ec;
}

.asset-detail-row {
  display: grid;
  gap: 7px;
  padding-right: 34px;
}

.asset-detail-label {
  color: #9298a1;
  font-size: 13px;
}

.asset-detail-value {
  overflow: hidden;
  color: #1b1f25;
  font-size: 15px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-detail-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  margin-top: auto;
  border-radius: 22px;
  background: #000;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.asset-detail-download svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.asset-detail-download:hover {
  background: #242424;
}

@media (max-width: 760px) {
  .asset-detail-backdrop {
    padding: 10px;
  }

  .asset-detail-modal {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .asset-detail-sidebar {
    max-height: 230px;
    overflow: auto;
    border-top: 1px solid #e7e8eb;
    border-left: 0;
  }
}

.asset-library-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 8px;
  background: #e8eaec;
}

.asset-library-preview img,
.asset-library-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-library-fallback {
  color: #7b8490;
  font-size: 18px;
  font-weight: 750;
}

.asset-library-card-info {
  display: grid;
  gap: 5px;
  padding: 10px 2px 0;
}

.asset-library-card-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.asset-library-card-info span {
  color: #939aa4;
  font-size: 12px;
}

.asset-library-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 360px;
  color: #8b929c;
}

.asset-library-empty strong {
  color: #4b5563;
  font-size: 18px;
}

@media (max-width: 900px) {
  .asset-library-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .asset-library-tabs,
  .asset-library-filters {
    max-width: 100%;
    overflow-x: auto;
  }
  .asset-library-actions,
  .asset-library-search {
    width: 100%;
  }
  .asset-library-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .asset-library-search {
    flex: 1 1 180px;
  }
  .asset-library-view-popover {
    right: auto;
    left: 0;
  }
  .asset-library-view {
    padding-inline: 18px;
  }
}

.workspace:not(.storyboard-open) .chat-panel {
  margin: -0.1cm;
}

.resource-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.resource-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.workspace.resource-open:not(.storyboard-open) .resource-panel.open {
  grid-column: 4;
}

.workspace.storyboard-open .resource-panel {
  grid-column: 3 / 5;
  display: grid;
  grid-template-columns: minmax(390px, 1fr) var(--splitter-track-width) minmax(420px, var(--storyboard-preview-width));
  grid-template-rows: auto minmax(0, 1fr);
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.workspace.storyboard-open .resource-head {
  grid-column: 1 / 4;
}

.workspace.storyboard-open .resource-list {
  grid-column: 1;
  grid-row: 2;
  padding: 14px 18px 18px 11px;
}

.workspace.storyboard-open .storyboard-detail-panel {
  grid-column: 3;
  grid-row: 2;
  display: grid;
  height: calc(100vh - 86px);
  max-height: calc(100vh - 86px);
  overflow: hidden;
}

.resource-toggle-button {
  position: absolute;
  right: 104px;
  top: 50%;
  bottom: auto;
  z-index: 45;
  width: auto;
  min-width: 0;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: rgba(234, 234, 235, 0.86);
  color: var(--text);
  box-shadow: none;
  padding: 0 24px;
  cursor: pointer;
  font-weight: 760;
  transform: translateY(-50%);
  touch-action: none;
  user-select: none;
}

.workspace.resource-open .resource-toggle-button {
  right: calc(var(--resource-width) + 5px);
  top: 62px;
  bottom: 0;
  width: 18px;
  min-width: 18px;
  min-height: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  padding: 0;
  cursor: col-resize;
  transform: none;
}

.workspace.storyboard-open .resource-toggle-button {
  left: calc(var(--storyboard-chat-width) + 5px);
  right: auto;
}

.resource-toggle-button::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(203, 211, 222, 0.92);
  transform: translateX(-50%);
}

.workspace.resource-open .resource-toggle-button::before {
  content: "";
}

.resource-toggle-button::after {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 22px;
  height: 38px;
  border: 1px solid rgba(203, 211, 222, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(31, 38, 52, 0.12);
  transform: translate(-50%, -50%);
}

.workspace.resource-open .resource-toggle-button::after {
  content: "›";
}

.resource-toggle-button:hover,
.resource-toggle-button.active {
  background: rgba(226, 226, 228, 0.96);
}

.workspace.resource-open .resource-toggle-button:hover,
.workspace.resource-open .resource-toggle-button.active {
  background: transparent;
  box-shadow: none;
}

.workspace.resource-open .resource-toggle-button.arrow-hover::after,
.workspace.resource-open .resource-toggle-button.active.arrow-hover::after {
  border-color: rgba(174, 184, 199, 0.95);
  box-shadow: 0 12px 28px rgba(31, 38, 52, 0.16);
}

.workspace.resource-open .resource-toggle-button.line-hover::before,
body.is-resizing-resource .resource-toggle-button::before {
  width: 2px;
  background: #6d5dfc;
}

.workspace.resource-open .resource-toggle-button.arrow-hover {
  cursor: pointer;
}

.resource-toggle-tooltip {
  display: none;
}

.workspace.resource-open .resource-toggle-tooltip {
  position: absolute;
  top: calc(50% - 58px);
  left: 50%;
  z-index: 2;
  display: block;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.workspace.resource-open .resource-toggle-button.arrow-hover .resource-toggle-tooltip {
  opacity: 1;
}

.storyboard-resize-button {
  display: none;
}

.workspace.storyboard-open .storyboard-resize-button {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  display: block;
  width: var(--splitter-track-width);
  min-width: var(--splitter-track-width);
  border: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}

.workspace.storyboard-open .storyboard-resize-button::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(203, 211, 222, 0.92);
  transform: translateX(-50%);
}

.workspace.storyboard-open .storyboard-resize-button:hover::before,
body.is-resizing-storyboard-preview .storyboard-resize-button::before {
  width: 2px;
  background: #6d5dfc;
}

body.is-resizing-resource {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing-storyboard-preview {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing-resource .workspace {
  transition: none;
}

body.is-resizing-resource .resource-toggle-button {
  cursor: col-resize;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head.compact {
  margin-bottom: 10px;
}

h1,
h2,
p,
dl {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 760;
}

h2 {
  font-size: 15px;
  font-weight: 760;
}

.session-box,
.control-group,
.upload-group {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.id-list {
  display: grid;
  gap: 8px;
}

.id-list div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.id-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.id-list dd {
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.field,
.check-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.field-note {
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.control-group {
  display: grid;
  gap: 13px;
}

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

select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

select {
  min-height: 40px;
  padding: 0 10px;
}

textarea {
  min-height: 82px;
  max-height: 190px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 71, 123, 0.12);
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 38px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 760;
}

.primary-button {
  min-width: 92px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover {
  background: var(--surface-soft);
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  background: transparent;
  color: var(--accent-strong);
}

.image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  min-height: 78px;
}

.image-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

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

.image-thumb span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  overflow: hidden;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 78px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.action-group {
  flex-wrap: wrap;
  align-items: center;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  color: var(--text);
}

.debug-details {
  display: none;
}

.debug-details summary {
  cursor: pointer;
  padding: 12px;
  color: var(--muted);
  font-weight: 760;
}

.json-summary {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}

.json-summary-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.json-summary-links a {
  color: var(--accent);
  font-weight: 760;
  text-decoration: none;
}

.json-summary-links a:hover {
  text-decoration: underline;
}

.debug-details pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 12px;
  color: #243140;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.tiny-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 22px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.history-group {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  border-bottom: 0;
  margin-top: -0.55cm;
  padding-bottom: 0;
}

.history-list {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  overflow: auto;
}

.history-empty,
.resource-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 8px 8px 8px 0;
  margin-left: -4px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  text-align: left;
}

.history-open-button {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.history-open-button:focus-visible {
  border-radius: 12px;
  outline: 2px solid rgba(111, 92, 255, 0.45);
  outline-offset: 2px;
}

.history-more-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #6d7582;
  cursor: pointer;
  font: 700 20px/1 Arial, sans-serif;
}

.history-more-button:hover,
.history-more-button:focus-visible,
.history-more-button[aria-expanded="true"] {
  background: rgba(23, 25, 31, 0.08);
  color: var(--text);
  outline: none;
}

.history-action-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  width: 154px;
  gap: 2px;
  border: 1px solid rgba(20, 27, 38, 0.12);
  border-radius: 16px;
  background: #fff;
  padding: 7px;
  box-shadow: 0 12px 30px rgba(20, 27, 38, 0.16);
}

.history-action-menu-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 0 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
}

.history-action-menu-item:hover,
.history-action-menu-item:focus-visible {
  background: #f2f4f7;
  outline: none;
}

.history-action-menu-item.danger {
  color: #e5484d;
}

.history-action-menu-item svg {
  width: 18px;
  height: 18px;
}

.history-rename-dialog {
  width: min(360px, calc(100vw - 32px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 18px 52px rgba(20, 27, 38, 0.2);
}

.history-rename-dialog::backdrop {
  background: rgba(20, 27, 38, 0.28);
}

.history-rename-dialog form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.history-rename-dialog h3 {
  margin: 0;
  font-size: 17px;
}

.history-rename-dialog input {
  width: 100%;
  height: 42px;
  border: 1px solid #cfd6df;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.history-rename-dialog input:focus {
  border-color: #6f5cff;
  box-shadow: 0 0 0 3px rgba(111, 92, 255, 0.12);
}

.history-rename-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.history-rename-actions button {
  min-width: 68px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.history-rename-cancel {
  background: #eef1f5;
  color: var(--text);
}

.history-rename-save {
  background: #e23d78;
  color: #fff;
}

.history-action-notice {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 150;
  transform: translateX(-50%);
  border-radius: 8px;
  background: rgba(23, 25, 31, 0.92);
  padding: 9px 14px;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(20, 27, 38, 0.16);
}

.history-item:hover,
.history-item:focus-visible,
.history-item.active,
.history-item.loading {
  background: rgba(23, 25, 31, 0.06);
}

.history-thumb {
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 10px;
  background: #eef1f5;
  flex: 0 0 42px;
}

.history-thumb img,
.history-thumb video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.history-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.history-body {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.history-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  display: block;
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.resource-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px 11px;
  border-bottom: 1px solid var(--line);
}

.resource-head h2 {
  font-size: 17px;
}

.resource-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.resource-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.resource-view-button,
.resource-close-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  padding: 0;
  font-weight: 780;
}

.resource-view-button.active {
  background: #fff;
  box-shadow: 0 6px 16px rgba(35, 43, 55, 0.08);
}

.resource-close-button {
  border-color: transparent;
  background: transparent;
  font-size: 20px;
  font-weight: 500;
}

.resource-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(200px, 22vw);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  color: var(--muted);
}

.resource-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.resource-list {
  display: block;
  overflow: auto;
  padding: 18px 18px 30px 11px;
  border-bottom: 0;
  background: transparent;
  scrollbar-gutter: stable;
}

.resource-list-item {
  display: grid;
  gap: 4px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  color: var(--text);
  text-align: left;
}

.resource-list-item.active {
  background: #f0e9ff;
}

.resource-list-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-list-meta {
  color: var(--muted);
  font-size: 12px;
}

.resource-section + .resource-section {
  margin-top: 20px;
}

.resource-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.resource-section-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

.resource-section-head span {
  color: #a0a8b4;
  font-size: 13px;
}

.resource-filter-pills {
  display: flex;
  gap: 8px;
  margin: -2px 0 10px;
}

.resource-filter-pills span {
  border: 1px solid rgba(128, 82, 255, 0.42);
  border-radius: 999px;
  background: #f4ecff;
  color: #6d43d9;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 720;
}

.resource-card-grid {
  display: grid;
  gap: 10px;
}

.resource-card-grid.image,
.resource-card-grid.video {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.resource-card-grid.json {
  grid-template-columns: repeat(auto-fill, minmax(260px, 340px));
}

.resource-card-grid.audio {
  grid-template-columns: repeat(auto-fill, minmax(88px, 92px));
  align-items: start;
}

.resource-media-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  color: #fff;
  text-decoration: none;
}

.resource-media-card img,
.resource-media-card video {
  display: block;
  width: 100%;
  height: 230px;
  background: #eef2f7;
}

.resource-media-card img {
  object-fit: contain;
}

.resource-media-card video {
  object-fit: cover;
}

.resource-media-card.video video {
  height: 250px;
}

.resource-format-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  border-radius: 4px;
  background: #fff;
  color: #f97316;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 860;
}

.resource-media-card.video .resource-format-badge {
  color: #4f46e5;
}

.resource-audio-card {
  display: grid;
  width: 88px;
  min-height: 82px;
  overflow: hidden;
  border: 1px solid #d8e1ef;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text);
  padding: 5px;
  text-decoration: none;
  cursor: pointer;
}

.resource-audio-waveform {
  display: grid;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px dashed #d7dee8;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  padding: 0;
}

.resource-audio-waveform i {
  display: none;
}

.resource-audio-waveform::before {
  content: "\25B6";
  font-size: 14px;
}

.resource-audio-meta {
  display: block;
  min-width: 0;
  padding: 5px 0 0;
  text-align: center;
}

.resource-audio-player {
  display: none;
}

.resource-audio-meta b {
  display: none;
}

.resource-audio-meta span {
  overflow: hidden;
  display: block;
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-audio-meta small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-audio-card.is-error .resource-audio-waveform {
  border-color: #fecaca;
  color: #dc2626;
}

.resource-audio-card.is-error .resource-audio-waveform::before {
  content: "!";
}

.resource-media-overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  background: linear-gradient(180deg, rgba(12, 17, 26, 0), rgba(12, 17, 26, 0.62));
  padding: 28px 10px 8px;
  font-size: 12px;
}

.resource-media-overlay span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-doc-card {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(128, 82, 255, 0.18);
  border-radius: 10px;
  background: #fff;
  padding: 0;
  color: var(--text);
  text-align: left;
}

.resource-doc-card.with-preview {
  grid-template-rows: auto auto auto;
}

.resource-doc-card.with-preview .json-preview-strip {
  min-height: 96px;
}

.resource-doc-card.with-preview .json-preview-thumb img {
  width: 58px;
  height: 58px;
}

.resource-doc-card.active,
.resource-doc-card:hover {
  border-color: rgba(128, 82, 255, 0.58);
  box-shadow: 0 10px 28px rgba(75, 54, 142, 0.12);
}

.resource-doc-preview {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 92px;
  background: linear-gradient(90deg, #f2ebff 0 28%, #ece5ff 28% 54%, #f2ebff 54% 100%);
  padding: 14px 16px;
}

.resource-doc-preview span {
  justify-self: start;
  border-radius: 4px;
  background: #fff;
  color: #6d43d9;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 860;
}

.resource-doc-preview i {
  display: block;
  height: 5px;
  border-radius: 999px;
  background: rgba(129, 126, 149, 0.18);
}

.resource-doc-name {
  overflow: hidden;
  padding: 12px 12px 2px;
  font-size: 13px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-doc-meta {
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 12px;
}

.resource-detail-view {
  display: grid;
  gap: 16px;
  max-width: 1080px;
  padding: 8px 0 28px;
}

.resource-detail-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 34px;
}

.resource-detail-nav strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-back-button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 760;
}

.resource-back-button:hover {
  background: rgba(227, 232, 241, 0.72);
}

.resource-detail-note,
.resource-detail-error,
.resource-detail-raw,
.resource-markdown-view {
  margin: 0;
  border: 1px solid rgba(203, 211, 222, 0.76);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #273241;
  padding: 16px;
}

.resource-detail-error {
  border-color: rgba(248, 113, 113, 0.48);
  background: #fff1f2;
  color: #9f1239;
}

.resource-detail-raw {
  overflow: auto;
  min-height: 360px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.resource-markdown-view {
  line-height: 1.72;
}

.tool-json-detail {
  display: grid;
  gap: 14px;
}

.tool-json-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tool-json-field {
  min-width: 0;
  border: 1px solid rgba(203, 211, 222, 0.76);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
}

.tool-json-field.wide {
  grid-column: 1 / -1;
}

.tool-json-field h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.tool-json-field pre {
  margin: 0;
  overflow: auto;
  color: #1f2937;
  font: inherit;
  line-height: 1.62;
  white-space: pre-wrap;
}

.storyboard-detail-panel {
  display: none;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 24px 24px 24px 18px;
  background: rgba(255, 255, 255, 0.46);
}

.storyboard-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  color: var(--text);
  font-weight: 800;
}

.resource-viewer {
  min-height: 0;
  margin: 0;
  overflow: auto;
  border: 1px solid rgba(203, 211, 222, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: #26313f;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.resource-viewer.storyboard-resource-viewer {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  white-space: normal;
}

.storyboard-editor {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
}

.storyboard-editor-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.storyboard-editor-nav strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyboard-card {
  display: grid;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px 16px;
  box-shadow: 0 12px 34px rgba(31, 38, 52, 0.035);
}

.storyboard-card h3 {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  font-weight: 780;
}

.storyboard-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

.storyboard-asset-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.storyboard-asset-label {
  color: #6b7280;
  font-size: 13px;
  font-weight: 760;
}

.storyboard-asset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.storyboard-asset-chip {
  display: grid;
  grid-template-columns: 42px;
  justify-items: center;
  gap: 4px;
  min-width: 68px;
  border-radius: 10px;
  background: rgba(249, 250, 251, 0.92);
  padding: 6px;
  color: #4b5563;
  font-size: 12px;
}

.storyboard-asset-chip img,
.storyboard-asset-icon,
.storyboard-asset-image-fallback {
  width: 42px;
  height: 34px;
  border-radius: 7px;
  background: #eef2f7;
  object-fit: contain;
}

.storyboard-asset-icon {
  display: grid;
  place-items: center;
  color: #64748b;
}

.storyboard-asset-image-fallback {
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 820;
}

.storyboard-asset-name {
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyboard-asset-chip.audio {
  grid-template-columns: 76px;
  min-width: 88px;
  border: 1px solid rgba(226, 232, 240, 0.86);
  background: rgba(248, 250, 252, 0.94);
}

.storyboard-asset-chip.audio .storyboard-asset-name {
  max-width: 76px;
  font-size: 11px;
  text-align: center;
}

.storyboard-asset-audio-button {
  display: grid;
  place-items: center;
  width: 76px;
  height: 38px;
  border: 1px dashed #d6dbe6;
  border-radius: 9px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
}

.storyboard-asset-audio-button:hover,
.storyboard-asset-audio-button.is-playing {
  border-color: #a78bfa;
  background: #f5f3ff;
  color: #6d5dfc;
}

.storyboard-asset-audio-icon,
.storyboard-asset-audio-icon svg {
  display: block;
}

.storyboard-asset-audio-player,
.storyboard-asset-audio {
  display: none;
}

.storyboard-asset-chip.has-media-preview {
  cursor: pointer;
}

.storyboard-empty-text,
.storyboard-style-text {
  color: #64748b;
  font-size: 13px;
}

.storyboard-shot-list {
  display: grid;
  gap: 8px;
}

.storyboard-shot-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid rgba(203, 211, 222, 0.65);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 8px 10px;
}

.storyboard-shot-meta {
  color: #6d5dfc;
  font-size: 12px;
  font-weight: 780;
}

.storyboard-shot-desc {
  line-height: 1.65;
}

.storyboard-inline-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 160px;
  margin: 0 3px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 1px 7px 1px 3px;
  font-size: 12px;
  vertical-align: baseline;
}

.storyboard-inline-chip-thumb {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #e5e7eb;
  object-fit: cover;
}

.storyboard-inline-chip-fallback {
  display: inline-grid;
  place-items: center;
  color: #0369a1;
  font-size: 10px;
  font-weight: 820;
}

.storyboard-inline-chip.reference {
  background: #eef2ff;
  color: #4338ca;
}

.storyboard-inline-chip.location {
  background: #ecfdf5;
  color: #047857;
}

.storyboard-inline-chip.product {
  background: #fff7ed;
  color: #c2410c;
}

.media-preview-popover {
  position: fixed;
  z-index: 80;
  overflow: hidden;
  border: 1px solid rgba(203, 211, 222, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
}

.media-preview-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.92);
  padding: 9px 10px;
  color: #475569;
  font-size: 12px;
  font-weight: 760;
}

.media-preview-popover-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-preview-popover-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  padding: 0;
  cursor: pointer;
}

.media-preview-popover-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.media-preview-popover-body {
  display: grid;
  place-items: center;
  min-height: 120px;
  background: #f8fafc;
  padding: 12px;
}

.media-preview-popover.image img {
  max-width: 100%;
  max-height: 210px;
  object-fit: contain;
  border-radius: 8px;
}

.media-preview-popover.audio .media-preview-popover-body {
  min-height: 70px;
}

.media-preview-popover.audio audio {
  width: 100%;
  max-width: 280px;
}

.storyboard-voiceover-card textarea {
  min-height: 92px;
  resize: vertical;
  border: 1px solid rgba(203, 211, 222, 0.7);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
  color: var(--text);
  font: inherit;
  line-height: 1.6;
}

.storyboard-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.storyboard-preview-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 12px;
  height: 100%;
  min-height: 100%;
}

.storyboard-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #64748b;
  font-size: 13px;
}

.storyboard-preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 665px);
  height: 100%;
  max-height: 555px;
  min-height: 0;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  margin-top: -8px;
  border-radius: 16px;
  background: #e5e7eb;
  color: #8b8b8b;
}

.storyboard-preview-media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.storyboard-preview-media video,
.storyboard-preview-media img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
  box-sizing: border-box;
  background: #e5e7eb;
  object-fit: contain;
  object-position: center center;
  flex: 0 1 auto;
}

.storyboard-preview-media img {
  background: transparent;
}

.storyboard-preview-image-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #9ca3af;
}

.storyboard-preview-shot-label,
.storyboard-preview-duration {
  position: absolute;
  border-radius: 5px;
  background: rgba(30, 33, 38, 0.86);
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 760;
}

.storyboard-preview-shot-label {
  top: 12px;
  left: 12px;
}

.storyboard-preview-duration {
  right: 12px;
  bottom: 12px;
}

.storyboard-timeline {
  display: grid;
  gap: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  padding: 14px 16px;
}

.storyboard-timeline-progress {
  display: grid;
  grid-template-columns: 28px minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.storyboard-play-button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 18px;
  padding: 0;
  cursor: pointer;
}

.storyboard-progress-track {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  cursor: pointer;
}

.storyboard-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: #8b5cf6;
}

.storyboard-progress-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
  transform: translate(-50%, -50%);
}

.storyboard-timeline-time {
  color: #64748b;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.storyboard-timeline-rail {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  overflow-x: auto;
  padding: 0 0 6px;
}

.storyboard-timeline-rail > .storyboard-insert-shot-button {
  margin-top: 32px;
}

.storyboard-timeline-rail > .storyboard-insert-shot-button:last-child {
  margin-right: 10px;
}

.storyboard-insert-shot-button {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid rgba(203, 211, 222, 0.95);
  border-radius: 999px;
  background: #fff;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  z-index: 1;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.storyboard-insert-shot-button > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
  pointer-events: none;
}

.storyboard-insert-shot-button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -58px;
  bottom: -58px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transform: translateX(-50%);
  z-index: -1;
}

.storyboard-insert-shot-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  max-width: 190px;
  white-space: nowrap;
  border-radius: 7px;
  background: #111827;
  color: #fff;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 4;
}

.storyboard-insert-shot-button:hover,
.storyboard-insert-shot-button:focus-visible {
  border-color: #22c55e;
  background: #22c55e;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
  outline: none;
}

.storyboard-insert-shot-button:hover::before,
.storyboard-insert-shot-button:focus-visible::before {
  background: #22c55e;
}

.storyboard-insert-shot-button:hover::after,
.storyboard-insert-shot-button:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.storyboard-timeline-shot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  min-width: 150px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.storyboard-timeline-thumb {
  position: relative;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 86px;
  margin: 0;
  border: 1px solid rgba(203, 211, 222, 0.9);
  border-radius: 10px;
  background: #f3f4f6;
  color: #9ca3af;
}

.storyboard-timeline-thumb video,
.storyboard-timeline-thumb img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
  box-sizing: border-box;
  background: #e5e7eb;
  object-fit: contain;
  object-position: center center;
  flex: 0 1 auto;
  pointer-events: none;
}

.storyboard-timeline-thumb img {
  background: transparent;
}

.storyboard-timeline-placeholder {
  display: grid;
  place-items: center;
}

.storyboard-delete-shot-button {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.86);
  color: #fff;
  padding: 0;
  cursor: pointer;
  opacity: 0.92;
}

.storyboard-delete-shot-button:hover,
.storyboard-delete-shot-button:focus-visible {
  background: #ef4444;
  outline: none;
}

.storyboard-timeline-shot.active .storyboard-timeline-thumb {
  border-color: #111827;
  box-shadow: inset 0 0 0 1px #111827;
}

.storyboard-timeline-shot > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyboard-timeline-shot small {
  justify-self: end;
  align-self: end;
  color: #9ca3af;
}

.json-card-list {
  display: grid;
  gap: 10px;
}

.json-resource-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: min(100%, 560px);
  border: 1px solid rgba(128, 82, 255, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f7f3ff);
  padding: 10px;
  color: var(--text);
  text-align: left;
}

.json-resource-card.with-preview {
  overflow: hidden;
  padding: 0;
}

.json-resource-card.with-preview .json-card-icon {
  margin-left: 10px;
  margin-bottom: 10px;
}

.json-resource-card.with-preview .json-card-body {
  margin-bottom: 10px;
}

.json-resource-card.with-preview .json-card-action {
  margin-right: 10px;
  margin-bottom: 10px;
}

.json-resource-card > span:nth-child(2) {
  min-width: 0;
  display: grid;
}

.json-card-body {
  min-width: 0;
  display: grid;
}

.json-preview-strip {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: 86px;
  overflow: hidden;
  background: linear-gradient(90deg, #f2ebff 0 28%, #ece5ff 28% 54%, #f2ebff 54% 100%);
}

.json-preview-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  border-radius: 4px;
  background: #fff;
  color: #6d43d9;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 860;
}

.json-preview-thumb {
  display: grid;
  place-items: center;
  min-width: 0;
  border-right: 1px solid rgba(128, 82, 255, 0.08);
}

.json-preview-thumb:last-child {
  border-right: 0;
}

.json-preview-thumb img {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(30, 41, 59, 0.12);
}

.json-preview-thumb.placeholder::before,
.json-preview-thumb.missing::before {
  content: "";
  display: block;
  width: 54px;
  height: 46px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.48);
}

.json-resource-card:hover {
  border-color: rgba(128, 82, 255, 0.58);
  box-shadow: 0 10px 28px rgba(75, 54, 142, 0.12);
}

.json-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #efe7ff;
  color: #6d43d9;
  font-size: 12px;
  font-weight: 860;
}

.json-card-title {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.json-card-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.json-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 8px;
  background: #efe7ff;
  color: #6d43d9;
  padding: 0 10px;
  font-weight: 760;
  text-align: center;
}

.chat-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 16px 18px;
  border-bottom: 0;
}

.chat-head h2 {
  font-size: 19px;
}

.chat-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.video-reconciliation-banner {
  width: min(var(--chat-rail-width), calc(100% - 44px));
  margin: 0 auto 8px;
  transform: translateX(var(--chat-rail-offset-x));
  border: 1px solid #efb45e;
  border-radius: 8px;
  background: #fff8e8;
  color: #5f3a08;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.55;
}

.video-reconciliation-banner[hidden] {
  display: none;
}

.video-reconciliation-banner strong,
.video-reconciliation-banner span {
  display: block;
}

.video-reconciliation-banner strong {
  margin-bottom: 2px;
  color: #9a4d00;
  font-size: 14px;
}

.video-reconciliation-hold {
  color: #b42318;
  font-weight: 700;
}

.workspace.storyboard-open .video-reconciliation-banner {
  width: calc(100% - 20px);
  transform: none;
}

.message-stream {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 18px;
  background: #f0f1f3;
}

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

.message {
  display: flex;
  gap: 10px;
  width: min(var(--chat-rail-width), calc(100% - 48px));
  margin: 0 auto 16px;
  transform: translateX(var(--chat-rail-offset-x));
}

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

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

.bubble {
  width: fit-content;
  max-width: min(760px, 88%);
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 0;
}

.message.user .bubble {
  border-color: transparent;
  background: transparent;
  padding: 0;
  margin-left: auto;
}

.message.assistant .message-meta,
.message.user .message-meta {
  justify-content: flex-end;
  margin-top: 6px;
}

.message-model-badges {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.message-model-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #e2e5eb;
  border-radius: 8px;
  background: #f6f7f9;
  color: #596273;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.message-text {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-text + .message-text {
  margin-top: 8px;
}

.user-reference-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 8px;
  width: auto;
  max-width: none;
  margin-left: auto;
}

.user-reference-thumb {
  flex: 0 0 auto;
  display: block;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 10px;
  background: #eef2f7;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

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

.message-text p {
  margin: 0;
}

.message-section-title {
  font-weight: 750;
}

.message-text p + p,
.message-text p + .summary-row,
.message-text p + .message-table-wrap,
.summary-row + .message-table-wrap,
.message-table-wrap + p,
.message-table-wrap + .summary-row,
.summary-row + p,
.summary-row + .summary-row {
  margin-top: 8px;
}

.message-table-wrap {
  max-width: min(780px, 100%);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  white-space: normal;
}

.message-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
  line-height: 1.55;
}

.message-table th,
.message-table td {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.message-table th:last-child,
.message-table td:last-child {
  border-right: 0;
}

.message-table tbody tr:last-child td {
  border-bottom: 0;
}

.message-table th {
  background: #f8fafc;
  color: #172033;
  font-weight: 750;
}

.summary-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.summary-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(96, 112, 128, 0.16);
  border-radius: 6px;
  background: #f3f7fb;
  color: #42627c;
}

.summary-icon.idea {
  background: #fff5df;
  color: #a46400;
}

.summary-icon.route {
  background: #edf7f3;
  color: #167055;
}

.summary-icon.plan {
  background: #f5efff;
  color: #6c43b7;
}

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

.summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-value {
  color: var(--text);
  overflow-wrap: anywhere;
}

.generation-message {
  margin-top: 4px;
}

.processing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  min-height: 22px;
  padding: 4px 6px;
}

.processing-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8f969f;
  animation: processing-dot-pulse 1.1s ease-in-out infinite;
}

.processing-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.processing-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes processing-dot-pulse {
  0%,
  60%,
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

.generation-hint {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.generation-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.generation-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #d6dde6;
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: generation-spin 0.8s linear infinite;
}

.generation-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}

.generation-line {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

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

.media-step-message {
  margin-top: 4px;
}

.media-step {
  display: grid;
  gap: 10px;
  max-width: min(760px, 92%);
}

.video-batch-step {
  width: min(560px, 92%);
  max-width: none;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 8px;
  background: #f8f9fb;
}

.video-batch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.video-batch-copy {
  display: grid;
  gap: 2px;
}

.video-batch-copy strong {
  color: var(--text);
  font-size: 15px;
}

.video-batch-copy span {
  color: var(--muted);
  font-size: 12px;
}

.video-batch-step .video-preview-grid {
  grid-template-columns: repeat(2, minmax(210px, 240px));
  align-items: start;
  justify-content: start;
}

.final-video-section {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.final-video-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.media-step-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.media-step-check {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #eefaf3;
  color: #16955a;
  font-size: 12px;
  font-weight: 900;
}

.media-step-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}

.media-step-summary {
  display: grid;
  gap: 6px;
  max-width: 720px;
  color: var(--text);
}

.media-step-summary .message-text {
  font-size: 15px;
  line-height: 1.75;
}

.video-progress-note {
  display: grid;
  gap: 6px;
  max-width: 720px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

.video-progress-note p {
  margin: 0;
}

.video-progress-pending {
  color: #9aa4b2;
}

@media (max-width: 720px) {
  .video-batch-step .video-preview-grid {
    grid-template-columns: 1fr;
  }

  .video-batch-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

.media-step-meta {
  margin-top: 0;
  justify-content: center;
}

.attachment-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.workflow-step-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-width: min(760px, 92%);
}

.workflow-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  max-width: min(100%, 520px);
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}

.workflow-step-icon {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.workflow-step-pill.running .workflow-step-icon {
  border: 2px solid #d6dde6;
  border-top-color: var(--accent-strong);
  background: transparent;
  animation: generation-spin 0.8s linear infinite;
}

.workflow-step-pill.done .workflow-step-icon {
  background: #eefaf3;
  color: #16955a;
}

.workflow-step-pill.error .workflow-step-icon {
  background: #fff1f2;
  color: #e11d48;
}

.workflow-step-label {
  white-space: nowrap;
}

.workflow-step-detail {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1014;
}

.media-card img,
.media-card video {
  display: block;
  width: 100%;
  background: #0e1014;
}

.media-card img {
  aspect-ratio: 1;
  object-fit: cover;
}

.media-card video {
  aspect-ratio: 9 / 16;
  max-height: 520px;
  object-fit: contain;
}

.media-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.media-caption span {
  flex: 1 1 100px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-caption a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 760;
}

.image-preview-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 220px));
  align-items: start;
  gap: 14px;
}

.image-preview-card {
  display: block;
  width: min(220px, 100%);
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: transparent;
  box-shadow: none;
  text-decoration: none;
}

.image-preview-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 5px;
  background: #e9edf2;
}

.video-preview-grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 240px));
  align-items: start;
  gap: 14px;
}

.video-preview-card {
  position: relative;
  width: min(240px, 100%);
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: #111317;
  box-shadow: none;
  cursor: pointer;
}

.video-preview-card video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 520px;
  object-fit: cover;
  background: #111317;
}

.video-preview-card:fullscreen,
.video-preview-card.is-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.video-preview-card:fullscreen video,
.video-preview-card.is-fullscreen video {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 0;
}

.video-preview-card:fullscreen .video-hover-toolbar,
.video-preview-card.is-fullscreen .video-hover-toolbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
}

.video-preview-card:fullscreen .video-playback-error,
.video-preview-card.is-fullscreen .video-playback-error {
  z-index: 2;
}

.video-playback-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  color: #fff;
  background: rgba(17, 19, 23, 0.92);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.video-playback-error[hidden] {
  display: none;
}

.video-hover-toolbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 7px;
  color: #fff;
  background: linear-gradient(180deg, rgba(7, 8, 10, 0), rgba(7, 8, 10, 0.9) 35%, rgba(7, 8, 10, 0.96));
  font-size: 12px;
}

.video-preview-card:not(:hover):not(:focus-within) .video-tool-button {
  opacity: 0;
  pointer-events: none;
}

.video-preview-card:hover .video-tool-button,
.video-preview-card:focus-within .video-tool-button {
  opacity: 1;
}

.video-duration-pill {
  min-width: 34px;
  color: #fff;
  font-weight: 780;
  line-height: 1;
}

.video-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.92);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.video-tool-button:hover,
.video-tool-button:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.video-tool-button svg {
  flex: 0 0 auto;
}

.confirm-card {
  border: 1px solid rgba(180, 107, 0, 0.28);
  border-radius: 8px;
  background: #fff9ed;
  padding: 12px;
}

.confirm-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.confirm-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.55;
}

.question-block {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.question-text {
  margin-bottom: 0 !important;
}

.question-input,
.question-select {
  width: min(100%, 620px);
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 0 10px;
}

.question-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 71, 123, 0.12);
}

.question-upload {
  width: min(100%, 620px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}

.question-upload-picker {
  width: 72px;
  height: 72px;
  border: 1px dashed rgba(113, 128, 150, 0.34);
  border-radius: 6px;
  background: rgba(248, 250, 252, 0.94);
  color: #111827;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.question-upload-picker span {
  font-size: 28px;
  line-height: 1;
  font-weight: 400;
}

.question-upload-picker strong {
  font-size: 12px;
  line-height: 1;
}

.question-upload-picker:hover {
  border-color: rgba(99, 102, 241, 0.45);
  background: #fff;
}

.question-upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.question-upload-file {
  min-height: 32px;
  max-width: 190px;
  border: 1px solid rgba(226, 232, 240, 0.98);
  border-radius: 8px;
  background: #fff;
  color: #111827;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 650;
  position: relative;
}

.question-upload-file img,
.question-upload-file video {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f7;
  flex: 0 0 auto;
}

.question-upload-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-upload-remove {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.76);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.question-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 71, 123, 0.12);
}

.question-textarea {
  min-height: 92px;
  padding-top: 9px;
  resize: vertical;
}

.question-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.question-error {
  margin-top: 10px !important;
  color: var(--danger) !important;
  font-weight: 720;
}

.command-box {
  max-height: 190px;
  overflow: auto;
  margin: 10px 0;
  border: 1px solid rgba(180, 107, 0, 0.22);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  color: #2b313a;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.choice-button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font-weight: 720;
}

.form-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 7px 10px;
}

.form-choice input {
  margin: 0;
}

.choice-button.selected {
  border-color: var(--accent);
  background: rgba(224, 71, 123, 0.1);
  color: var(--accent-strong);
}

.composer {
  display: grid;
  gap: 10px;
  position: relative;
  width: min(var(--chat-rail-width), calc(100% - 48px));
  margin: 0 auto 16px;
  transform: translateX(var(--chat-rail-offset-x));
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 54px rgba(33, 38, 50, 0.13);
  padding: 12px;
}

.composer-upload-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
  padding: 0 4px;
}

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

.composer-upload-chip {
  position: relative;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px rgba(123, 133, 151, 0.16);
  cursor: pointer;
}

.composer-upload-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.composer-upload-audio {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #596579;
  font-size: 18px;
}

.composer-upload-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.68);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.composer-upload-chip:hover .composer-upload-remove,
.composer-upload-chip:focus-visible .composer-upload-remove {
  opacity: 1;
}

.composer-mention-list {
  position: absolute;
  z-index: 24;
  inset: 0;
  min-height: 0;
  padding: 0;
  pointer-events: none;
}

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

.composer-mention-chip {
  position: absolute;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}

.composer-mention-chip img {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.composer-mention-chip span:not(.composer-mention-remove) {
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-mention-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.composer-mention-chip:hover {
  background: rgba(236, 240, 245, 0.72);
}

.composer-mention-chip:hover .composer-mention-remove,
.composer-mention-chip:focus-visible .composer-mention-remove {
  opacity: 1;
}

.asset-mention-panel {
  position: absolute;
  left: 24px;
  bottom: 62px;
  z-index: 30;
  width: min(280px, calc(100% - 48px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(33, 38, 50, 0.18);
  padding: 10px;
}

.asset-mention-panel[hidden] {
  display: none;
}

.asset-mention-title {
  padding: 4px 6px 8px;
  color: var(--muted);
  font-size: 13px;
}

.asset-mention-empty {
  padding: 8px 6px;
  color: var(--muted);
  font-size: 13px;
}

.asset-mention-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 5px 8px;
  text-align: left;
  color: var(--text);
  font: inherit;
}

.asset-mention-row > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-mention-row:hover,
.asset-mention-row:focus-visible,
.asset-mention-row.active {
  background: var(--surface-soft);
}

.asset-mention-row img,
.asset-mention-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.asset-mention-icon {
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--muted);
}

.asset-mention-suffix {
  color: var(--muted);
  font-size: 12px;
}

.composer textarea {
  min-height: 62px;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  box-shadow: none;
}

.composer textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

.composer select,
.composer .secondary-button,
.composer .icon-button {
  border-color: transparent;
  background: var(--surface-soft);
}

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

.composer-actions #sendButton {
  margin-left: auto;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  font-weight: 520;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.composer-plus-glyph {
  display: inline-block;
  font-size: 1.3em;
  line-height: 1;
  transform: translate(-0.01cm, -0.03cm);
}

.composer-control-slot {
  flex: 0 0 78px;
  width: 78px;
  min-width: 78px;
}

.composer-control-slot.wide {
  min-width: 205px;
}

.composer-control-slot.duration {
  flex-basis: 112px;
  width: 112px;
  min-width: 112px;
}

.composer-control-slot.resolution {
  flex-basis: 86px;
  width: 86px;
  min-width: 86px;
}

.composer-field {
  gap: 0;
  width: 100%;
}

.composer-field > span,
.composer-field .field-note {
  display: none;
}

.composer-field select {
  min-height: 38px;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
}

.ratio-picker-ready > #ratioSelect {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.ratio-picker {
  position: relative;
  width: 100%;
}

.ratio-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  min-height: 38px;
  border: 1px solid #dfe4ea;
  border-radius: 999px;
  padding: 0 12px;
  background: #f3f5f7;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.ratio-picker-trigger:hover,
.ratio-picker-trigger:focus-visible {
  border-color: #cbd3dc;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.08);
}

.ratio-picker-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 140ms ease;
}

.ratio-picker.is-open .ratio-picker-chevron {
  transform: translateY(2px) rotate(225deg);
}

.ratio-picker-menu {
  position: absolute;
  z-index: 80;
  bottom: calc(100% + 10px);
  left: 0;
  width: 176px;
  overflow: hidden;
  border: 1px solid #e1e5ea;
  border-radius: 14px;
  padding: 8px 4px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(24, 32, 48, 0.18);
}

.ratio-picker-menu[hidden] {
  display: none;
}

.ratio-picker-option {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  padding: 0 10px;
  background: transparent;
  color: #252a31;
  text-align: left;
}

.ratio-picker-option:hover,
.ratio-picker-option:focus-visible {
  background: #f2f4f7;
  outline: none;
}

.ratio-option-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
}

.ratio-option-icon::before {
  content: "";
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.ratio-option-icon[data-ratio-icon="16:9"]::before {
  width: 13px;
  height: 7px;
}

.ratio-option-icon[data-ratio-icon="9:16"]::before {
  width: 6px;
  height: 13px;
}

.ratio-option-icon[data-ratio-icon="4:3"]::before {
  width: 12px;
  height: 9px;
}

.ratio-option-icon[data-ratio-icon="3:4"]::before {
  width: 8px;
  height: 11px;
}

.ratio-option-icon[data-ratio-icon="1:1"]::before {
  width: 10px;
  height: 10px;
}

.ratio-option-label {
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ratio-option-check {
  color: #14171b;
  font-size: 16px;
  opacity: 0;
}

.ratio-picker-option.is-selected .ratio-option-check {
  opacity: 1;
}

.composer-field .smooth-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.smooth-select-shell {
  position: relative;
  width: 100%;
}

.smooth-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #dfe4ea;
  border-radius: 999px;
  background: #f3f5f7;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.smooth-select-trigger:hover,
.smooth-select-shell.is-open .smooth-select-trigger {
  border-color: #cbd3dc;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.08);
}

.smooth-select-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smooth-select-chevron {
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 140ms ease;
}

.smooth-select-shell.is-open .smooth-select-chevron {
  transform: translateY(2px) rotate(225deg);
}

.smooth-select-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 80;
  display: grid;
  gap: 4px;
  min-width: 100%;
  padding: 8px;
  border: 1px solid #e0e4e9;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 34px rgba(31, 42, 55, 0.16);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transform-origin: bottom left;
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 220ms;
}

.smooth-select-model .smooth-select-menu {
  width: 270px;
}

.smooth-select-resolution .smooth-select-menu {
  width: 124px;
}

.smooth-select-duration .smooth-select-menu {
  width: 132px;
}

.smooth-select-shell.is-open .smooth-select-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.smooth-select-option {
  position: relative;
  width: 100%;
  min-height: 38px;
  padding: 8px 32px 8px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  letter-spacing: 0;
  white-space: nowrap;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}

.smooth-select-option:hover,
.smooth-select-option[aria-selected="true"] {
  background: #f1f3f6;
}

.smooth-select-option[aria-selected="true"]::after {
  content: "✓";
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 700;
}

.composer-assist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 38px;
  min-height: 38px;
  border: 1px solid #dfe4ea;
  border-radius: 999px;
  padding: 0 12px;
  background: #f3f5f7;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.composer-assist:hover,
.composer-assist:focus-visible {
  border-color: #cbd3dc;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.08);
}

.composer {
  --agent-control-height: 38px;
  --agent-control-gap: 10px;
  --agent-control-font: "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  width: calc(var(--chat-rail-width) + 32px);
}

.composer-actions {
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--agent-control-gap);
  min-height: var(--agent-control-height);
  width: calc(100% - 16px);
  margin-left: 16px;
  padding-bottom: 4px;
}

.composer-actions #composerPlusButton.icon-button {
  width: var(--agent-control-height);
  height: var(--agent-control-height);
  flex: 0 0 var(--agent-control-height);
  border: 0;
  background: #f1f6fb;
  color: #10131d;
  font-size: 0;
  font-family: var(--agent-control-font);
  font-weight: 400;
  box-shadow: none;
}

.composer-actions #composerPlusButton.icon-button:hover,
.composer-actions #composerPlusButton.icon-button:focus-visible {
  background: #e9f1f8;
  box-shadow: none;
}

.composer-actions .composer-plus-glyph {
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-2px);
}

.composer-control-slot {
  width: 92px;
  min-width: 92px;
  flex: 0 0 92px;
  height: var(--agent-control-height);
}

.composer-control-slot.wide {
  width: 230px;
  min-width: 230px;
  flex-basis: 230px;
}

.composer-control-slot.resolution {
  width: 86px;
  min-width: 86px;
  flex-basis: 86px;
}

.composer-control-slot.duration {
  width: 82px;
  min-width: 82px;
  flex-basis: 82px;
}

.ratio-picker-trigger,
.smooth-select-trigger {
  height: var(--agent-control-height);
  min-height: var(--agent-control-height);
  border-color: #d9e1ea;
  background: #f7faff;
  color: #0f172a;
  font-family: var(--agent-control-font);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
}

.ratio-picker-trigger {
  justify-content: flex-start;
  gap: 7px;
  padding: 0 11px;
}

.ratio-picker-trigger .ratio-picker-chevron {
  display: none;
}

.ratio-trigger-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.smooth-select-trigger {
  gap: 8px;
  justify-content: flex-start;
  padding: 0 12px;
}

.smooth-select-trigger-label {
  font-family: var(--agent-control-font);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
}

.smooth-select-chevron {
  margin-left: auto;
}

.smooth-select-model .smooth-select-menu {
  width: 270px;
}

.composer-idea-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6d7785;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.composer-idea-button:hover,
.composer-idea-button:focus-visible {
  color: #3f4b5f;
  background: #eef3f7;
  outline: 0;
}

.composer-credit-rate {
  display: inline-flex;
  height: 28px;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: #5b6675;
  font-family: var(--agent-control-font);
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.composer-credit-rate-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  overflow: visible;
}

.composer-credit-rate-icon circle {
  fill: rgba(125, 226, 144, 0.16);
  stroke: rgba(92, 180, 111, 0.72);
  stroke-width: 1.6;
}

.composer-credit-rate-icon path {
  fill: #59b86d;
  filter: drop-shadow(0 0 4px rgba(101, 222, 126, 0.35));
}

.composer-actions #sendButton.primary-button {
  min-width: 92px;
  height: 36px;
  min-height: 36px;
  margin-left: auto;
  border-radius: 999px;
  padding: 0 22px;
  background: #5fc66b;
  color: #15412a;
  font-family: var(--agent-control-font);
  font-size: 16px;
  font-weight: 850;
  line-height: 1;
  box-shadow: none;
}

.composer-actions #sendButton.primary-button:hover,
.composer-actions #sendButton.primary-button:focus-visible {
  background: #6fdb85;
  box-shadow: none;
}

.composer-actions #sendButton.primary-button[data-mode="stop"] {
  background: #df477b;
  color: #fff;
}

.workspace.storyboard-open .composer-actions {
  flex-wrap: wrap;
}

.workspace.storyboard-open .composer-credit-rate {
  margin-left: auto;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .settings-panel,
  .chat-panel,
  .resource-panel {
    min-height: auto;
  }

  .chat-panel {
    height: min(820px, calc(100vh - 82px));
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 0 12px;
  }

  .topbar-actions .plain-link {
    display: none;
  }

  .workspace {
    padding: 10px;
    gap: 10px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

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

  .message-stream {
    padding: 12px;
  }

  .composer-actions,
  .action-group {
    align-items: stretch;
  }
}

body.asset-picker-open {
  overflow: hidden;
}

.asset-picker-modal[hidden] {
  display: none;
}

.asset-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
}

.asset-picker-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(35, 46, 49, 0.54);
  cursor: default;
}

.asset-picker-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(960px, calc(100vw - 28px));
  height: min(760px, calc(100vh - 28px));
  overflow: hidden;
  border: 1px solid #e2e5e9;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(20, 28, 34, 0.24);
}

.asset-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid #eceef1;
}

.asset-picker-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
}

.asset-picker-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f4f5f6;
  color: #20262d;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.asset-picker-toolbar {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
}

.asset-picker-filters {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: #f5f6f7;
}

.asset-picker-filters button,
.asset-picker-sort,
.asset-picker-upload,
.asset-picker-cancel,
.asset-picker-confirm {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #252b32;
  font: inherit;
  cursor: pointer;
}

.asset-picker-filters button {
  padding: 0 14px;
}

.asset-picker-filters button.active {
  background: #fff;
  box-shadow: 0 1px 5px rgba(31, 42, 55, 0.1);
  font-weight: 700;
}

.asset-picker-sort {
  padding: 0 10px;
  border-color: #dde2e7;
  background: #fff;
}

.asset-picker-upload {
  padding: 0 15px;
  border-color: #dde2e7;
  background: #fff;
  white-space: nowrap;
}

.asset-picker-search {
  display: flex;
  align-items: center;
  width: 230px;
  height: 36px;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid #dde2e7;
  border-radius: 18px;
  background: #fff;
}

.asset-picker-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
}

.asset-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-content: start;
  gap: 18px 14px;
  min-height: 0;
  overflow: auto;
  padding: 4px 20px 20px;
}

.asset-picker-card {
  position: relative;
  display: grid;
  grid-template-rows: 112px auto;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #20262d;
  text-align: left;
  cursor: pointer;
}

.asset-picker-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f4f5f6;
}

.asset-picker-card.selected .asset-picker-preview {
  border-color: #e33f76;
}

.asset-picker-preview img,
.asset-picker-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-picker-check {
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 9px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #d8dde2;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.92);
  color: #fff;
  font-size: 12px;
}

.asset-picker-card.selected .asset-picker-check {
  border-color: #e33f76;
  background: #e33f76;
}

.asset-picker-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}

.asset-picker-type-badge {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(24, 29, 35, 0.72);
  color: #fff;
  font-size: 11px;
}

.asset-picker-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 260px;
  color: #8b939d;
}

.asset-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 20px;
  border-top: 1px solid #eceef1;
  color: #7b838c;
}

.asset-picker-footer > div {
  display: flex;
  gap: 10px;
}

.asset-picker-cancel,
.asset-picker-confirm {
  min-width: 76px;
  padding: 0 18px;
}

.asset-picker-cancel {
  border-color: #dde2e7;
  background: #fff;
}

.asset-picker-confirm {
  background: #e33f76;
  color: #fff;
  font-weight: 700;
}

.asset-picker-confirm:disabled {
  background: #f2f3f4;
  color: #bdc2c8;
  cursor: not-allowed;
}

.composer-upload-chip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 840px) {
  .asset-picker-toolbar {
    grid-template-columns: 1fr auto;
  }

  .asset-picker-filters {
    grid-column: 1 / -1;
    overflow-x: auto;
  }

  .asset-picker-toolbar > :nth-child(2) {
    display: none;
  }

  .asset-picker-search {
    width: 100%;
  }

  .asset-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .asset-picker-modal {
    padding: 0;
  }

  .asset-picker-dialog {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

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