.billing-balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(34, 36, 40, 0.92);
  color: #f5f5f5;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.billing-balance-chip:hover {
  background: rgba(48, 50, 56, 0.96);
  border-color: rgba(255, 255, 255, 0.16);
}

.billing-balance-chip-icon {
  display: inline-flex;
  opacity: 0.88;
}

.billing-balance-chip-value {
  min-width: 2ch;
  font-variant-numeric: tabular-nums;
}

.billing-balance-chip-scope {
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 500;
}

.billing-generate-cost-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 8px;
  margin-right: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(28, 30, 34, 0.95);
  color: #f3f4f6;
  font-size: 12px;
  font-weight: 600;
  cursor: default;
  pointer-events: none;
  flex-shrink: 0;
}

.billing-generate-cost-icon {
  display: inline-flex;
  opacity: 0.82;
}

.billing-generate-cost-value {
  min-width: 1.5ch;
  font-variant-numeric: tabular-nums;
}

/* Footer: single row — pills shrink with ellipsis, actions stay right. */
#v2-canvas .text-prompt-panel .prompt-panel-footer {
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: visible;
}

#v2-canvas .text-prompt-panel .img-model-pills {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  flex-wrap: nowrap;
  overflow: visible;
  gap: 4px;
}

#v2-canvas .text-prompt-panel .img-model-pills > .img-model-wrap,
#v2-canvas .text-prompt-panel .img-model-pills > .dreamina-task-model-wrap,
#v2-canvas .text-prompt-panel .img-model-pills > .img-ratio-wrap,
#v2-canvas .text-prompt-panel .img-model-pills > .vid-mode-wrap,
#v2-canvas .text-prompt-panel .img-model-pills > .vid-duration-wrap {
  flex: 0 1 auto;
  min-width: 0;
  max-width: none;
  display: inline-flex;
}

body:not(.is-dragging):not(.is-dragging-node)
  #v2-canvas
  .text-prompt-panel
  .img-model-pills
  .vid-duration-wrap:not([style*='display: none']) {
  visibility: visible;
}

#v2-canvas .text-prompt-panel .img-model-pills .img-pill-btn {
  min-width: 0;
  max-width: 10.5rem;
  padding-left: 8px;
  padding-right: 8px;
}

#v2-canvas .text-prompt-panel .img-model-pills > .vid-duration-wrap,
#v2-canvas .text-prompt-panel .img-model-pills > .vid-mode-wrap {
  flex-shrink: 0;
}

#v2-canvas .text-prompt-panel .img-model-pills .vid-duration-label,
#v2-canvas .text-prompt-panel .img-model-pills .vid-mode-label {
  max-width: none;
  flex-shrink: 0;
}

#v2-canvas .text-prompt-panel .img-model-pills .img-model-label,
#v2-canvas .text-prompt-panel .img-model-pills .img-ratio-label,
#v2-canvas .text-prompt-panel .img-model-pills .dreamina-task-model-label {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 6.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#v2-canvas .text-prompt-panel .prompt-actions {
  flex: 0 0 auto;
  flex-shrink: 0;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  padding-top: 0;
  margin-left: auto;
  white-space: nowrap;
}

#v2-canvas .text-prompt-panel .prompt-actions .billing-generate-cost-chip,
#v2-canvas .text-prompt-panel .prompt-actions .img-gen-btn,
#v2-canvas .text-prompt-panel .prompt-actions .prompt-submit {
  position: static;
  right: auto;
  bottom: auto;
  transform: none;
  flex-shrink: 0;
}

.prompt-actions .img-gen-btn[data-billing-insufficient='1'] {
  opacity: 0.45;
}

.billing-user-chip {
  display: inline-flex;
  align-items: center;
  height: 42px;
  margin-left: 0;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(34, 36, 40, 0.92);
  color: #f5f5f5;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  min-width: 210px;
  max-width: none;
}

.billing-user-chip-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}

.billing-project-switcher {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: auto;
  max-width: 210px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(22, 24, 29, 0.92);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.billing-project-switcher:disabled {
  opacity: 0.55;
}

.billing-project-switcher-static {
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: 320px;
  padding-right: 10px;
  white-space: nowrap;
}

.billing-project-switcher-shell {
  position: relative;
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
}

.billing-project-switcher-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-project-switcher-chevron {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin: 0 2px 0 0;
  border-right: 2px solid rgba(255, 255, 255, 0.46);
  border-bottom: 2px solid rgba(255, 255, 255, 0.46);
  transform: rotate(45deg);
  transform-origin: center;
  transition: transform 150ms ease, border-color 150ms ease;
}

.billing-project-switcher[aria-expanded='true'] .billing-project-switcher-chevron {
  border-color: #b8a8ff;
  transform: rotate(225deg);
}

.billing-project-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: max-content;
  min-width: 176px;
  max-width: 260px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  background: rgba(23, 24, 29, 0.98);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(18px);
}

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

.billing-project-menu-title {
  padding: 5px 9px 7px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.billing-project-menu-search {
  width: calc(100% - 8px);
  height: 32px;
  margin: 0 4px 6px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  outline: none;
}

.billing-project-menu-search:focus {
  border-color: rgba(141, 120, 255, 0.58);
  background: rgba(255, 255, 255, 0.075);
}

.billing-project-menu-list {
  max-height: min(360px, 52vh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.billing-project-menu-option {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.header-right .billing-project-menu-option {
  background: transparent !important;
}

.billing-project-menu-option:hover,
.billing-project-menu-option:focus-visible {
  background: rgba(124, 92, 255, 0.14) !important;
  color: #fff;
  outline: none;
}

.billing-project-menu-option.active {
  color: #c9bfff;
}

.billing-project-menu-check {
  color: #8d78ff;
  font-weight: 800;
}

.billing-project-menu-empty {
  padding: 14px 10px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  text-align: center;
}

.billing-user-chip-name {
  font-weight: 600;
  white-space: nowrap;
}

.billing-user-chip-team {
  color: #9ca3af;
  font-size: 11px;
  white-space: nowrap;
}

.header-right,
.canvas-header-right-ready {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
  max-width: min(820px, 72vw);
  margin-left: auto;
  padding-right: 10px;
  position: relative;
  z-index: 30;
}

.header-right .aic-diagnostics-trigger {
  position: static;
  right: auto;
  top: auto;
  z-index: auto;
  flex-shrink: 0;
  margin: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.header-right .aic-diagnostics-trigger:hover {
  background: rgba(48, 50, 56, 0.96);
}

.credential-employee-notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(120, 140, 255, 0.35);
  background: rgba(80, 100, 220, 0.12);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  line-height: 1.5;
}

body.canvas-auth-locked {
  overflow: hidden;
}

.canvas-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 120000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(10px);
}

.canvas-auth-gate[hidden] {
  display: none !important;
}

.canvas-auth-card {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(20, 22, 26, 0.98);
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  color: #f5f5f5;
  font-family: Inter, system-ui, sans-serif;
}

.canvas-auth-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.canvas-auth-brand-mark {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  aspect-ratio: 1;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.28);
}

.canvas-auth-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.canvas-auth-sub {
  margin: 6px 0 0;
  color: #9ca3af;
  font-size: 13px;
  line-height: 1.55;
}

.canvas-auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.canvas-auth-field label {
  font-size: 13px;
  color: #d1d5db;
}

.canvas-auth-field input {
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f5f5;
  padding: 0 14px;
  font-size: 15px;
}

.canvas-auth-project-picker {
  position: relative;
}

.canvas-auth-project-trigger {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: #f5f5f5;
  font-size: 15px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.canvas-auth-project-trigger:hover,
.canvas-auth-project-trigger[aria-expanded="true"] {
  border-color: rgba(139, 92, 246, 0.72);
  background: rgba(139, 92, 246, 0.08);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.11);
}

.canvas-auth-project-trigger:focus-visible,
.canvas-auth-project-option:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.88);
  outline-offset: 2px;
}

.canvas-auth-project-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.canvas-auth-project-chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid #aeb5c2;
  border-bottom: 2px solid #aeb5c2;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.canvas-auth-project-trigger[aria-expanded="true"] .canvas-auth-project-chevron {
  transform: translateY(2px) rotate(225deg);
}

.canvas-auth-project-menu {
  position: absolute;
  z-index: 4;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 228px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(139, 92, 246, 0.32);
  border-radius: 13px;
  background: #17191f;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.52);
}

.canvas-auth-project-menu[hidden] {
  display: none !important;
}

.canvas-auth-project-option {
  width: 100%;
  min-height: 48px;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #eef0f4;
  text-align: left;
  cursor: pointer;
}

.canvas-auth-project-option:hover,
.canvas-auth-project-option[aria-selected="true"] {
  background: rgba(124, 92, 255, 0.16);
}

.canvas-auth-project-option[aria-selected="true"] {
  color: #d8d1ff;
  box-shadow: inset 2px 0 #8b5cf6;
}

.canvas-auth-project-option strong {
  font-size: 14px;
}

.canvas-auth-project-option span {
  color: #8f97a5;
  font-size: 11px;
}

.canvas-auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.canvas-auth-btn {
  flex: 1;
  height: 42px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.canvas-auth-btn.primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

.canvas-auth-btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f3f4f6;
}

.canvas-auth-error {
  margin-top: 12px;
  color: #fca5a5;
  font-size: 13px;
  min-height: 18px;
}

.canvas-auth-error.info {
  color: #aeb6c2;
}

.canvas-auth-dev {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.28);
  color: #c7d2fe;
  font-size: 13px;
}

.canvas-auth-hint {
  margin: 14px 0 0;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.5;
}

.canvas-auth-hint a {
  color: #a5b4fc;
  text-decoration: none;
}

.canvas-auth-hint a:hover {
  text-decoration: underline;
}

/* Compact canvas account toolbar: one cohesive surface instead of four pills. */
.header-right.canvas-header-right-ready {
  gap: 2px !important;
  max-width: min(590px, 70vw) !important;
  padding: 4px !important;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(16, 17, 20, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.header-right.canvas-header-right-ready > .billing-project-switcher-shell {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.header-right .billing-balance-chip,
.header-right .aic-diagnostics-trigger,
.header-right .billing-project-switcher,
.header-right .billing-user-chip {
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 9px !important;
  box-shadow: none !important;
  font-size: 12px !important;
}

.header-right .billing-balance-chip,
.header-right .aic-diagnostics-trigger,
.header-right .billing-user-chip {
  background: transparent !important;
}

.header-right .billing-balance-chip {
  gap: 5px;
  min-width: 0;
  max-width: 118px;
  padding: 0 9px !important;
  font-weight: 650;
}

.header-right .billing-balance-chip-icon {
  width: 14px;
  height: 14px;
}

.header-right .billing-balance-chip-icon svg {
  width: 14px;
  height: 14px;
}

.header-right .aic-diagnostics-trigger {
  padding: 0 10px !important;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}

.header-right .billing-project-switcher {
  flex: 0 1 auto;
  width: auto !important;
  min-width: 116px;
  max-width: 200px !important;
  padding: 0 9px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-right .billing-project-switcher-static {
  display: inline-flex;
  justify-content: flex-start;
  padding-right: 10px !important;
}

.header-right .billing-user-chip {
  flex: 0 1 auto;
  min-width: 0 !important;
  max-width: 145px !important;
  padding: 0 10px !important;
  justify-content: flex-start;
}

.header-right .billing-user-chip-copy {
  flex-direction: row;
  align-items: center;
  gap: 0;
  width: 100%;
  overflow: hidden;
}

.header-right .billing-user-chip-name,
.header-right .billing-user-chip-team {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-right .billing-user-chip-name {
  flex: 0 1 auto;
  color: rgba(255, 255, 255, 0.9);
}

.header-right .billing-user-chip-team {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
}

.header-right .billing-user-chip-team::before {
  content: '';
  width: 1px;
  height: 14px;
  margin: 0 8px;
  background: rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
}

.header-right .billing-balance-chip:hover,
.header-right .aic-diagnostics-trigger:hover,
.header-right .aic-diagnostics-trigger[aria-expanded='true'],
.header-right .billing-user-chip:hover {
  background: rgba(255, 255, 255, 0.065) !important;
  color: #fff;
}

.header-right .billing-project-switcher:hover,
.header-right .billing-project-switcher[aria-expanded='true'] {
  background: rgba(255, 255, 255, 0.07) !important;
  color: #fff;
  outline: none;
}

.header-right .billing-project-switcher:focus-visible:not(:hover):not([aria-expanded='true']) {
  background: transparent !important;
  color: rgba(255, 255, 255, 0.72);
  outline: none;
}

@media (max-width: 1180px) {
  .header-right.canvas-header-right-ready {
    max-width: min(540px, 68vw) !important;
  }

  .header-right .billing-user-chip {
    max-width: 135px !important;
  }

  .header-right .billing-project-switcher {
    max-width: 180px !important;
  }
}
