.cfg-creative {
  width: 100%;
  min-width: 0;
  color: var(--ink, #22242d);
}

.cfg-creative [hidden] {
  display: none !important;
}

.cfg-creative-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 24px;
}

.cfg-creative-heading h1 {
  margin: 0 0 5px;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -.04em;
}

.cfg-creative-heading p,
.cfg-creative-empty p {
  margin: 0;
  color: var(--muted, #686d7b);
  line-height: 1.6;
}

.cfg-creative-card {
  min-width: 0;
  background: var(--paper, #fff);
  border: 1px solid var(--edge, #e7e8ee);
  border-radius: 16px;
  box-shadow: var(--shadow, 0 5px 18px rgba(34, 36, 45, .025));
}

.cfg-creative-button,
.cfg-creative-chip {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 35px;
  padding: 7px 12px;
  border: 1px solid var(--edge, #e7e8ee);
  border-radius: 8px;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  background: var(--paper, #fff);
  cursor: pointer;
}

.cfg-creative-button:hover:enabled,
.cfg-creative-chip:hover:enabled {
  border-color: var(--cache-edge, #ddd8ec);
  background: var(--violet, #f2effa);
  color: var(--accent, #6b56c5);
}

.cfg-creative-button:disabled {
  cursor: default;
  opacity: .48;
}

.cfg-creative-button.cfg-creative-primary,
.cfg-creative-button.cfg-creative-primary:hover:enabled {
  border-color: transparent;
  background: #6953c4;
  color: #fff;
}

.cfg-creative-button.cfg-creative-primary:hover:enabled {
  background: #5b46b4;
}

.cfg-creative-chip {
  min-height: 33px;
  border-radius: 999px;
  color: var(--muted, #686d7b);
  font-weight: 500;
}

.cfg-creative-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cfg-creative-actions svg,
.cfg-creative-button svg {
  width: 16px;
  height: 16px;
}

.cfg-creative-tag,
.cfg-video-state {
  align-self: start;
  border-radius: 99px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  color: var(--accent, #6b56c5);
  background: var(--violet, #f2effa);
}

.cfg-creative-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  padding: 32px 16px;
  text-align: center;
}

.cfg-creative-empty h2,
.cfg-creative-empty h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.cfg-creative-symbol {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--cache-edge, #ddd8ec);
  border-radius: 14px;
  background: var(--violet, #f2effa);
  color: var(--accent, #6b56c5);
}

.cfg-creative-symbol svg {
  width: 22px;
  height: 22px;
}

.cfg-creative-text-button {
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--accent, #6b56c5);
  text-decoration: none;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.cfg-creative-text-button:hover {
  text-decoration: underline;
}

.cfg-creative :is(input, textarea, select) {
  border: 1px solid var(--edge, #e7e8ee);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--paper, #fff);
  color: inherit;
  font: inherit;
}

.cfg-creative :is(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent, #6b56c5);
  outline-offset: 2px;
}

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

.cfg-creative-error {
  margin: 0;
  color: var(--red, #af4149);
  font-size: 13px;
}

.cfg-creative-notice {
  margin: 0 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--cache-edge, #ddd8ec);
  border-radius: 8px;
  background: var(--cache, #f8f7fc);
  color: var(--muted, #686d7b);
  font-size: 13px;
  line-height: 1.55;
}

.cfg-loading-card {
  padding: 26px;
  color: var(--muted, #686d7b);
}

.cfg-chat-layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  height: clamp(560px, calc(100dvh - 204px), 860px);
  overflow: hidden;
}

.cfg-chat-sidebar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  gap: 12px;
  padding: 16px 12px;
  background: var(--cache, #f8f7fc);
  border-right: 1px solid var(--edge, #e7e8ee);
}

.cfg-chat-sidebar-label {
  padding-left: 8px;
  color: var(--muted, #686d7b);
  font-size: 12px;
}

.cfg-chat-thread-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  overflow: auto;
}

.cfg-chat-thread {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #686d7b);
  text-align: left;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.cfg-chat-thread span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cfg-chat-thread svg {
  flex: none;
  width: 15px;
  height: 15px;
}

.cfg-chat-thread[aria-pressed="true"],
.cfg-chat-thread:hover {
  border-color: var(--cache-edge, #ddd8ec);
  background: var(--paper, #fff);
  color: var(--accent, #6b56c5);
}

.cfg-chat-main {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.cfg-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line, #eeeff3);
}

.cfg-chat-current {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.cfg-chat-current strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cfg-chat-current span,
.cfg-chat-compose-foot > span {
  color: var(--muted, #686d7b);
  font-size: 12px;
}

.cfg-chat-header select {
  max-width: min(220px, 40vw);
  font-size: 13px;
}

.cfg-chat-messages {
  min-height: 0;
  padding: 20px 24px;
  overflow-y: auto;
}

.cfg-chat-welcome {
  min-height: 100%;
}

.cfg-chat-examples {
  justify-content: center;
  margin-top: 4px;
}

.cfg-chat-turn {
  display: grid;
  grid-template-columns: 33px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  margin: 0 0 12px;
}

.cfg-chat-turn-user {
  border: 1px solid var(--cache-edge, #ddd8ec);
  border-radius: 12px;
  background: var(--cache, #f8f7fc);
}

.cfg-chat-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #6953c4;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.cfg-chat-turn-user .cfg-chat-avatar {
  background: var(--violet, #f2effa);
  color: var(--accent, #6b56c5);
}

.cfg-chat-speaker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 24px;
  margin: 0 0 4px;
  font-size: 13px;
}

.cfg-chat-speaker span {
  color: var(--muted, #686d7b);
  font-size: 12px;
}

.cfg-chat-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
}

.cfg-chat-turn pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--soft, #f7f7fa);
}

.cfg-chat-text code {
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--violet, #f2effa);
}

.cfg-chat-compose {
  display: grid;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line, #eeeff3);
}

.cfg-chat-compose textarea {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  max-height: 180px;
  line-height: 1.55;
}

.cfg-chat-compose-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.cfg-chat-thinking {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 12px;
  color: var(--muted, #686d7b);
  font-size: 13px;
}

.cfg-chat-thinking span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, #6b56c5);
}

.cfg-chat-thinking span:nth-child(3) {
  margin-right: 3px;
}

.cfg-board-card {
  overflow: clip;
}

.cfg-board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--edge, #e7e8ee);
}

.cfg-board-toolbar button[aria-pressed="true"] {
  border-color: var(--accent, #6b56c5);
  background: var(--violet, #f2effa);
  color: var(--accent, #6b56c5);
}

.cfg-board-zoom [data-board-action="reset"] {
  min-width: 58px;
}

.cfg-board-viewport {
  position: relative;
  height: clamp(490px, calc(100dvh - 260px), 820px);
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--bg, #f6f7fa);
  background-image: radial-gradient(var(--cache-edge, #ddd8ec) 1px, transparent 1px);
  background-size: 20px 20px;
  cursor: grab;
  touch-action: none;
}

.cfg-board-viewport.cfg-board-dragging,
.cfg-board-dragging .cfg-board-node-handle {
  cursor: grabbing;
}

.cfg-board-world,
.cfg-board-nodes {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

.cfg-board-edges {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.cfg-board-edges path {
  fill: none;
  stroke: var(--accent, #6b56c5);
  stroke-width: 2;
}

.cfg-board-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(265px, 92%);
  padding: 21px;
  background: var(--paper, #fff);
  border: 1px solid var(--edge, #e7e8ee);
  border-radius: 16px;
  cursor: default;
}

.cfg-board-node {
  position: absolute;
  width: 192px;
  height: 132px;
  overflow: hidden;
  border: 1px solid var(--cache-edge, #ddd8ec);
  border-radius: 10px;
  background: var(--paper, #fff);
  box-shadow: 0 3px 10px rgba(34,36,45,.07);
  pointer-events: auto;
  cursor: auto;
}

.cfg-board-node-note {
  background: var(--amber-bg, #fff6e7);
}

.cfg-board-node-selected,
.cfg-board-node-link {
  outline: 2px solid var(--accent, #6b56c5);
}

.cfg-board-node-link {
  outline-style: dashed;
  outline-offset: 3px;
}

.cfg-board-node-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 33px;
  padding: 3px 9px;
  border: 0;
  border-bottom: 1px solid var(--cache-edge, #ddd8ec);
  background: var(--violet, #f2effa);
  color: var(--accent, #6b56c5);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: grab;
  user-select: none;
}

.cfg-board-node-note .cfg-board-node-handle {
  background: var(--amber-bg, #fff6e7);
  color: var(--amber, #8b571d);
}

.cfg-board-node textarea {
  width: 100%;
  height: 97px;
  border: 0;
  padding: 9px;
  border-radius: 0;
  background: transparent;
  resize: none;
  outline-offset: -3px;
  font-size: 13px;
  line-height: 1.4;
}

.cfg-board-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 12px;
  min-height: 39px;
  padding: 8px 14px;
  border-top: 1px solid var(--edge, #e7e8ee);
  color: var(--muted, #686d7b);
  font-size: 12px;
}

.cfg-video-layout {
  display: grid;
  grid-template-columns: minmax(290px, .83fr) minmax(0, 1.17fr);
  align-items: start;
  gap: 16px;
}

.cfg-media-studio {
  margin-top: 16px;
}

[data-video-studio] .cfg-media-studio {
  margin: 0 0 16px;
}

.cfg-media-reference {
  display: grid;
  gap: 7px;
}

.cfg-media-reference-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
}

.cfg-media-reference-picker input {
  flex: 1 1 175px;
}

.cfg-image-thumb {
  position: relative;
  overflow: hidden;
}

.cfg-image-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cfg-video-form {
  display: grid;
  gap: 9px;
  padding: 19px;
}

.cfg-video-layout h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 720;
}

.cfg-video-form h2 {
  margin: 0 0 3px;
}

.cfg-video-form label {
  font-size: 13px;
  font-weight: 650;
}

.cfg-video-form input,
.cfg-video-form textarea {
  min-width: 0;
  width: 100%;
}

.cfg-video-form textarea {
  min-height: 108px;
  resize: vertical;
}

.cfg-video-prompt-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.cfg-video-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 1px 0 6px;
}

.cfg-video-options > div {
  display: grid;
  gap: 6px;
}

.cfg-video-submit {
  min-height: 39px;
}

.cfg-video-history > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line, #eeeff3);
}

.cfg-video-history > header p {
  margin: 4px 0 0;
  color: var(--muted, #686d7b);
  font-size: 12px;
}

.cfg-video-jobs {
  display: grid;
  gap: 10px;
  min-width: 0;
  min-height: 240px;
  padding: 12px;
}

.cfg-video-job {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--edge, #e7e8ee);
  border-radius: 11px;
}

.cfg-video-job-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  align-self: start;
  border-radius: 8px;
  background: var(--violet, #f2effa);
  border: 1px solid var(--cache-edge, #ddd8ec);
  color: var(--accent, #6b56c5);
}

.cfg-video-job-thumb svg {
  width: 22px;
  height: 22px;
}

.cfg-video-job-content {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.cfg-video-job-name,
.cfg-video-job-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3px 9px;
}

.cfg-video-job-name strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.cfg-video-job-content p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted, #686d7b);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.cfg-video-job-meta {
  margin-top: 3px;
  color: var(--muted, #686d7b);
  font-size: 12px;
}

.cfg-video-state {
  padding: 3px 7px;
  font-size: 11px;
}

.cfg-video-state-pending {
  background: var(--amber-bg, #fff6e7);
  color: var(--amber, #8b571d);
}

.cfg-video-state-done {
  background: var(--green-bg, #edf8f1);
  color: var(--green, #29805a);
}

.cfg-video-state-failed {
  background: var(--red-bg, #fff0f1);
  color: var(--red, #af4149);
}

@media (max-width: 780px) {
  .cfg-chat-layout {
    grid-template-columns: 150px minmax(0, 1fr);
  }

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

@media (max-width: 560px) {
  .cfg-creative-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
  }

  .cfg-chat-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 600px;
  }

  .cfg-chat-sidebar {
    align-items: center;
    flex-direction: row;
    gap: 7px;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--edge, #e7e8ee);
  }

  .cfg-chat-new {
    flex: none;
  }

  .cfg-chat-sidebar-label {
    display: none;
  }

  .cfg-chat-thread-list {
    display: flex;
    overflow: auto hidden;
  }

  .cfg-chat-thread {
    flex: none;
    width: auto;
    max-width: 130px;
  }

  .cfg-chat-header {
    align-items: start;
    flex-direction: column;
    padding: 8px;
  }

  .cfg-chat-messages {
    padding: 9px;
  }

  .cfg-chat-compose {
    padding: 8px;
  }

  .cfg-chat-turn {
    padding: 8px;
  }

  .cfg-board-viewport {
    height: 455px;
  }

  .cfg-video-form {
    padding: 13px;
  }

  .cfg-video-job {
    grid-template-columns: 47px minmax(0, 1fr);
    gap: 8px;
  }
}
