.cb-workflow-consoles {
  --cb-console-blue: #39c6ff;
  --cb-console-panel: rgba(8, 22, 42, 0.78);
  --cb-console-border: rgba(83, 210, 255, 0.18);
}

.cb-workflow-consoles .cb-console-foundation-notice {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(57, 198, 255, 0.22);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(57, 198, 255, 0.10), rgba(8, 22, 42, 0.46));
  color: inherit;
}

.cb-console-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 18px;
}

.cb-console-card,
.cb-console-placeholder-card,
.cb-console-editor {
  border: 1px solid var(--cb-console-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 45px rgba(10, 30, 60, 0.08);
}

.cb-console-card {
  padding: 18px;
}

.cb-console-card-top,
.cb-console-card-heading,
.cb-console-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.cb-console-card h3,
.cb-console-placeholder-card h3,
.cb-console-editor h2 {
  margin: 0 0 6px;
}

.cb-console-card p,
.cb-console-placeholder-card p,
.cb-console-editor p {
  margin: 0;
}

.cb-console-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.cb-console-badge-info {
  background: rgba(57, 198, 255, 0.12);
  color: #0876a5;
}

.cb-console-badge-success {
  background: rgba(55, 245, 177, 0.16);
  color: #05764d;
}

.cb-console-badge-muted {
  background: rgba(110, 124, 140, 0.14);
  color: #52606e;
}

.cb-console-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.cb-console-meta-grid span {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(8, 22, 42, 0.04);
  color: #304255;
}

.cb-console-meta-grid strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  text-transform: uppercase;
  color: #718397;
  letter-spacing: 0.05em;
}

.cb-console-actions,
.cb-console-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.cb-console-updated {
  margin-top: 12px !important;
  color: #718397;
  font-size: 12px;
}

.cb-console-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 8, 18, 0.62);
  backdrop-filter: blur(8px);
}

.cb-console-editor-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.cb-console-editor {
  padding: 22px;
}

.cb-console-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.cb-console-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
}

.cb-console-form-grid input,
.cb-console-form-grid select,
.cb-console-form-grid textarea {
  width: 100%;
  border: 1px solid rgba(103, 119, 136, 0.24);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

.cb-console-form-grid textarea,
.cb-console-check {
  grid-column: span 2;
}

.cb-console-check {
  flex-direction: row !important;
  align-items: center;
}

.cb-console-check input {
  width: auto;
}

.cb-console-form-grid small {
  font-weight: 400;
  color: #718397;
}

.cb-console-editor-sections {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.cb-console-placeholder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.cb-console-placeholder-card {
  padding: 16px;
}

.cb-console-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(57, 198, 255, 0.12);
  color: #0876a5;
  font-weight: 800;
}

.cb-console-code {
  width: 100%;
  min-height: 150px;
  margin: 14px 0 10px;
  padding: 14px;
  border: 1px solid rgba(57, 198, 255, 0.20);
  border-radius: 14px;
  background: #05111f;
  color: #eaf7ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.cb-console-empty {
  border: 1px dashed rgba(57, 198, 255, 0.28);
  border-radius: 18px;
  padding: 32px;
}

@media (max-width: 760px) {
  .cb-console-form-grid,
  .cb-console-placeholder-grid,
  .cb-console-meta-grid {
    grid-template-columns: 1fr;
  }
  .cb-console-form-grid textarea,
  .cb-console-check {
    grid-column: span 1;
  }
  .cb-console-editor-overlay {
    padding: 10px;
  }
  .cb-console-editor-dialog {
    width: 100%;
    max-height: calc(100vh - 20px);
  }
}

/* v5.7.1 Console Team Member Access + right-side editor panel */
.cb-console-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cb-console-access-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
}

.cb-console-access-assigned {
  background: rgba(26, 188, 156, 0.14);
  color: #087864;
}

.cb-console-access-owner,
.cb-console-access-organization {
  background: rgba(57, 198, 255, 0.14);
  color: #0876a5;
}

.cb-console-editor-overlay {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
  background: rgba(15, 23, 42, 0.42);
}

.cb-console-editor-panel {
  width: min(920px, 94vw);
  height: 100vh;
  height: 100dvh;
  background: #fff;
  box-shadow: -24px 0 70px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cb-console-editor-dialog {
  width: min(920px, 94vw);
  height: 100vh;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
}

.cb-console-editor-panel .cb-console-editor,
.cb-console-editor-dialog .cb-console-editor {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.cb-console-editor-panel .cb-console-editor-header,
.cb-console-editor-dialog .cb-console-editor-header {
  flex: 0 0 auto;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(83, 210, 255, 0.18);
  background: rgba(248, 251, 255, 0.96);
}

.cb-console-editor-panel form,
.cb-console-editor-dialog form,
.cb-console-editor-panel .cb-console-editor-sections,
.cb-console-editor-dialog .cb-console-editor-sections {
  padding-left: 24px;
  padding-right: 24px;
}

.cb-console-editor-panel form,
.cb-console-editor-dialog form {
  flex: 0 0 auto;
  padding-top: 20px;
}

.cb-console-editor-panel .cb-console-editor-sections,
.cb-console-editor-dialog .cb-console-editor-sections {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 24px;
}

.cb-console-editor-footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 16px 24px;
  margin-top: 0;
  border-top: 1px solid rgba(83, 210, 255, 0.18);
  background: rgba(255, 255, 255, 0.98);
}

.cb-console-access-panel {
  border-color: rgba(26, 188, 156, 0.24);
}

.cb-console-access-status {
  margin: 14px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(26, 188, 156, 0.10);
  color: #0f766e;
  font-weight: 700;
}

.cb-console-member-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.cb-console-member-add select {
  width: 100%;
  border: 1px solid rgba(103, 119, 136, 0.24);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

.cb-console-member-list {
  display: grid;
  gap: 10px;
}

.cb-console-member-row,
.cb-console-member-empty {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.96);
  padding: 12px;
}

.cb-console-member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cb-console-member-row strong,
.cb-console-member-row span,
.cb-console-member-row small {
  display: block;
}

.cb-console-member-row span,
.cb-console-member-row small {
  color: #64748b;
}

@media (max-width: 760px) {
  .cb-console-editor-overlay {
    padding: 0;
  }
  .cb-console-editor-panel,
  .cb-console-editor-dialog {
    width: 100vw;
    max-width: 100%;
  }
  .cb-console-editor-panel .cb-console-editor-header,
  .cb-console-editor-dialog .cb-console-editor-header,
  .cb-console-editor-panel form,
  .cb-console-editor-dialog form,
  .cb-console-editor-panel .cb-console-editor-sections,
  .cb-console-editor-dialog .cb-console-editor-sections,
  .cb-console-editor-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
  .cb-console-member-add,
  .cb-console-member-row {
    grid-template-columns: 1fr;
  }
  .cb-console-member-row {
    display: grid;
  }
  .cb-console-member-row button,
  .cb-console-member-add button {
    width: 100%;
  }
  .cb-console-card-badges {
    align-items: flex-start;
  }
}

/* v5.7.1.1 Console editor scroll/access panel hotfix
   The form and access/launcher sections now share one scrollable body so
   Console Access remains reachable on desktop and mobile. */
.cb-console-editor-panel .cb-console-editor-body,
.cb-console-editor-dialog .cb-console-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 24px 24px;
  -webkit-overflow-scrolling: touch;
}

.cb-console-editor-panel .cb-console-editor-body form,
.cb-console-editor-dialog .cb-console-editor-body form,
.cb-console-editor-panel .cb-console-editor-body .cb-console-editor-sections,
.cb-console-editor-dialog .cb-console-editor-body .cb-console-editor-sections {
  padding-left: 0;
  padding-right: 0;
}

.cb-console-editor-panel .cb-console-editor-body form,
.cb-console-editor-dialog .cb-console-editor-body form {
  flex: initial;
  padding-top: 20px;
}

.cb-console-editor-panel .cb-console-editor-body .cb-console-editor-sections,
.cb-console-editor-dialog .cb-console-editor-body .cb-console-editor-sections {
  flex: initial;
  min-height: initial;
  overflow-y: visible;
  padding-bottom: 0;
}

.cb-console-editor-panel .cb-console-editor-footer,
.cb-console-editor-dialog .cb-console-editor-footer {
  position: relative;
  bottom: auto;
}

@media (max-width: 760px) {
  .cb-console-editor-panel .cb-console-editor-body,
  .cb-console-editor-dialog .cb-console-editor-body {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 18px;
  }
}

/* v5.7.2 Console Access Management Polish */
.cb-console-card {
  position: relative;
  overflow: hidden;
}

.cb-console-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, rgba(57, 198, 255, 0.85), rgba(26, 188, 156, 0.75));
}

.cb-console-card-badges {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cb-console-access-helper {
  margin-top: 12px !important;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(26, 188, 156, 0.10);
  color: #0f766e;
  font-size: 13px;
  line-height: 1.4;
}

.cb-console-editor-panel {
  width: min(940px, 94vw);
  background: #f7fbff;
}

.cb-console-editor-panel .cb-console-editor-header,
.cb-console-editor-dialog .cb-console-editor-header {
  background: linear-gradient(135deg, rgba(248, 251, 255, 0.98), rgba(236, 251, 255, 0.96));
  border-bottom: 1px solid rgba(83, 210, 255, 0.22);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.cb-console-editor-panel .cb-console-editor-body,
.cb-console-editor-dialog .cb-console-editor-body {
  background: #f7fbff;
}

.cb-console-editor-panel .cb-console-form-grid,
.cb-console-editor-dialog .cb-console-form-grid,
.cb-console-editor-panel .cb-console-placeholder-card,
.cb-console-editor-dialog .cb-console-placeholder-card,
.cb-console-editor-panel .cb-console-script-preview,
.cb-console-editor-dialog .cb-console-script-preview {
  border: 1px solid rgba(203, 213, 225, 0.76);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.cb-console-editor-panel .cb-console-form-grid,
.cb-console-editor-dialog .cb-console-form-grid {
  padding: 18px;
}

.cb-console-editor-sections {
  gap: 18px;
}

.cb-console-access-panel {
  border-color: rgba(26, 188, 156, 0.30) !important;
  background: linear-gradient(180deg, #ffffff 0%, rgba(240, 253, 250, 0.70) 100%) !important;
}

.cb-console-access-note {
  margin: -4px 0 14px !important;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

.cb-console-access-status {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(20, 184, 166, 0.18);
}

.cb-console-access-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #14b8a6;
  flex: 0 0 auto;
}

.cb-console-access-status.is-loading::before { background: #0ea5e9; }
.cb-console-access-status.is-empty::before { background: #94a3b8; }
.cb-console-access-status.is-error {
  background: rgba(254, 226, 226, 0.72);
  color: #991b1b;
  border-color: rgba(248, 113, 113, 0.32);
}
.cb-console-access-status.is-error::before { background: #ef4444; }
.cb-console-access-status.is-success::before { background: #22c55e; }

.cb-console-member-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border-color: rgba(20, 184, 166, 0.18);
  background: rgba(255, 255, 255, 0.95);
}

.cb-console-member-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(57, 198, 255, 0.18), rgba(26, 188, 156, 0.20));
  color: #0f766e;
  font-weight: 900;
}

.cb-console-member-main {
  min-width: 0;
}

.cb-console-member-main strong,
.cb-console-member-main span,
.cb-console-member-main small {
  display: block;
  overflow-wrap: anywhere;
}

.cb-console-member-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.cb-console-member-empty {
  display: grid;
  gap: 4px;
  color: #475569;
}

.cb-console-member-empty strong {
  color: #0f172a;
}

.cb-console-member-add {
  align-items: stretch;
}

.cb-console-member-add select:disabled,
.cb-console-member-add option:disabled {
  color: #94a3b8;
}

.cb-console-editor-footer {
  box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.08);
}

@media (max-width: 760px) {
  .cb-console-card-badges {
    justify-content: flex-start;
  }
  .cb-console-member-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .cb-console-member-role,
  .cb-console-member-row button {
    grid-column: 1 / -1;
    width: 100%;
  }
  .cb-console-editor-panel .cb-console-form-grid,
  .cb-console-editor-dialog .cb-console-form-grid {
    padding: 14px;
  }
}

/* v5.7.2.1 Console editor header + button styling hotfix */
.cb-console-editor-panel .cb-console-editor-header,
.cb-console-editor-dialog .cb-console-editor-header {
  padding: 18px 22px;
  min-height: auto;
  align-items: center;
  background: rgba(248, 251, 255, 0.98);
  box-shadow: none;
}

.cb-console-editor-panel .cb-console-editor-header h2,
.cb-console-editor-dialog .cb-console-editor-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  color: #0f172a;
}

.cb-console-editor-panel .cb-console-editor-header .cb-eyebrow,
.cb-console-editor-dialog .cb-console-editor-header .cb-eyebrow,
.cb-console-editor-panel .cb-console-editor-header p,
.cb-console-editor-dialog .cb-console-editor-header p {
  display: none;
}

.cb-console-editor-panel .cb-console-editor-close,
.cb-console-editor-dialog .cb-console-editor-close,
.cb-console-editor-panel .cb-modal-close,
.cb-console-editor-dialog .cb-modal-close {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: #ffffff;
  color: #334155;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.cb-console-editor-panel .cb-console-editor-body,
.cb-console-editor-dialog .cb-console-editor-body {
  padding-top: 16px;
}

.cb-console-editor-panel form,
.cb-console-editor-dialog form {
  padding-top: 0;
}

.cb-console-editor-footer .cb-btn,
.cb-console-editor-footer button,
.cb-console-script-actions .cb-btn,
.cb-console-script-actions button,
.cb-console-script-preview .cb-btn,
.cb-console-script-preview button {
  min-height: 42px;
  border-radius: 12px;
  font-weight: 800;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
}

.cb-console-editor-footer .cb-btn-secondary,
.cb-console-editor-footer button.cb-btn-secondary,
.cb-console-script-actions .cb-btn-secondary,
.cb-console-script-actions button.cb-btn-secondary,
.cb-console-script-preview .cb-btn-secondary,
.cb-console-script-preview button.cb-btn-secondary {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.cb-console-editor-footer .cb-btn-secondary:hover,
.cb-console-editor-footer button.cb-btn-secondary:hover,
.cb-console-script-actions .cb-btn-secondary:hover,
.cb-console-script-actions button.cb-btn-secondary:hover,
.cb-console-script-preview .cb-btn-secondary:hover,
.cb-console-script-preview button.cb-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.cb-console-editor-footer .cb-btn-secondary:focus,
.cb-console-editor-footer button.cb-btn-secondary:focus,
.cb-console-script-actions .cb-btn-secondary:focus,
.cb-console-script-actions button.cb-btn-secondary:focus,
.cb-console-script-preview .cb-btn-secondary:focus,
.cb-console-script-preview button.cb-btn-secondary:focus {
  outline: 2px solid rgba(57, 198, 255, 0.45);
  outline-offset: 2px;
}

.cb-console-script-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

@media (max-width: 680px) {
  .cb-console-editor-panel .cb-console-editor-header,
  .cb-console-editor-dialog .cb-console-editor-header {
    padding: 16px;
  }

  .cb-console-editor-panel .cb-console-editor-header h2,
  .cb-console-editor-dialog .cb-console-editor-header h2 {
    font-size: 21px;
  }

  .cb-console-editor-footer .cb-btn,
  .cb-console-editor-footer button,
  .cb-console-script-actions .cb-btn,
  .cb-console-script-actions button {
    width: 100%;
  }
}

/* v5.8.2.4 Console editor slide animation polish */
.cb-console-editor-overlay {
  opacity: 0;
  transition: opacity 220ms ease;
}

.cb-console-editor-overlay.is-open {
  opacity: 1;
}

.cb-console-editor-panel {
  transform: translateX(104%);
  transition: transform 260ms cubic-bezier(.22, 1, .36, 1);
  will-change: transform;
}

.cb-console-editor-overlay.is-open .cb-console-editor-panel {
  transform: translateX(0);
}

.cb-console-editor-overlay.is-closing {
  opacity: 0;
}

.cb-console-editor-overlay.is-closing .cb-console-editor-panel {
  transform: translateX(104%);
}

@media (prefers-reduced-motion: reduce) {
  .cb-console-editor-overlay,
  .cb-console-editor-panel {
    transition: none !important;
  }

  .cb-console-editor-panel {
    transform: none !important;
  }
}
