:root {
  --node-width: 320px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--body-glow-primary), transparent 32rem),
    radial-gradient(circle at top right, var(--body-glow-secondary), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

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

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.brand-overlay {
  position: fixed;
  top: 18px;
  left: 22px;
  z-index: 20;
  height: clamp(28px, 4vw, 100px);
  width: auto;
  pointer-events: none;
  user-select: none;
}

.dock-toggle {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--dock);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.dock-toggle > button,
.dock-toggle > button .material-symbols-outlined {
  cursor: pointer;
}

.dock-toggle > button,
.settings-toggle,
.history-toggle,
.workspace-toggle,
.profile-toggle,
.prompt-engineer-toggle,
.graphical-assistant-toggle,
.chat-toggle,
.info-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dock-toggle [data-tooltip]::before,
.dock-toggle [data-tooltip]::after {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
}

.dock-toggle [data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 10px);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--tooltip-bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.dock-toggle [data-tooltip]::before {
  content: "";
  bottom: calc(100% + 4px);
  border: 5px solid transparent;
  border-top-color: var(--tooltip-bg);
}

.dock-toggle [data-tooltip]:hover::before,
.dock-toggle [data-tooltip]:hover::after,
.dock-toggle [data-tooltip]:focus-visible::before,
.dock-toggle [data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

.settings-toggle:hover,
.history-toggle:hover,
.workspace-toggle:hover,
.profile-toggle:hover,
.prompt-engineer-toggle:hover,
.graphical-assistant-toggle:hover,
.chat-toggle:hover,
.info-toggle:hover {
  background: var(--surface-strong);
  color: var(--accent-strong);
}

.settings-toggle:focus-visible,
.history-toggle:focus-visible,
.workspace-toggle:focus-visible,
.profile-toggle:focus-visible,
.prompt-engineer-toggle:focus-visible,
.graphical-assistant-toggle:focus-visible,
.chat-toggle:focus-visible,
.info-toggle:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.settings-toggle .material-symbols-outlined,
.history-toggle .material-symbols-outlined,
.workspace-toggle .material-symbols-outlined,
.profile-toggle .material-symbols-outlined,
.prompt-engineer-toggle .material-symbols-outlined,
.graphical-assistant-toggle .material-symbols-outlined,
.chat-toggle .material-symbols-outlined,
.info-toggle .material-symbols-outlined {
  font-size: 24px;
  line-height: 1;
}

.settings-toggle.is-open,
.history-toggle.is-open,
.workspace-toggle.is-open,
.profile-toggle.is-open,
.prompt-engineer-toggle.is-open,
.graphical-assistant-toggle.is-open,
.chat-toggle.is-open,
.info-toggle.is-open {
  color: var(--accent-strong);
}

.settings-toggle.is-open:hover,
.history-toggle.is-open:hover,
.workspace-toggle.is-open:hover,
.profile-toggle.is-open:hover,
.prompt-engineer-toggle.is-open:hover,
.graphical-assistant-toggle.is-open:hover,
.chat-toggle.is-open:hover,
.info-toggle.is-open:hover {
  background: var(--accent-surface);
}

.dock-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 23;
  border: 0;
  padding: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.settings-panel,
.prompt-engineer-panel,
.graphical-assistant-panel,
.info-panel,
.result-info-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 24;
  width: min(500px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 20px;
}

.settings-panel h2 {
  font-size: 1.2rem;
}

.settings-panel .eyebrow {
  font-size: 0.66rem;
}

.settings-panel label {
  font-size: 0.78rem;
  gap: 6px;
}

.settings-panel input,
.settings-panel select {
  font-size: 0.82rem;
}

.settings-panel-body {
  display: grid;
  gap: 10px;
}

.settings-section {
  display: grid;
  gap: 10px;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--surface-faint);
}

.settings-section h3 {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-account-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.settings-account-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.settings-toggle-label {
  width: fit-content;
  max-width: 100%;
  justify-self: start;
}

.settings-panel .settings-toggle-label .generate-toggle-control {
  width: fit-content;
  gap: 32px;
  height: 34px;
  padding: 0 10px;
}

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

.prompt-engineer-panel {
  display: grid;
  width: min(680px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.graphical-assistant-panel {
  display: grid;
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.graphical-assistant-body {
  display: grid;
  gap: 16px;
  overflow: auto;
  padding-right: 4px;
}

.graphical-assistant-step {
  display: grid;
  gap: 14px;
}

.graphical-assistant-step h3 {
  margin: 0;
  font-size: 1rem;
}

.graphical-assistant-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.graphical-assistant-options {
  display: grid;
  gap: 10px;
}

.graphical-assistant-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-faint);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.graphical-assistant-option:hover {
  border-color: var(--surface-hover-border);
  background: var(--surface-medium);
  color: var(--accent-strong);
}

.graphical-assistant-option .material-symbols-outlined {
  font-size: 22px;
  color: var(--accent-strong);
}

.graphical-assistant-option.is-selected {
  border-color: var(--accent-strong);
  background: var(--surface-medium);
  color: var(--accent-strong);
}

.graphical-assistant-asset-list {
  display: grid;
  gap: 10px;
}

.graphical-assistant-asset-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-faint);
}

.graphical-assistant-asset-item img,
.graphical-assistant-asset-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--overlay-soft);
}

.graphical-assistant-asset-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.graphical-assistant-asset-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.graphical-assistant-asset-meta strong,
.graphical-assistant-asset-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graphical-assistant-asset-meta span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: capitalize;
}

.graphical-assistant-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  width: 100%;
}

.graphical-assistant-reference-preview {
  display: grid;
  gap: 10px;
}

.graphical-assistant-reference-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--overlay-soft);
}

.graphical-assistant-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.graphical-assistant-actions .graphical-assistant-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  border-radius: 14px;
  flex-shrink: 0;
}

.graphical-assistant-actions .graphical-assistant-nav-button.ghost-button {
  min-height: 52px;
  padding: 0;
}

.graphical-assistant-actions .graphical-assistant-nav-button.primary-button {
  min-height: 52px;
  padding: 0;
}

.graphical-assistant-actions .graphical-assistant-generate-button {
  width: auto;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.graphical-assistant-nav-button .material-symbols-outlined {
  font-size: 24px;
  line-height: 1;
}

.graphical-assistant-nav-spinner {
  animation: graphical-assistant-spin 0.9s linear infinite;
}

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

.graphical-assistant-step textarea {
  min-height: 140px;
}

.graphical-assistant-enhanced-prompt {
  min-height: 190px;
}

.prompt-engineer-body {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.prompt-engineer-body textarea {
  min-height: 118px;
}

.prompt-engineer-context {
  min-height: 92px;
}

.prompt-engineer-result {
  min-height: 190px;
}

.prompt-engineer-submit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  align-items: end;
}

.prompt-engineer-submit-row .primary-button {
  min-height: 44px;
}

.prompt-engineer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prompt-engineer-copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.prompt-engineer-copy-button .material-symbols-outlined {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.prompt-engineer-status {
  margin: 0;
  color: var(--success);
  font-size: 0.84rem;
  font-weight: 800;
}

.chat-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 20px;
  z-index: 26;
  display: grid;
  width: 25vw;
  min-width: 280px;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  overflow: hidden;
  border-radius: 18px;
  padding: 18px;
  background: var(--card-translucent);
  backdrop-filter: blur(18px);
  box-shadow: var(--flow-panel-shadow);
}

.chat-messages {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.chat-panel.is-list-view {
  grid-template-rows: auto minmax(0, 1fr);
}

.chat-list-button.is-active {
  color: var(--accent-strong);
  background: var(--accent-surface);
}

.chat-conversation-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-content: flex-start;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.chat-conversation-item {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  align-items: center;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--surface-strong);
  border-radius: 10px;
  background: var(--surface-subtle);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.chat-conversation-main {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 6px 4px 6px 10px;
  border: 0;
  border-radius: 10px 0 0 10px;
  color: inherit;
  text-align: left;
  background: transparent;
}

.chat-conversation-delete {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-height: 0;
  margin-right: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--text-faint);
  background: transparent;
  cursor: pointer;
}

.chat-conversation-delete .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
}

.chat-conversation-delete:hover {
  color: var(--error-text);
  background: transparent;
}

.chat-conversation-item:hover {
  border-color: var(--accent-border);
  background: var(--accent-surface-soft);
}

.chat-conversation-item.is-active {
  border-color: var(--accent-border-strong);
  background: var(--accent-surface-strong);
}

.chat-conversation-main strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation-date {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
}

.chat-conversation-busy {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--accent-strong);
  animation: chat-tab-pulse 1s ease-in-out infinite;
}

.chat-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.chat-tab {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  max-width: 180px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 0.76rem;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chat-tab:hover {
  color: var(--text);
  background: var(--surface-medium);
}

.chat-tab.is-active {
  border-color: var(--accent-border-strong);
  color: var(--text);
  background: var(--accent-surface-strong);
}

.chat-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-tab-busy {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--accent-strong);
  animation: chat-tab-pulse 1s ease-in-out infinite;
}

@keyframes chat-tab-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.92);
  }

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

.chat-tab-close {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  opacity: 0.72;
}

.chat-tab-close:hover {
  opacity: 1;
  background: var(--surface-strong);
}

.chat-tab-add {
  justify-content: center;
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.chat-tab-add .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
}

.chat-tab-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-empty-state {
  margin: 0;
}

.chat-message {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--surface-strong);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--surface-subtle);
}

.chat-message.is-user {
  border-color: var(--accent-border);
  background: var(--accent-surface-soft);
}

.chat-message.is-assistant {
  border-color: var(--success-border);
  background: var(--success-surface);
}

.chat-message.is-pending {
  opacity: 0.78;
}

.chat-message-role {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chat-message-content {
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message-content-markdown {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

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

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

.chat-message-content-markdown p {
  margin: 0 0 0.75em;
}

.chat-message-content-markdown hr {
  margin: 0.85em 0;
  border: 0;
  border-top: 1px solid var(--border-emphasis);
}

.chat-message-content-markdown ol,
.chat-message-content-markdown ul {
  margin: 0 0 0.85em;
  padding-left: 1.25em;
}

.chat-message-content-markdown li {
  margin: 0 0 0.55em;
}

.chat-message-content-markdown li:last-child {
  margin-bottom: 0;
}

.chat-message-content-markdown strong {
  color: var(--text-bright);
  font-weight: 700;
}

.chat-message-content-markdown h1,
.chat-message-content-markdown h2,
.chat-message-content-markdown h3,
.chat-message-content-markdown h4 {
  margin: 0.85em 0 0.45em;
  font-size: 0.92rem;
  line-height: 1.35;
}

.chat-message-content-markdown code {
  border-radius: 6px;
  padding: 0.1em 0.35em;
  background: var(--overlay-medium);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-message-content-markdown pre {
  margin: 0 0 0.85em;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--overlay-medium);
}

.chat-message-content-markdown pre code {
  padding: 0;
  background: transparent;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-code-block {
  position: relative;
  margin: 0 0 0.85em;
  max-width: 100%;
  border-radius: 10px;
  background: var(--overlay-medium);
}

.chat-code-block pre {
  margin: 0;
  padding: 36px 12px 10px;
  background: transparent;
  border-radius: 0;
}

.chat-code-copy-button {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0;
  background: var(--surface-medium);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chat-code-copy-button:hover {
  border-color: var(--border-highlight);
  background: var(--border-strong);
  color: var(--text-bright);
}

.chat-code-copy-button.is-copied {
  border-color: var(--success-border-strong);
  background: var(--success-surface-strong);
  color: var(--success);
}

.chat-code-copy-button .material-symbols-outlined {
  font-size: 16px;
  line-height: 1;
}

.chat-message-typing {
  color: var(--muted);
  font-style: italic;
}

.chat-composer {
  display: grid;
  gap: 10px;
}

.chat-input-shell {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
}

.chat-input-shell:focus-within {
  border-color: var(--success-border-strong);
  box-shadow: 0 0 0 1px var(--success-ring);
}

.chat-input-shell .chat-input {
  display: block;
  width: 100%;
  min-height: 56px;
  max-height: 220px;
  padding: 12px;
  border: 0;
  border-radius: 0;
  overflow: auto;
  resize: none;
  background: transparent;
}

.chat-input-shell .chat-input:focus {
  outline: none;
  box-shadow: none;
}

.chat-input-toolbar {
  display: flex;
  flex: 0 0 40px;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 8px;
}

.chat-toolbar-button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.chat-toolbar-button .material-symbols-outlined {
  display: block;
  line-height: 1;
}

.chat-attach-button {
  width: 32px;
  height: 32px;
  color: var(--muted);
}

.chat-attach-button:not(:disabled):hover {
  color: var(--text);
}

.chat-attach-button .material-symbols-outlined {
  font-size: 21px;
}

.chat-send-button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--accent), #24c6dc);
}

.chat-send-button:not(:disabled):hover {
  filter: brightness(1.06);
}

.chat-send-button .material-symbols-outlined {
  font-size: 20px;
  font-weight: 700;
}

.chat-draft-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-draft-attachment {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  max-width: 180px;
  padding: 4px 6px 4px 4px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: var(--surface-soft);
}

.chat-draft-attachment img {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: cover;
}

.chat-draft-attachment .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.chat-draft-attachment-name {
  overflow: hidden;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-draft-attachment-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
}

.chat-draft-attachment-remove .material-symbols-outlined {
  font-size: 16px;
  line-height: 1;
}

.chat-message-content-stack {
  display: grid;
  gap: 8px;
}

.chat-message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-message-attachment {
  display: grid;
  gap: 4px;
  max-width: 160px;
  margin: 0;
}

.chat-message-attachment img,
.chat-message-attachment video,
.chat-message-attachment audio {
  width: 100%;
  border-radius: 10px;
}

.chat-message-attachment.is-text,
.chat-message-attachment.is-document {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  max-width: none;
  padding: 6px 10px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: var(--surface-soft);
}

.chat-message-attachment-icon {
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.chat-message-attachment figcaption {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-panel {
  display: grid;
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.settings-help-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.shortcuts-panel {
  width: min(620px, calc(100vw - 40px));
}

.shortcuts-panel-header {
  align-items: flex-start;
}

.shortcuts-panel-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.shortcuts-panel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent-surface-strong), var(--accent-surface-soft));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
  color: var(--accent-strong);
}

.shortcuts-panel-badge .material-symbols-outlined {
  font-size: 24px;
}

.shortcuts-panel-body {
  gap: 16px;
}

.shortcuts-section {
  overflow: hidden;
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-subtle), var(--surface-faint));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 4%);
}

.shortcuts-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: rgb(255 255 255 / 2%);
}

.shortcuts-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-medium);
  color: var(--accent-strong);
}

.shortcuts-section-icon .material-symbols-outlined {
  font-size: 18px;
}

.shortcuts-section-header h3 {
  flex: 1;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.shortcuts-section-count {
  min-width: 1.5rem;
  padding: 2px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.shortcuts-list {
  display: grid;
}

.shortcut-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 11px 14px;
  transition: background-color 0.15s ease;
}

.shortcut-row + .shortcut-row {
  border-top: 1px solid var(--border-soft);
}

.shortcut-row:hover {
  background: var(--surface-soft);
}

.shortcut-label {
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--text-soft);
}

.shortcut-keycaps {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.shortcut-keycap-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.shortcut-keycap-separator {
  color: var(--text-ghost);
  font-size: 0.72rem;
  font-weight: 700;
  user-select: none;
}

.shortcut-keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  min-height: 1.85rem;
  padding: 0 7px;
  border: 1px solid var(--border-emphasis);
  border-radius: 7px;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-medium));
  box-shadow:
    0 1px 0 rgb(255 255 255 / 10%) inset,
    0 1px 2px rgb(0 0 0 / 22%);
  color: var(--text-bright);
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.shortcut-keycap.is-action {
  min-width: auto;
  padding: 0 10px;
  font-family: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.01em;
  text-transform: none;
}

.shortcut-keycap-inline {
  display: inline-flex;
  vertical-align: middle;
  min-width: 1.5rem;
  min-height: 1.5rem;
  margin: 0 2px;
  font-size: 0.68rem;
}

.info-panel-body {
  display: grid;
  gap: 18px;
  overflow: auto;
  padding-right: 4px;
}

.result-info-panel {
  display: grid;
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.result-info-body {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding-right: 4px;
}

.result-info-overview {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--surface-faint);
}

.result-info-overview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.result-info-head-separator {
  color: var(--text-ghost);
  font-size: 0.9rem;
  line-height: 1;
}

.result-info-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--surface-strong);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: capitalize;
}

.result-info-status.is-success {
  border-color: var(--positive-border);
  background: var(--positive-surface);
  color: var(--positive);
}

.result-info-status.is-failure {
  border-color: var(--error-border-soft);
  background: var(--error-surface-soft);
  color: var(--error-text-strong);
}

.result-info-status.is-running {
  border-color: var(--info-border);
  background: var(--info-surface);
  color: var(--info-text);
}

.result-info-created {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
  white-space: nowrap;
}

.result-info-settings {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.result-info-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--surface-subtle);
  line-height: 1.2;
}

.result-info-chip-label {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-info-chip-value {
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.result-info-json-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-inline: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.result-info-json-button .material-symbols-outlined {
  font-size: 1rem;
}

.result-info-block {
  display: grid;
  gap: 8px;
}

.result-info-block-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-info-block-content {
  display: grid;
  gap: 8px;
}

.result-info-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
}

.result-info-inline.is-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.result-info-inline-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.result-info-inline-value {
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.result-info-inline-value.is-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
}

.result-info-url {
  display: block;
  color: var(--accent-strong);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.result-info-url:hover {
  text-decoration: underline;
}

.result-info-prompt {
  width: 100%;
  min-height: 120px;
  max-height: 220px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-faint);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.55;
}

.result-info-block {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--surface-faint);
}

.info-section h3 {
  margin: 0;
  font-size: 0.92rem;
}

.info-section-content {
  display: grid;
  gap: 8px;
}

.info-section-content p,
.info-section-content li {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.info-section-content ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.info-section-content a {
  color: var(--accent-strong);
  text-decoration: none;
}

.info-section-content a:hover {
  text-decoration: underline;
}

.info-section-content strong {
  color: var(--text);
  font-weight: 700;
}

.info-inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0 0.12rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  vertical-align: -0.2em;
}

.info-inline-icon .material-symbols-outlined {
  font-size: 0.92rem;
  line-height: 1;
}

.card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.loading-shell {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.loading-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  animation: loading-fade-in 0.7s ease;
}

.loading-logo {
  height: clamp(52px, 9vw, 80px);
  width: auto;
  opacity: 0.9;
}

.loading-indicator {
  display: flex;
  gap: 7px;
  align-items: center;
  height: 10px;
}

.loading-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-strong);
  opacity: 0.28;
  animation: loading-dot 1.15s ease-in-out infinite;
}

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

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

.loading-status {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

@keyframes loading-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes loading-dot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: scale(0.82);
  }

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

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
}

.auth-card {
  width: min(480px, 100%);
  padding: 32px;
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.auth-form,
.workspace-create {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.workspace-create-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.workspace-create-row .primary-button {
  min-height: 44px;
  height: 44px;
  padding: 0 18px;
}

.error-message {
  margin: 0;
  border: 1px solid var(--error-border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--error-text);
  background: var(--error-surface);
  font-weight: 700;
}

.workspace-card strong {
  display: block;
}

.workspace-card-actions,
.dialog-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.workspace-manager {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 32;
  display: grid;
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  transform: translate(-50%, -50%);
  gap: 18px;
  overflow: auto;
  padding: 20px;
  background: var(--card-translucent-soft);
  backdrop-filter: blur(18px);
}

.workspace-list {
  display: grid;
  gap: 12px;
}

.workspace-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--surface-strong);
  border-radius: 18px;
  padding: 14px;
  background: var(--surface-subtle);
}

.workspace-card.is-active {
  border-color: var(--accent-border-focus);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.danger-button {
  color: var(--error-text);
  background: var(--error-surface-strong);
}

.logout-button {
  flex-shrink: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--overlay-strong);
  backdrop-filter: blur(8px);
}

.edit-dialog,
.delete-dialog {
  display: grid;
  width: min(520px, 100%);
  gap: 16px;
  padding: 24px;
}

.edit-dialog h2,
.delete-dialog h2,
.delete-dialog p {
  margin: 0;
}

.delete-dialog p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}

.content-rights-dialog {
  width: min(560px, 100%);
  gap: 14px;
}

.content-rights-dialog-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.content-rights-dialog-actions .ghost-button,
.content-rights-dialog-actions .primary-button {
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
  padding: 18px 22px;
}

.topbar h1,
.card h2,
.canvas-toolbar h2 {
  margin: 0;
}

.topbar h1 {
  max-width: 840px;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.07em;
}

.hero-copy {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.section-heading,
.toggle-row,
.settings-grid,
.url-row {
  display: grid;
  gap: 14px;
}

.section-heading {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.section-heading-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

.url-row {
  grid-template-columns: 1fr 0.72fr;
  align-items: end;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-soft);
  outline: none;
}

input,
select {
  height: 44px;
  padding: 0 14px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%238b93a5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 L6 8 L9.5 4.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

select::-ms-expand {
  display: none;
}

textarea {
  min-height: 160px;
  resize: vertical;
  padding: 14px;
}

.prompt-node textarea {
  resize: both;
  min-width: 292px;
  max-width: 960px;
}

.prompt-textarea-shell {
  position: relative;
  display: grid;
  width: fit-content;
  max-width: 100%;
}

.prompt-textarea-highlight,
.prompt-textarea-shell .prompt-textarea-input {
  grid-area: 1 / 1;
  min-height: 160px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font: inherit;
  line-height: 1.5;
  letter-spacing: inherit;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: auto;
}

.prompt-textarea-highlight {
  pointer-events: none;
  color: var(--text);
  background: var(--node-input-bg);
}

.prompt-textarea-shell .prompt-textarea-input {
  resize: both;
  min-width: 292px;
  max-width: 960px;
  color: transparent;
  background: transparent;
  caret-color: var(--text);
}

.prompt-textarea-shell .prompt-textarea-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.prompt-textarea-shell:focus-within .prompt-textarea-highlight,
.prompt-textarea-shell:focus-within .prompt-textarea-input {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-surface);
}

.prompt-textarea-highlight .prompt-mention-valid {
  color: #9a83ff;
  font-weight: 700;
}

.prompt-textarea-highlight .prompt-mention-obsolete {
  color: #ef4444;
  font-weight: 700;
}

.prompt-textarea-shell .prompt-textarea-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-surface);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-surface);
}

.checkbox-line {
  display: flex;
  gap: 10px;
  align-items: center;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.file-drop {
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--surface-faint);
  text-align: center;
}

.file-drop input {
  display: none;
}

.file-drop span {
  color: var(--text);
  font-size: 1rem;
}

.file-drop small {
  color: var(--muted);
  font-weight: 500;
}

.file-upload-label {
  min-height: 44px;
  cursor: pointer;
  place-items: center;
  border: 1px dashed var(--surface-hover-border);
  border-radius: 14px;
  color: var(--text);
  background: rgb(255 255 255 / 6%);
  text-align: center;
}

.file-upload-label:hover {
  border-color: var(--accent);
}

.file-upload-label input {
  display: none;
}

.reference-url-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: end;
}

.reference-upload-button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
}

.reference-upload-button .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
}

.reference-upload-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.reference-url-label {
  min-width: 0;
}

.reference-hidden-file-input {
  display: none;
}

.upload-status {
  margin: 0;
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 700;
}

.upload-status.is-error {
  color: #ffc0c7;
}

.drive-link {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.primary-button,
.secondary-button,
.ghost-button {
  border: 0;
  border-radius: 14px;
  font-weight: 800;
}

.primary-button {
  min-height: 52px;
  color: white;
  background: linear-gradient(135deg, var(--accent), #24c6dc);
}

.secondary-button {
  height: 44px;
  padding: 0 18px;
  color: white;
  background: var(--accent);
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--text);
  background: var(--chip-bg);
}

.ghost-button.workspace-action-button,
.ghost-button.panel-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
}

.ghost-button.workspace-action-button .material-symbols-outlined,
.ghost-button.panel-close-button .material-symbols-outlined {
  display: block;
  font-size: 21px;
  line-height: 1;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--border-medium);
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--success);
  background: rgb(56 189 148 / 14%);
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.workspace-shell {
  position: fixed;
  inset: 0;
  z-index: 1;
  isolation: isolate;
  display: block;
  min-height: 100vh;
}

.node-sidebar {
  position: fixed;
  top: 78px;
  left: 18px;
  z-index: 24;
  display: flex;
  width: min(320px, calc(100vw - 36px));
  max-height: calc(100vh - 104px);
  min-height: auto;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 14px;
  background: var(--card);
  backdrop-filter: blur(18px);
}

.node-sidebar[hidden] {
  display: none;
}

.node-board {
  position: relative;
  display: block;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.node-board .react-flow {
  width: 100%;
  height: 100%;
  background: var(--canvas-bg);
}

.node-board .react-flow__pane {
  cursor: default;
}

.node-board .react-flow__node {
  border: 0;
  background: transparent;
}

.node-board .react-flow__node.design-frame-layer {
  z-index: -1 !important;
}

.node-board .react-flow__node:not(.design-frame-layer) {
  z-index: 10 !important;
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
}

.canvas-toolbar p:last-child {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.node-canvas {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: none;
  background: var(--canvas-bg);
  cursor: grab;
}

.node-canvas::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, var(--surface-subtle), transparent 22%);
}

.node-canvas.is-panning {
  cursor: grabbing;
}

.canvas-content {
  position: relative;
  min-width: 10000px;
  min-height: 10000px;
}

.canvas-world {
  position: relative;
  transform-origin: 0 0;
}

.canvas-world::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background-color: var(--canvas-bg);
  background-image: radial-gradient(circle, rgb(140 146 158 / 28%) 1px, transparent 1.2px);
  background-size: 24px 24px;
}

.connections-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: auto;
}

.connection-path {
  fill: none;
  stroke: rgb(154 131 255 / 70%);
  stroke-linecap: round;
  stroke-width: 3;
  pointer-events: stroke;
  filter: drop-shadow(0 0 10px rgb(124 92 255 / 35%));
}

.connection-path.is-selected {
  stroke: #f5c46b;
  stroke-width: 4;
}

.connection-path.is-preview {
  stroke: rgb(245 196 107 / 85%);
  stroke-dasharray: 10 7;
  pointer-events: none;
}

#zoomLevel {
  display: inline-flex;
  min-width: 54px;
  justify-content: center;
  border: 1px solid var(--border-medium);
  border-radius: 999px;
  margin-left: 6px;
  padding: 3px 8px;
  color: var(--text);
  background: var(--chip-bg);
  font-weight: 800;
}

.flow-node {
  position: relative;
  z-index: 1;
  width: var(--node-width);
  border: 1px solid var(--border-medium);
  border-radius: 22px;
  background: var(--node-bg);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
  box-shadow: var(--node-shadow);
}

.references-node {
  width: 370px;
}

.generate-node {
  width: 370px;
  --generate-port-start: 118px;
  --generate-port-spacing: 34px;
  --generate-extra-height: 0px;
  min-height: calc(330px + var(--generate-extra-height));
  display: flex;
  flex-direction: column;
}

.generate-node .node-header {
  gap: 10px;
}

.generate-image-node {
  min-height: 310px;
}

.generate-description-node .node-body {
  --generate-label-clearance: 14px;
}

.result-node {
  width: 360px;
  overflow: visible;
}

.result-node .node-header {
  gap: 10px;
  justify-content: space-between;
}

.result-node.is-running {
  border-color: var(--border-emphasis);
}

.flow-node.result-node.is-running {
  border-color: var(--border-emphasis);
}

.result-node-border-glow {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
}

.result-node-border-glow-trail {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-node-progress {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 6;
  transform: translateX(-50%);
  color: #fff;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

.result-node-progress-percent {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 10px rgb(0 0 0 / 45%);
}

.reference-flow-node {
  width: 340px;
}

.reference-flow-node .node-header {
  gap: 10px;
}

.reference-node-kind-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  pointer-events: none;
}

.reference-node-kind-icon .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
}

.image-reference-node {
  width: 360px;
}

.video-reference-node {
  width: 360px;
}

.audio-reference-node {
  width: 360px;
}

.design-postit-node {
  width: 280px;
  height: 260px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border-emphasis);
  background: #f9d857;
  box-shadow: 0 14px 40px rgb(0 0 0 / 30%);
}

.design-postit-node.is-selected {
  overflow: visible;
}

.design-postit-node .node-header {
  display: none;
  border-bottom: 1px solid rgb(0 0 0 / 18%);
  color: rgb(33 29 12 / 82%);
  font-size: 1rem;
  padding: 12px 14px;
}

.design-postit-node .node-title-input {
  border-color: var(--overlay-soft);
  background: rgb(255 255 255 / 45%);
  color: rgb(33 29 12 / 92%);
}

.design-postit-node .node-body {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 32px;
}

.design-postit-drag-edge {
  position: absolute;
  z-index: 2;
  cursor: grab;
}

.design-postit-drag-edge-top {
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
}

.design-postit-drag-edge-right {
  top: 0;
  right: 0;
  bottom: 0;
  width: 16px;
}

.design-postit-drag-edge-bottom {
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
}

.design-postit-drag-edge-left {
  top: 0;
  left: 0;
  bottom: 0;
  width: 16px;
}

.design-color-swatches {
  position: absolute;
  left: -28px;
  top: 50%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateY(-50%);
  pointer-events: auto;
}

.design-color-swatch {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid rgb(255 255 255 / 28%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--overlay-medium);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.design-color-swatch:hover {
  transform: scale(1.08);
}

.design-color-swatch.is-active {
  border-color: rgb(255 255 255 / 92%);
  box-shadow: 0 0 0 2px rgb(245 196 107 / 45%), 0 4px 12px rgb(0 0 0 / 32%);
}

.design-frame-node {
  position: relative;
  box-sizing: border-box;
  border: 2px solid var(--accent-strong);
  border-radius: 20px;
  background: rgb(154 131 255 / 8%);
  box-shadow: inset 0 0 0 1px rgb(154 131 255 / 16%);
}

.design-frame-node.is-selected {
  border-color: rgb(245 196 107 / 92%);
  box-shadow: inset 0 0 0 1px rgb(245 196 107 / 35%), 0 0 0 1px rgb(245 196 107 / 28%);
}

.design-frame-title {
  position: absolute;
  top: -80px;
  left: 8px;
  transform: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.design-frame-title .node-title {
  color: rgb(232 223 255 / 96%);
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 0 18px rgb(8 10 16 / 55%);
}

.design-frame-title .node-title-input {
  min-width: 120px;
  padding: 2px 4px;
  border-color: rgb(154 131 255 / 68%);
  border-radius: 8px;
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  background: rgb(7 9 13 / 85%);
}

.design-frame-resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  border: 1px solid rgb(154 131 255 / 85%);
  border-radius: 999px;
  background: rgb(15 18 28 / 96%);
  box-shadow: 0 0 0 2px rgb(8 10 15 / 78%);
  cursor: nwse-resize;
}

.design-frame-resize-handle:hover {
  background: rgb(154 131 255 / 30%);
}

.design-text-floating {
  width: max-content;
  max-width: 100%;
  padding: 0;
  background: transparent;
}

.design-text-floating.is-selected .design-text-display {
  text-shadow: 0 0 14px rgb(245 196 107 / 35%);
}

.design-text-display {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 8px;
  padding: 4px 2px;
  background: transparent;
  color: rgb(244 246 252 / 95%);
  text-align: left;
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: pre-wrap;
  cursor: grab;
}

.design-text-editor {
  max-width: 100%;
  min-height: 72px;
  border: 1px solid var(--surface-hover-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgb(10 14 20 / 88%);
  color: rgb(244 246 252 / 95%);
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  resize: both;
}

.design-postit-editor {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgb(38 32 8 / 90%);
  font-size: 1.2rem;
  line-height: 1.5;
  resize: none;
  padding: 4px;
  font-weight: 700;
}

.design-postit-editor::placeholder {
  color: var(--postit-placeholder-color, rgb(38 32 8 / 45%));
}

.design-postit-resize-handle {
  position: absolute;
  z-index: 3;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 6px;
  background:
    linear-gradient(135deg, transparent 38%, rgb(0 0 0 / 24%) 40%, rgb(0 0 0 / 24%) 52%, transparent 54%),
    linear-gradient(135deg, transparent 56%, var(--overlay-medium) 58%, var(--overlay-medium) 70%, transparent 72%);
  cursor: nwse-resize;
  opacity: 0.85;
}

.design-postit-resize-handle:hover {
  opacity: 1;
}

.design-text-editor:focus-visible,
.design-postit-editor:focus-visible,
.design-text-display:focus-visible {
  outline: 2px solid rgb(124 92 255 / 70%);
  outline-offset: 1px;
}

.flow-node.is-dragging {
  z-index: 5;
  border-color: var(--accent);
  box-shadow: 0 22px 70px rgb(124 92 255 / 24%);
}

.flow-node.is-running {
  border-color: rgb(45 212 191 / 72%);
}

.flow-node.is-selected {
  border-color: rgb(245 196 107 / 48%);
  box-shadow: 0 0 0 1px rgb(245 196 107 / 28%), 0 18px 60px rgb(0 0 0 / 42%);
}

.generate-node.is-connection-target {
  border-color: #f5c46b;
}

.generate-input-ports {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.reference-flow-node.is-connected {
  border-color: rgb(45 212 191 / 58%);
}

.reference-flow-node.is-selected {
  box-shadow: 0 0 0 1px rgb(245 196 107 / 28%), 0 18px 60px rgb(0 0 0 / 42%);
}

.node-board .react-flow__edge path {
  transition: stroke 140ms ease, stroke-width 140ms ease, filter 140ms ease;
}

.node-board .react-flow__edge.selected path,
.node-board .react-flow__edge:focus-visible path {
  stroke: rgb(114 214 255 / 96%) !important;
  stroke-width: 3.6px !important;
  filter: drop-shadow(0 0 7px rgb(114 214 255 / 34%));
}

.reference-flow-node.is-pending-connection {
  border-color: #f5c46b;
}

.node-header {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 20px 20px;
  cursor: grab;
  user-select: none;
  align-content: center;
  justify-content: flex-start;
  align-items: center;
  font-size: 1.2rem;
  color: var(--text-soft);
}

.prompt-node .node-header {
  gap: 10px;
  justify-content: space-between;
}

.node-header:active {
  cursor: grabbing;
}

.node-header strong {
  display: block;
  color: inherit;
}

.node-title-wrap {
  flex: 1;
  min-width: 0;
}

.node-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: text;
}

.node-title-input {
  width: 100%;
  border: 1px solid var(--border-highlight);
  border-radius: 10px;
  background: var(--node-input-bg);
  color: inherit;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  padding: 6px 10px;
}

.node-title-input:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

.node-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -4px -6px -4px auto;
}

.node-header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-subtle);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.node-header-action:hover {
  border-color: rgb(154 131 255 / 45%);
  color: var(--accent-strong);
  background: var(--accent-surface-strong);
}

.node-header-action:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.node-header-action .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.node-copy {
  color: var(--muted);
}

.node-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.prompt-mention-menu {
  position: absolute;
  z-index: 24;
  display: grid;
  gap: 6px;
  min-width: 210px;
  max-width: min(320px, calc(100% - 24px));
  max-height: 180px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border-emphasis);
  border-radius: 12px;
  background: var(--card-translucent);
  box-shadow: var(--shadow);
}

.prompt-mention-option {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
}

.prompt-mention-option strong {
  font-size: 0.86rem;
  font-weight: 700;
}

.prompt-mention-option small {
  font-size: 0.75rem;
  color: var(--muted);
}

.prompt-mention-option:hover,
.prompt-mention-option.is-active {
  border-color: var(--accent-border);
  background: var(--accent-surface-strong);
}

.generate-node .node-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-end;
  padding-top: calc(14px );
}

.generate-video-node .node-body {
  justify-content: flex-start;
}

.generate-mode-row {
  padding: 0 16px;
  margin-top: 20px;
}

.generate-mode-row label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
}

.generate-options {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.generate-node .settings-grid {
  gap: 10px;
}

.generate-video-node .settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.generate-node label {
  gap: 6px;
  font-size: 0.86rem;
}

.generate-node input,
.generate-node select {
  height: 40px;
  padding: 0 12px;
}

.generate-node select {
  padding-right: 34px;
}

.generate-toggle-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
  cursor: pointer;
}

.generate-toggle-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-surface);
}

.generate-toggle-control .generate-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.generate-toggle-state {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.generate-toggle-track {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-medium);
  transition: background 0.2s ease;
}

.generate-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease;
}

.generate-toggle-input:checked + .generate-toggle-track {
  background: var(--accent);
}

.generate-toggle-input:checked + .generate-toggle-track::after {
  transform: translateX(16px);
}

.generate-node .primary-button {
  margin-top: 12px;
}

.generate-input-label {
  position: absolute;
  left: 25px;
  z-index: 2;
  transform: translateY(-50%);
  color: var(--text-soft);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.image-preview {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  aspect-ratio: var(--media-ratio, 16 / 9);
  background: #161a22;
  max-height: 70vh;
}

.image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0f131a;
}

.video-preview {
  position: relative;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  aspect-ratio: var(--media-ratio, 16 / 9);
  max-height: 70vh;
  align-items: center;
  justify-content: center;
  background: #161a22;
}

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

.audio-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #161a22;
  padding: 12px;
  min-height: 82px;
}

.audio-preview audio {
  width: 100%;
}

.image-preview-empty {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: #1b1f29;
}

.image-preview-empty.is-upload-target {
  cursor: pointer;
}

.image-preview-empty.is-upload-target:hover {
  background: #222733;
}

.image-preview-upload-icon {
  font-size: 36px;
  line-height: 1;
  color: rgb(162 169 180 / 78%);
  pointer-events: none;
}

.image-preview-empty.is-upload-target:hover .image-preview-upload-icon {
  color: rgb(214 221 231 / 92%);
}

.media-preview-uploading {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgb(213 221 231 / 88%);
  letter-spacing: 0.02em;
}

.media-preview-loader {
  width: 28px;
  height: 28px;
  border: 3px solid rgb(162 169 180 / 24%);
  border-top-color: rgb(214 221 231 / 92%);
  border-radius: 999px;
  animation: media-preview-spin 0.9s linear infinite;
}

.image-preview-dots {
  display: flex;
  gap: 8px;
}

.image-preview-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgb(162 169 180 / 78%);
}

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

.node-copy {
  margin: 0;
  line-height: 1.5;
}

.port {
  position: absolute;
  z-index: 3;
  width: 16px;
  height: 16px;
  border: 3px solid var(--panel);
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 0 0 2px var(--surface-hover-border), 0 0 20px rgb(124 92 255 / 60%);
}

.react-flow__handle {
  width: 16px;
  height: 16px;
  border: 3px solid var(--panel);
  background: var(--accent-strong);
  box-shadow: 0 0 0 2px var(--surface-hover-border), 0 0 20px rgb(124 92 255 / 60%);
}

.port-in {
  top: 50%;
  left: -8px;
  transform: translateY(-50%);
}

.port-in-main {
  top: 74px;
  transform: none;
}

.generate-input-port {
  top: calc(var(--generate-port-start) + var(--port-index, 0) * var(--generate-port-spacing));
  left: -8px;
  transform: none;
  pointer-events: auto;
}

.generate-input-port[data-input-state="available"] {
  background: #f5c46b;
  box-shadow: 0 0 0 2px var(--text-ghost), 0 0 18px rgb(245 196 107 / 55%);
}

.generate-input-port[data-input-state="occupied"] {
  background: #38d4a3;
}

.port-out {
  top: 50%;
  right: -8px;
  transform: translateY(-50%);
}

.mini-button {
  margin-left: auto;
  min-height: 30px;
}

.context-menu {
  position: fixed;
  z-index: 30;
  display: grid;
  gap: 4px;
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  background: var(--card);
  box-shadow: 0 20px 50px rgb(0 0 0 / 45%);
}

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

.context-menu-item {
  position: relative;
}

.context-menu-trigger {
  position: relative;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 9px 28px 9px 10px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  background: rgb(255 255 255 / 6%);
  cursor: default;
}

.context-menu-trigger::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 10px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-50%);
}

.context-menu-item:hover > .context-menu-trigger,
.context-menu-item:focus-within > .context-menu-trigger {
  background: rgb(124 92 255 / 30%);
}

.context-menu-submenu {
  position: absolute;
  top: 0;
  left: calc(100% + 4px);
  display: none;
  gap: 4px;
  min-width: 150px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  background: var(--card);
  box-shadow: 0 20px 50px rgb(0 0 0 / 45%);
}

.context-menu-item:hover > .context-menu-submenu,
.context-menu-item:focus-within > .context-menu-submenu {
  display: grid;
}

.context-menu-item.is-submenu-left > .context-menu-submenu {
  right: calc(100% + 4px);
  left: auto;
}

.context-menu-item.is-submenu-left > .context-menu-trigger {
  padding: 9px 10px 9px 28px;
}

.context-menu-item.is-submenu-left > .context-menu-trigger::after {
  content: "‹";
  right: auto;
  left: 10px;
}

.context-menu-submenu::before {
  content: "";
  position: absolute;
  top: 0;
  right: 100%;
  width: 8px;
  height: 100%;
}

.context-menu-submenu button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  text-align: left;
  background: rgb(255 255 255 / 6%);
}

.context-menu-submenu button:hover {
  background: rgb(124 92 255 / 30%);
}

.context-menu-action {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  background: rgb(255 255 255 / 6%);
}

.context-menu-action:hover {
  background: rgb(124 92 255 / 30%);
}

.context-menu-action-danger:hover {
  background: rgb(255 90 90 / 22%);
  color: #ffc9c9;
}

.reference-list,
.history-list,
.job-status {
  display: grid;
  gap: 10px;
}

.job-status.is-running {
  display: flex;
  align-items: center;
}

.job-status-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgb(45 212 191 / 22%);
  border-top-color: rgb(45 212 191 / 92%);
  border-radius: 999px;
  animation: media-preview-spin 0.75s linear infinite;
}

.reference-card,
.history-card {
  display: grid;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: var(--surface-faint);
}

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

.reference-card strong,
.history-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-card span,
.history-card-meta,
.raw-hint,
.empty-state {
  color: var(--muted);
}

.warning-card {
  border-color: rgb(245 196 107 / 60%);
}

.warning-card span {
  color: var(--warning);
}

.job-details {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.job-details p {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  margin: 0;
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

video {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: black;
}

.result-video-frame {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
}

.result-image-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #0f131a;
}

.result-image-frame img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #0f131a;
}

.result-video-frame video {
  display: block;
}

.result-video-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  pointer-events: none;
}

.result-video-nav {
  pointer-events: auto;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text-ghost);
  border-radius: 999px;
  color: white;
  background: rgb(9 11 18 / 70%);
  box-shadow: 0 10px 26px rgb(0 0 0 / 32%);
  backdrop-filter: blur(10px);
}

.result-video-nav:first-child {
  justify-self: start;
}

.result-video-nav:last-child {
  justify-self: end;
}

.result-video-nav:hover {
  background: rgb(124 92 255 / 84%);
}

.result-video-counter {
  justify-self: center;
  grid-column: 2;
  border: 1px solid var(--surface-hover-border);
  border-radius: 999px;
  padding: 4px 10px;
  color: white;
  background: rgb(9 11 18 / 72%);
  font-size: 0.78rem;
  font-weight: 800;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.history-card a {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}

.node-sidebar .section-heading {
  gap: 8px;
}

.node-sidebar .eyebrow {
  margin: 0 0 4px;
  font-size: 0.68rem;
}

.node-sidebar h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.node-sidebar .ghost-button:not(.panel-close-button) {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.node-sidebar .empty-state {
  padding: 10px;
  border-radius: 10px;
  font-size: 0.78rem;
}

.history-list {
  gap: 6px;
  min-width: 0;
  overflow: auto;
}

.history-card {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 9px;
  border-radius: 10px;
  min-width: 0;
  width: 100%;
}

button.history-card {
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

button.history-card:hover {
  border-color: var(--accent-border);
  background: var(--accent-surface-soft);
}

button.history-card:focus-visible {
  outline: 2px solid rgb(154 131 255 / 55%);
  outline-offset: 1px;
}

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

.history-card-kind {
  color: var(--accent-strong);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.history-card-prompt {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-card-outcome {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 999px;
}

.history-card-outcome .material-symbols-outlined {
  font-size: 12px;
  line-height: 1;
}

.history-card-outcome.is-success {
  color: #5ecf8a;
  background: rgb(94 207 138 / 12%);
}

.history-card-outcome.is-failure {
  color: #ff7b7b;
  background: rgb(255 123 123 / 12%);
}

.history-card-meta {
  font-size: 0.68rem;
  line-height: 1.2;
}

.node-sidebar.is-history-detail {
  overflow: hidden;
}

.history-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.history-detail-meta {
  display: grid;
  gap: 4px;
}

.history-detail-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.history-detail-meta-copy {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.history-detail-kind {
  color: var(--accent-strong);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.history-detail-status {
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.history-detail-date,
.history-detail-model {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
  word-break: break-word;
}

.history-detail-section {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.history-detail-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-detail-prompt {
  margin: 0;
  max-height: 160px;
  padding: 8px 10px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-faint);
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-detail-preview {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f131a;
}

.history-detail-preview img,
.history-detail-preview video {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #0f131a;
}

.history-detail-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--accent-strong);
  background: var(--info-surface);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}

.download-video-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.download-video-button .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 1100px) {
  .node-sidebar {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    padding: 0;
  }

  .brand-overlay {
    top: 14px;
    left: 16px;
  }

  .auth-shell,
  .loading-shell {
    padding: 18px;
  }

  .auth-card {
    padding: 22px;
  }

  .workspace-card-actions,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-card-actions {
    align-items: center;
    flex-direction: row;
  }

  .workspace-manager {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 80px);
  }

  .chat-panel {
    top: 12px;
    right: 12px;
    bottom: 88px;
    width: min(calc(100vw - 24px), 360px);
  }

  .workspace-card {
    grid-template-columns: 1fr;
  }

  .settings-toggle {
    top: 12px;
    right: 12px;
  }

  .history-toggle {
    top: 12px;
    right: 64px;
  }

  .settings-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 100px);
  }

  .node-sidebar {
    top: 62px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: min(420px, calc(100vh - 82px));
  }

  .node-board .react-flow__panel.canvas-theme-panel.bottom.left {
    left: 10px;
    bottom: 198px;
  }

  .node-board .react-flow__controls {
    left: 10px;
    bottom: 88px;
  }

  .topbar,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions,
  .canvas-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .canvas-toolbar p:last-child {
    text-align: left;
  }

  .settings-grid,
  .toggle-row,
  .url-row,
  .prompt-engineer-submit-row,
  .reference-card {
    grid-template-columns: 1fr;
  }

  .flow-node,
  .references-node,
  .generate-node,
  .result-node {
    width: min(320px, calc(100vw - 62px));
  }

  .topbar h1 {
    letter-spacing: -0.05em;
  }
}

.react-flow__panel.react-flow__attribution.bottom.right {
  display: none;
}

.node-board .react-flow__panel.canvas-theme-panel.bottom.left {
  bottom: 130px;
  left: 18px;
  margin: 0;
}

.node-board .canvas-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--dock);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.node-board .canvas-theme-toggle:hover {
  background: var(--surface-strong);
  color: var(--accent-strong);
}

.node-board .canvas-theme-toggle:focus-visible {
  outline: 1px solid var(--accent-strong);
  outline-offset: 1px;
}

.node-board .canvas-theme-toggle .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
}

.node-board .react-flow__controls {
  bottom: 20px;
  left: 18px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--dock);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.node-board .react-flow__controls-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.node-board .react-flow__controls-button:hover {
  background: var(--surface-strong);
  color: var(--accent-strong);
}

.node-board .react-flow__controls-button:focus-visible {
  outline: 1px solid var(--accent-strong);
  outline-offset: 1px;
}

.node-board .react-flow__controls-button svg {
  fill: currentcolor;
  max-width: 10px;
  max-height: 10px;
}

.app-toast-layer {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(92vw, 560px);
  padding-top: 18px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast-stack {
  width: max-content;
  max-width: min(92vw, 560px);
}

.toast {
  width: max-content;
  max-width: min(92vw, 560px);
  border-radius: 16px;
  padding: 12px 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 54px rgb(0 0 0 / 48%);
}

.toast-error {
  border: 2px solid #ff3030;
  background: rgb(88 12 12 / 94%);
}

.toast-success {
  border: 2px solid #2ecc71;
  background: rgb(12 72 38 / 94%);
}

.toast.is-visible {
  animation: toast-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.toast.is-leaving {
  animation: toast-leave 320ms cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

.toast-message {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.toast-message-error {
  color: #ff4444;
}

.toast-message-success {
  color: #44ff88;
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(calc(-100% - 24px));
  }

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

@keyframes toast-leave {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(calc(-100% - 24px));
  }
}

.collaborator-cursors-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}

.collaborator-cursor {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  transform-origin: top left;
}

.collaborator-cursor-pointer {
  display: block;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 35%));
}

.collaborator-cursor-label {
  display: inline-block;
  margin-top: 2px;
  margin-left: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.workspace-members-panel {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 30;
  display: grid;
  gap: 16px;
  width: min(360px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  padding: 20px;
  overflow: auto;
}

.workspace-members-panel .section-heading {
  margin: 0;
}

.workspace-members-panel .eyebrow {
  margin: 0 0 4px;
}

.workspace-members-panel h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.workspace-invite-form {
  display: grid;
  gap: 12px;
  margin: 0;
}

.workspace-members-section {
  display: grid;
  gap: 10px;
}

.workspace-members-heading {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.workspace-members-list {
  display: grid;
  gap: 10px;
}

.workspace-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.workspace-member-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace-member-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-subtle);
  flex: 0 0 auto;
}

.workspace-member-dot.is-online {
  background: #44ff88;
  box-shadow: 0 0 0 3px rgb(68 255 136 / 20%);
}

.collab-live-badge {
  font-size: 12px;
}

.collab-live-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #44ff88;
  color: #08140d;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.members-toggle {
  position: relative;
}
