/* ── Component: WorkflowLauncher, CompanyThread, HumanReviewModal ──
 * Class prefix: thread-, workflow-, wf-
 */

/* ============================================================
   WORKFLOW ORCHESTRATION STYLES
   ============================================================ */

/* ---- Thread Panel ---- */
.thread-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 15, 25, 0.96);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}

.thread-panel--open {
  transform: translateX(0);
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  gap: 8px;
}

.thread-header-left {
  flex: 1;
  min-width: 0;
}

.thread-header-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.02em;
}

.thread-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.thread-new-btn {
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  border-radius: 6px;
  padding: 8px 14px;
  min-height: 44px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.thread-new-btn:hover {
  background: rgba(59, 130, 246, 0.28);
}

.thread-empty-launch-btn {
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.thread-empty-launch-btn:hover {
  background: rgba(59, 130, 246, 0.28);
}

.thread-close-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.thread-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

.thread-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thread-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  padding: 40px 20px;
}

/* ---- Workflow Item ---- */
.workflow-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workflow-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.workflow-item-title {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-item-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

/* ---- State Badge ---- */
.workflow-state-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.workflow-state-badge--pulse {
  animation: pulse-badge 1.8s ease-in-out infinite;
}

/* ---- Chain Pills ---- */
.workflow-chain-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-chain-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 3px 8px 3px 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.workflow-chain-pill-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

@keyframes review-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(249, 115, 22, 0); }
}

.review-btn {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s, transform 0.15s;
  animation: review-pulse 2s ease-in-out infinite;
  letter-spacing: 0.01em;
}

.review-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  animation: none;
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.4);
}

/* ---- Log Toggle & Entries ---- */
.workflow-log-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  cursor: pointer;
  text-align: left;
  padding: 2px 0;
  transition: color 0.2s;
}

.workflow-log-toggle:hover {
  color: rgba(255, 255, 255, 0.7);
}

.workflow-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.log-entry {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.log-entry-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-top: 1px;
}

.log-entry-content {
  flex: 1;
  min-width: 0;
}

.log-entry-top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.log-entry-name {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.log-entry-action {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

.log-entry-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-left: auto;
}

.log-entry-summary {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.log-entry-summary--expanded {
  display: block;
  overflow: visible;
  white-space: pre-wrap;
  -webkit-line-clamp: unset;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 4px;
  line-height: 1.5;
}

.log-entry-expand-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 0 0;
  display: block;
  transition: color 0.15s;
}

.log-entry-expand-btn:hover {
  color: rgba(255, 255, 255, 0.55);
}

/* ============================================================
   LAUNCH MODAL
   ============================================================ */
.launch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  padding: 24px;
}

.launch-modal {
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: rgba(18, 18, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.launch-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.launch-modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  margin: 0;
}

.launch-close-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  border-radius: 7px;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
}

.launch-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.launch-modal-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.launch-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.launch-cancel-btn {
  padding: 9px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: all 0.15s;
}
.launch-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.launch-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.launch-field-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.launch-field-label--small {
  font-size: 11px;
}

.launch-field-input,
.launch-field-textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.launch-field-input:focus,
.launch-field-textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(255, 255, 255, 0.07);
}

.launch-field-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ---- Launch Chain List ---- */
.launch-chain-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.launch-chain-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  transition: background 0.2s;
}

.launch-chain-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.launch-chain-checkbox {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: #3b82f6;
  cursor: pointer;
}

.launch-chain-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  cursor: pointer;
}

.launch-chain-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.launch-chain-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.launch-chain-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-left: 4px;
}

.launch-chain-handle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  cursor: grab;
  margin-left: auto;
}

.launch-subtasks-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.launch-subtask-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.launch-subtask-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

.launch-subtask-input {
  font-size: 16px;
}

.launch-timeout-info {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 6px;
}

.launch-timeout-icon {
  font-size: 14px;
}

.launch-submit-btn {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.launch-submit-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.launch-submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   HUMAN REVIEW MODAL
   ============================================================ */
.review-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 20px;
}

.review-modal {
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  max-height: 92dvh;
  background: rgba(14, 14, 22, 0.99);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.review-modal-header {
  position: sticky;
  top: 0;
  background: rgba(14, 14, 22, 0.99);
  padding: 20px 24px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  z-index: 1;
  flex-shrink: 0;
}

.review-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.review-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  margin: 0;
}

.review-modal-reason {
  font-size: 12px;
  color: rgba(249, 115, 22, 0.85);
  font-weight: 500;
}

.review-modal-close {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.review-modal-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.review-section-title {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
}

/* ---- Summary Bar ---- */
.review-summary-bar {
  display: flex;
  gap: 1px;
  padding: 0;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.review-summary-item {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.review-summary-item:last-child {
  border-right: none;
}

.review-summary-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.review-summary-value {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.review-summary-agents {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.review-summary-avatars {
  display: flex;
  gap: 3px;
}

.review-summary-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}

/* ---- Action Info Banner ---- */
.review-action-info-banner {
  padding: 12px 24px;
  background: rgba(124, 111, 247, 0.06);
  border-bottom: 1px solid rgba(124, 111, 247, 0.15);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.review-action-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.review-action-info-icon {
  font-size: 15px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.review-action-info-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 80px;
  flex-shrink: 0;
}
.review-action-info-value {
  color: #e0e0e8;
  font-weight: 600;
  word-break: break-all;
}

/* ---- Final Output Section ---- */
.review-final-output {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.review-final-output-text {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
}

.review-final-output-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.review-final-output-content {
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.82);
}

/* ---- Email Preview Card ---- */
.review-email-preview {
  margin: 0 24px 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.review-email-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}
.review-email-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(100, 180, 255, 0.15);
  color: #64b4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.review-email-header-text { flex: 1; }
.review-email-header-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}
.review-email-header-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 1px;
}
.review-email-meta {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.review-email-field {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
}
.review-email-field-label {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  min-width: 50px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.review-email-field-value {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}
.review-email-subject {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}
.review-email-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.82);
}

/* ---- Social Post Preview Card ---- */
.review-social-preview {
  margin: 0 24px 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.review-social-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}
.review-social-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(124, 111, 247, 0.15);
  color: #7C6FF7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.review-social-header-text { flex: 1; }
.review-social-header-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}
.review-social-header-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 1px;
}
.review-social-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.82);
}

/* ---- Final Action Card ---- */
.review-final-action-card {
  margin: 0 24px 4px;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review-final-action--email {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.review-final-action--trade {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.review-final-action--linkedin {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.review-final-action--image {
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.review-final-action--message {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.review-final-action--generic {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.review-fa-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.review-fa-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.review-fa-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.review-fa-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.review-fa-action-name {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.review-fa-executor {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-fa-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.review-fa-exec-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.review-fa-task {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 10px;
}

.review-fa-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.review-fa-detail-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.review-fa-detail-key {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.review-fa-detail-value {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-mono);
}

/* ---- Step Chain ---- */
.review-chain-section {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.review-chain-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.review-step {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.15s;
}

.review-step--approved {
  border-color: rgba(34, 197, 94, 0.25);
}

.review-step--escalated,
.review-step--revision_requested {
  border-color: rgba(249, 115, 22, 0.25);
}

.review-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  transition: background 0.15s;
}

.review-step-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.review-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
}

.review-step-num--approved {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.review-step-num--in_progress {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.review-step-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.review-step-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.review-step-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.review-step-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.review-step-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.review-step-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.review-step-status--approved {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.review-step-status--pending {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.review-step-status--in_progress {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.review-step-status--revision_requested {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.review-step-status--escalated {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.review-step-rev-badge {
  font-size: 10px;
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}

.review-step-chevron {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  transition: transform 0.2s;
}

.review-step-chevron--open {
  transform: rotate(180deg);
}

.review-step-subtask {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  padding: 0 14px 10px;
  line-height: 1.4;
}

.review-step-result {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
}

.review-step-image {
  display: block;
  width: 100%;
  max-width: 480px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.15s;
}
.review-step-image:hover { opacity: 0.88; }

.review-step-image-caption {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
  line-height: 1.4;
}

.review-step-image-expired {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255, 149, 0, 0.08);
  border: 1px solid rgba(255, 149, 0, 0.2);
  font-size: 12px;
  color: rgba(255, 200, 100, 0.85);
}
.review-step-image-expired a {
  color: rgba(160, 163, 255, 0.9);
  text-decoration: underline;
}

.review-step-connector {
  text-align: center;
  padding: 2px 0;
  position: relative;
}

.review-step-connector::before {
  content: '';
  display: block;
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 auto;
}

/* ---- Escalation Notice ---- */
.review-escalation-notice {
  margin: 0 28px;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

/* ---- Audit Log (in review modal) ---- */
.review-audit-section {
  padding: 16px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.review-audit-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
}

.review-audit-toggle:hover {
  color: rgba(255, 255, 255, 0.6);
}

.review-audit-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.review-audit-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}

.review-audit-name {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
}

.review-audit-action {
  color: rgba(255, 255, 255, 0.6);
}

.review-audit-time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
}

.review-audit-summary {
  width: 100%;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
  padding-left: 4px;
}

/* ---- Action Bar ---- */
.review-action-bar {
  position: sticky;
  bottom: 0;
  background: rgba(14, 14, 22, 0.99);
  padding: 14px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1;
  flex-shrink: 0;
}

.review-notes-wrap {
  width: 100%;
}

.review-notes-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.review-notes-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.2);
}

.review-btn-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.review-btn-approve {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.review-btn-approve:hover { opacity: 0.9; }

.review-btn-changes {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.review-btn-changes:hover {
  background: rgba(245, 158, 11, 0.25);
}

.review-btn-reject {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.review-btn-reject:hover {
  background: rgba(239, 68, 68, 0.22);
}

.review-changes-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  display: block;
  margin-bottom: 8px;
  width: 100%;
}

.review-changes-textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  font-family: inherit;
  width: 100%;
  resize: vertical;
  box-sizing: border-box;
}

.review-changes-textarea:focus {
  outline: none;
  border-color: rgba(245, 158, 11, 0.5);
}

.review-changes-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  width: 100%;
  margin-top: 8px;
}

.review-btn-changes-submit {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.review-btn-changes-submit:hover { opacity: 0.9; }

/* ============================================================
   AUDIT DASHBOARD
   ============================================================ */
.audit-dashboard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 20px;
}

.audit-dashboard {
  width: 100%;
  max-width: 900px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  background: rgba(12, 12, 20, 0.99);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

.audit-header {
  position: sticky;
  top: 0;
  background: rgba(12, 12, 20, 0.99);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  z-index: 1;
}

.audit-title {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.audit-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  transition: background 0.2s;
}

.audit-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ---- Stats Row ---- */
.audit-stats-row {
  display: flex;
  gap: 1px;
  padding: 20px 28px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.audit-stat-card {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.audit-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 4px;
}

.audit-stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- Filter Tabs ---- */
.audit-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 14px 28px 10px;
}

.audit-tab {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: all 0.2s;
}

.audit-tab:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.audit-tab--active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

/* ---- Audit Table ---- */
.audit-table-container {
  padding: 8px 28px 24px;
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.audit-table-row {
  transition: background 0.15s;
}

.audit-table-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.audit-table-row td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  vertical-align: middle;
}

.audit-td-title {
  font-weight: 500;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-td-chain {
  white-space: nowrap;
}

.audit-chain-pills {
  display: flex;
  gap: 3px;
}

.audit-chain-pill {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}

.audit-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 40px;
  font-size: 13px;
}

.audit-td-actions {
  white-space: nowrap;
}

.audit-rerun-btn {
  background: rgba(99, 102, 241, 0.15);
  color: rgba(160, 163, 255, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.audit-rerun-btn:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: rgba(99, 102, 241, 0.6);
}
.audit-rerun-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.audit-review-btn {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.15s;
  animation: review-pulse 2s ease-in-out infinite;
}

.audit-review-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  animation: none;
  box-shadow: 0 3px 12px rgba(249, 115, 22, 0.4);
}

/* ---- Expanded Row ---- */
.audit-expanded-row {
  background: rgba(255, 255, 255, 0.02);
}

.audit-expanded-cell {
  padding: 12px 24px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.audit-log-title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.audit-log-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}

.audit-log-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.audit-log-text {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
}

.audit-log-entry-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audit-log-summary {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.audit-log-summary--expanded {
  display: block;
  overflow: visible;
  white-space: pre-wrap;
  -webkit-line-clamp: unset;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 4px;
  line-height: 1.55;
}

.audit-log-expand-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  cursor: pointer;
  padding: 1px 0 0;
  text-align: left;
  transition: color 0.15s;
}

.audit-log-expand-btn:hover {
  color: rgba(255, 255, 255, 0.55);
}

/* ---- Image Preview (shared) ---- */
.review-preview-image-wrap {
  margin-bottom: 14px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.review-preview-image {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}

.review-preview-image:hover {
  opacity: 0.9;
}

/* ---- Final Action fields (in WorkflowLauncher) ---- */
.launch-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 4px 0 12px;
}

.launch-final-action-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.launch-final-action-toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
}

.launch-final-action-badge {
  font-size: 10px;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 20px;
  padding: 1px 7px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.launch-final-action-fields {
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 8px;
}

.launch-final-action-select {
  appearance: none;
  cursor: pointer;
}

/* ---- Audit expanded execution result ---- */
.audit-exec-result {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.audit-exec-result-body {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
  white-space: pre-wrap;
  background: rgba(6, 182, 212, 0.05);
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 6px;
}

/* ---- Workspace Header Buttons ---- */
/* Base styles now in hub.css (.workspace-action-btn) */

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.8; }
}

.workflow-review-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: #f97316;
  border-radius: 50%;
  animation: dot-pulse 1.5s ease-in-out infinite;
  border: 1.5px solid rgba(0,0,0,0.3);
}

/* ============================================================
   STEP BUILDER (WorkflowLauncher)
   ============================================================ */

/* Steps section header: label + hint on same row */
.launch-steps-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.launch-steps-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

/* ── Config section: title, brief, terminal state ── */
.launch-config-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── WHAT section: goal-first textarea ── */
.launch-what-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.launch-what-textarea {
  min-height: 100px;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}
.launch-what-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
}
.launch-title-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: -4px;
}

/* ── Advanced section: collapsed step builder + title ── */
.launch-advanced-section {
  margin-top: 4px;
}
.launch-advanced-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm, 6px);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  padding: 8px 12px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: color 0.15s, border-color 0.15s;
}
.launch-advanced-toggle:hover {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
}
.launch-advanced-chevron {
  display: inline-block;
  font-size: 10px;
  margin-right: 6px;
  transition: transform 0.15s;
}
.launch-advanced-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 0 0;
}

/* ── Steps section ── */
.launch-steps-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Container for all step cards + connectors */
.launch-steps-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Step card: header bar + full-width textarea */
.launch-step-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.launch-step-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Card header: left(num+avatar+select) + controls on right */
.launch-step-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Left cluster: number badge + avatar + mini dropdown */
.launch-step-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Step number badge */
.launch-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
}

/* Mini avatar (filled with agent color when selected) */
.launch-step-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

/* Mini dropdown */
.launch-step-mini-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 5px 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  max-width: 150px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.3)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.launch-step-mini-select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
}

.launch-step-mini-select option {
  background: #1a1a2e;
  color: rgba(255, 255, 255, 0.85);
}

/* Task description textarea (full width inside card) */
.launch-step-task-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  padding: 12px 14px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  min-height: 72px;
  transition: background 0.2s;
}

.launch-step-task-textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.02);
}

.launch-step-task-textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

/* Up / Down / Remove controls */
.launch-step-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.launch-step-ctrl-btn {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.4);
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}

.launch-step-ctrl-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.18);
}

.launch-step-ctrl-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Remove (×) button — slightly red-tinted */
.launch-step-remove-btn {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.06);
  color: rgba(239, 68, 68, 0.5);
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  margin-left: 3px;
}

.launch-step-remove-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.launch-step-remove-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Arrow connector between steps */
.launch-step-connector {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  padding: 3px 0;
  line-height: 1;
}

/* + Add Step button */
.launch-add-step-btn {
  align-self: flex-start;
  margin-top: 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px dashed rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.launch-add-step-btn:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
}

/* ============================================================
   SAVED WORKFLOW PICKER (WorkflowLauncher)
   ============================================================ */
.launch-saved-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.launch-saved-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.launch-saved-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.launch-saved-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.launch-saved-chip--preset {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

.launch-saved-chip--preset:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.5);
}

.launch-saved-chip-del {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.15s;
}

.launch-saved-chip-del:hover {
  color: #ef4444;
}

/* ============================================================
   SCHEDULE SECTION (WorkflowLauncher — collapsible in modal body)
   ============================================================ */
.sched-section {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  transition: border-color 0.2s;
  position: relative;
  z-index: 1;
}

.sched-section:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* ── Toggle header ── */
.sched-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  position: relative;
  z-index: 2;
}

.sched-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.sched-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sched-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.sched-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.sched-toggle-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 1px;
}

.sched-toggle-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Schedule pill (shows current config when collapsed) ── */
.sched-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 7px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: #22c55e;
}

.sched-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22c55e;
  animation: sched-pulse 2s infinite;
}

@keyframes sched-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sched-pill-text {
  white-space: nowrap;
}

/* ── Chevron ── */
.sched-chevron {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  transition: transform 0.2s;
}

.sched-chevron--open {
  transform: rotate(180deg);
}

/* ── Collapsible body ── */
.sched-body {
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sched-body--open {
  display: flex;
}

/* ── Frequency tabs (4-col grid) ── */
.sched-freq-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 3px;
  margin-top: 14px;
}

.sched-freq-tab {
  padding: 7px 4px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.sched-freq-tab:hover:not(.sched-freq-tab--active) {
  color: rgba(255, 255, 255, 0.7);
}

.sched-freq-tab--active {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ── Tab views ── */
.sched-view {
  display: none;
}

.sched-view--active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sched-view-info {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  line-height: 1.5;
}

.sched-view-info strong {
  color: rgba(255, 255, 255, 0.7);
}

/* ── Section labels ("When", "Repeat", "On execution") ── */
.sched-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.sched-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

/* ── Time grid ── */
.sched-time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sched-time-grid.three {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ── Mini field (date, time, frequency, etc.) ── */
.sched-mini-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sched-mini-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.sched-mini-input,
.sched-mini-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
  color-scheme: dark;
}

.sched-mini-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.3)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.sched-mini-input:focus,
.sched-mini-select:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

.sched-mini-select option {
  background: #1a1a2e;
  color: rgba(255, 255, 255, 0.85);
}

/* ── Preview box ── */
.sched-preview {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 6px;
  font-size: 12px;
  min-height: 20px;
}

.sched-preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
  margin-top: 4px;
}

.sched-preview-text {
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
}

.sched-preview-text strong {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.sched-preview-next {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  margin-top: 3px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Approval section ── */
.sched-approval-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sched-approval-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.sched-approval-opt {
  flex: 1;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sched-approval-opt:last-child {
  border-right: none;
}

.sched-approval-opt:hover:not(.sched-approval-opt--active) {
  background: rgba(255, 255, 255, 0.03);
}

.sched-approval-opt--active {
  background: rgba(59, 130, 246, 0.08);
}

.sched-approval-opt-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sched-approval-opt--active .sched-approval-opt-label {
  color: #60a5fa;
}

.sched-approval-opt-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 3px;
  line-height: 1.4;
}

.sched-opt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
  position: relative;
}

.sched-approval-opt--active .sched-opt-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #60a5fa;
}

/* ── Repeat section (Recurring/Interval) ── */
.sched-repeat-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sched-repeat-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.sched-repeat-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.sched-repeat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sched-repeat-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sched-repeat-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

.sched-repeat-input {
  width: 64px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 7px 10px;
  color: rgba(255, 255, 255, 0.85);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}

.sched-repeat-input:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

.sched-repeat-input:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.sched-repeat-forever {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.15s;
}

.sched-repeat-forever--active {
  color: #60a5fa;
}

.sched-repeat-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.sched-repeat-checkbox:checked {
  background: #3b82f6;
  border-color: #3b82f6;
}

.sched-repeat-checkbox:checked::after {
  content: '\2713';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  color: #fff;
  font-weight: 700;
}

/* ── Green "Schedule Workflow" button variant ── */
.launch-submit-btn--scheduled {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.launch-submit-btn--scheduled:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d988, #22c55e);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

/* ── Save checkbox label ── */
.launch-option-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

/* ============================================================
   SCHEDULE CARDS IN CompanyThread
   ============================================================ */
.thread-schedules-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.thread-schedules-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thread-schedules-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.thread-schedule-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.15s;
}

.thread-schedule-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.thread-schedule-card--disabled {
  opacity: 0.45;
}

.thread-schedule-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thread-schedule-type {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.thread-schedule-type.recurring {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.thread-schedule-type.one-time {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.thread-schedule-name {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-schedule-next {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  flex-shrink: 0;
}

.thread-schedule-timing {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

.thread-schedule-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.thread-schedule-btn {
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: all 0.15s;
}

.thread-schedule-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.thread-schedule-btn.primary {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.thread-schedule-btn.primary:hover {
  background: rgba(99, 102, 241, 0.3);
}

.thread-schedule-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.thread-schedule-toggle {
  position: relative;
  width: 28px;
  height: 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.thread-schedule-toggle.active {
  background: rgba(34, 197, 94, 0.5);
}

.thread-schedule-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.thread-schedule-toggle.active::after {
  transform: translateX(12px);
}

/* Event Triggers */
.thread-trigger-type {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  background: rgba(34, 211, 238, 0.15);
  color: #22d3ee;
}

.thread-trigger-stats {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
}

/* Trigger as workflow item */
.workflow-item--trigger {
  border-left: 2px solid rgba(34, 211, 238, 0.4);
}

.workflow-state-badge--trigger-waiting {
  background: rgba(34, 211, 238, 0.8) !important;
}

.workflow-trigger-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 0;
}

.workflow-trigger-filter {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}

.workflow-trigger-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}



/* Missed runs banner */
.thread-missed-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  font-size: 0.8rem;
  color: #FCD34D;
}

.thread-missed-dismiss {
  background: none;
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #FCD34D;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
}

.thread-missed-dismiss:hover {
  background: rgba(251, 191, 36, 0.15);
}

/* ── Tablet (≤ 768px): thread panel full-width, bottom sheets ── */
@media (max-width: 768px) {
  .thread-panel {
    width: 100%;
  }

  .launch-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .launch-modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    max-height: 92dvh;
  }

  .launch-modal-header {
    padding: 18px 20px 14px;
  }

  .launch-modal-body {
    padding: 20px;
    gap: 18px;
  }

  .launch-modal-footer {
    padding: 14px 20px calc(14px + var(--safe-bottom, 0px));
  }

  .review-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .review-modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    max-height: 92dvh;
  }

  .review-action-bar {
    padding-bottom: calc(14px + var(--safe-bottom, 0px));
  }
}

/* ── Small phones (≤ 480px): tighter spacing ── */
@media (max-width: 480px) {
  .thread-panel {
    width: 100%;
  }

  .thread-header {
    padding: 12px 12px 10px;
  }

  .launch-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .launch-modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 94vh;
    max-height: 94dvh;
  }

  .launch-modal-header {
    padding: 14px 16px 12px;
  }

  .launch-modal-header h2 {
    font-size: 16px;
  }

  .launch-modal-body {
    padding: 16px;
    gap: 16px;
  }

  .launch-modal-footer {
    padding: 12px 16px calc(12px + var(--safe-bottom, 0px));
    gap: 8px;
  }

  .launch-modal-footer .glass-btn {
    min-height: 44px;
    font-size: 14px;
  }

  .launch-chain-item {
    padding: 10px 12px;
  }

  .launch-chain-checkbox {
    width: 20px;
    height: 20px;
  }

  .review-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .review-modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 94vh;
    max-height: 94dvh;
  }

  .review-action-bar {
    padding: 12px 16px calc(12px + var(--safe-bottom, 0px));
    flex-wrap: wrap;
    gap: 8px;
  }

  .review-action-bar .glass-btn {
    min-height: 44px;
    flex: 1;
    min-width: 0;
  }

  /* Trade card price grid: 2x2 on phones */
  .trade-card-prices {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── Workflow list items ── */
  .workflow-item {
    padding: 10px;
  }

  .workflow-item-title {
    font-size: 13px;
  }

  .workflow-item-time {
    font-size: 12px;
  }

  .workflow-state-badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  /* ── Log entries ── */
  .log-entry-name {
    font-size: 12px;
  }

  .log-entry-action {
    font-size: 12px;
  }

  .log-entry-time {
    font-size: 11px;
  }

  .log-entry-summary {
    font-size: 12px;
  }

  .log-entry-expand-btn {
    font-size: 11px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }

  /* ── Review modal ── */
  .review-modal-header {
    padding: 16px 16px 12px;
  }

  .review-modal-title {
    font-size: 16px;
  }

  .review-modal-reason {
    font-size: 12px;
  }

  .review-section-title {
    font-size: 11px;
  }

  /* Review summary bar: stack vertically on phones */
  .review-summary-bar {
    flex-direction: column;
    gap: 0;
  }

  .review-summary-item {
    padding: 10px 16px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .review-summary-item:last-child {
    border-bottom: none;
  }

  /* Review step chain */
  .review-chain-section {
    padding: 14px 16px;
  }

  .review-step-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .review-step-avatar {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .review-step-name {
    font-size: 12px;
  }

  .review-step-right {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .review-step-result {
    padding: 10px 12px;
    font-size: 12px;
  }

  .review-step-image {
    max-width: 100%;
  }

  .review-step-subtask {
    padding: 0 12px 8px;
    font-size: 11px;
  }

  /* Final action card */
  .review-fa-action-name {
    font-size: 14px;
  }

  .review-fa-details {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
  }

  .review-fa-detail-value {
    font-size: 13px;
  }

  .review-fa-task {
    font-size: 12px;
    padding: 8px;
  }

  /* Action bar buttons: full width, stacked */
  .review-action-bar {
    padding: 12px 16px calc(12px + var(--safe-bottom, 0px));
  }

  .review-btn-row {
    flex-direction: column;
    gap: 8px;
  }

  .review-btn-approve,
  .review-btn-changes,
  .review-btn-reject {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    text-align: center;
    font-size: 14px;
  }

  .review-changes-actions {
    flex-direction: column;
  }

  .review-btn-changes-submit {
    min-height: 44px;
    font-size: 14px;
  }

  /* ── Audit dashboard ── */
  .audit-dashboard-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .audit-dashboard {
    max-width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: 16px 16px 0 0;
  }

  .audit-header {
    padding: 16px 16px 12px;
  }

  .audit-title {
    font-size: 16px;
  }

  .audit-close-btn {
    width: 44px;
    height: 44px;
  }

  .audit-stats-row {
    padding: 14px 16px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .audit-stat-card {
    min-width: 0;
    padding: 10px 6px;
  }

  .audit-stat-value {
    font-size: 20px;
  }

  .audit-stat-label {
    font-size: 10px;
  }

  .audit-filter-tabs {
    padding: 12px 16px 8px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .audit-tab {
    min-height: 36px;
    display: flex;
    align-items: center;
    font-size: 12px;
  }

  .audit-table-container {
    padding: 8px 12px 20px;
  }

  .audit-table {
    font-size: 12px;
  }

  .audit-table th {
    padding: 6px 8px;
    font-size: 9px;
  }

  .audit-table-row td {
    padding: 8px;
  }

  .audit-td-title {
    max-width: 140px;
    font-size: 12px;
  }

  /* Hide chain column on mobile — too wide */
  .audit-td-chain {
    display: none;
  }

  .audit-rerun-btn,
  .audit-review-btn {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .audit-expanded-cell {
    padding: 10px 12px !important;
  }

  /* ── Schedule cards ── */
  .thread-schedule-card-top {
    flex-wrap: wrap;
  }

  .thread-schedule-next {
    width: 100%;
    margin-top: 2px;
  }

  .thread-schedule-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .thread-schedule-btn {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 11px;
  }

  .thread-missed-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .thread-missed-dismiss {
    min-height: 36px;
    padding: 6px 14px;
  }
}

/* ── Extra-small phones (≤ 375px) ── */
@media (max-width: 375px) {
  .thread-header {
    padding: 10px 10px 8px;
  }

  .thread-new-btn {
    padding: 6px 10px;
    font-size: 10px;
  }

  .launch-modal-header {
    padding: 12px 14px 10px;
  }

  .launch-modal-header h2 {
    font-size: 15px;
  }

  .launch-modal-body {
    padding: 14px;
    gap: 14px;
  }

  .launch-modal-footer {
    padding: 10px 14px calc(10px + var(--safe-bottom, 0px));
  }

  .review-modal-header {
    padding: 14px 14px 10px;
  }

  .review-modal-title {
    font-size: 15px;
  }

  .review-chain-section {
    padding: 12px 14px;
  }

  .review-step-header {
    padding: 8px 10px;
  }

  .review-action-bar {
    padding: 10px 14px calc(10px + var(--safe-bottom, 0px));
  }

  .audit-header {
    padding: 14px 14px 10px;
  }

  .audit-title {
    font-size: 15px;
  }

  .audit-stats-row {
    padding: 12px 14px;
  }

  .audit-stat-value {
    font-size: 18px;
  }

  .audit-filter-tabs {
    padding: 10px 14px 6px;
  }

  .audit-table-container {
    padding: 6px 10px 16px;
  }

  .audit-td-title {
    max-width: 110px;
  }
}

/* ═══════════════════════════════════════════════════
   Trigger Section — Event & Time Based
   ═══════════════════════════════════════════════════ */

.trigger-section {
  margin-bottom: 8px;
}

.trigger-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(180,140,255,0.7);
  margin-bottom: 10px;
}

.trigger-radio-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.trigger-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(200,202,223,0.8);
}
.trigger-radio-label input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(200,202,223,0.3);
  border-radius: 50%;
  margin: 0;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.trigger-radio-label input[type="radio"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7C6FF7;
  transform: scale(0);
  transition: transform 0.15s ease;
}
.trigger-radio-label input[type="radio"]:checked {
  border-color: #7C6FF7;
}
.trigger-radio-label input[type="radio"]:checked::before {
  transform: scale(1);
}

.trigger-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 10px 0;
}

/* Config container */
.trigger-config {
  margin-top: 10px;
}

/* Time hint */
.trigger-time-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  color: rgba(200,202,223,0.5);
  font-size: 12px;
}
.trigger-time-hint-icon {
  font-size: 14px;
  opacity: 0.5;
}

/* ── Event Panel — Radio List ── */
.trigger-event-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
@media (max-width: 500px) {
  .trigger-event-list { grid-template-columns: 1fr; }
}

.trigger-event-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(200,202,223,0.75);
  transition: background 0.12s ease, color 0.12s ease;
}
.trigger-event-option:hover {
  background: rgba(255,255,255,0.04);
}
.trigger-event-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(200,202,223,0.25);
  border-radius: 50%;
  margin: 0;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.trigger-event-option input[type="radio"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7C6FF7;
  transform: scale(0);
  transition: transform 0.15s ease;
}
.trigger-event-option input[type="radio"]:checked {
  border-color: #7C6FF7;
}
.trigger-event-option input[type="radio"]:checked::before {
  transform: scale(1);
}
.trigger-event-option--active {
  color: #C8CADF;
  background: rgba(124,111,247,0.08);
}
.trigger-event-option--soon {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}
.trigger-soon-badge {
  font-size: 9px;
  font-weight: 600;
  color: rgba(200,202,223,0.4);
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: auto;
}

/* Run mode row */
.trigger-run-mode-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
}
.trigger-run-mode-hint {
  display: block;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  margin-left: auto;
}

/* ── Event Config Area ── */
.trigger-event-config {
  margin-top: 10px;
}
.trigger-event-config-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  animation: triggerConfigIn 0.15s ease-out;
}
@keyframes triggerConfigIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.trigger-cfg-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(200,202,223,0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.trigger-cfg-label:first-child {
  margin-top: 0;
}

.trigger-cfg-select {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #C8CADF;
  font-size: 12px;
  outline: none;
}
.trigger-cfg-select:focus {
  border-color: rgba(124,111,247,0.4);
}

.trigger-cfg-input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #C8CADF;
  font-size: 12px;
  outline: none;
}
.trigger-cfg-input:focus {
  border-color: rgba(124,111,247,0.4);
}
.trigger-cfg-input::placeholder {
  color: rgba(200,202,223,0.3);
}

.trigger-filter-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
}

/* Chip toggles */
.trigger-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.trigger-chip {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(200,202,223,0.65);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.trigger-chip:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.14);
}
.trigger-chip--active {
  background: rgba(124,111,247,0.15);
  border-color: rgba(124,111,247,0.45);
  color: #A99EFF;
}

/* Webhook URL block */
.trigger-webhook-url {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
}
.trigger-webhook-url code {
  flex: 1;
  font-family: 'Fira Code', 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #A99EFF;
  word-break: break-all;
}
.trigger-webhook-copy {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid rgba(124,111,247,0.3);
  border-radius: 5px;
  background: rgba(124,111,247,0.1);
  color: #A99EFF;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.trigger-webhook-copy:hover {
  background: rgba(124,111,247,0.2);
}

/* ── Mobile: stack event grid to 1 col ── */
@media (max-width: 480px) {
  .trigger-event-grid {
    grid-template-columns: 1fr;
  }
  .trigger-filter-row {
    grid-template-columns: 1fr;
  }
}

/* ── Landscape mode: phones held sideways ── */
@media (orientation: landscape) and (max-height: 500px) {
  .launch-modal { max-height: 94vh; max-height: 94dvh; border-radius: 12px; }
  .review-modal { max-height: 94vh; max-height: 94dvh; border-radius: 12px; }
  .audit-dashboard { max-height: 94vh; max-height: 94dvh; border-radius: 12px; }
}

/* ============================================================
   TEMPLATE CHIPS (v3.0)
   ============================================================ */
.launch-saved-chip--template {
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
.launch-saved-chip--template:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.55);
}

/* ============================================================
   CONDITION GATE (v3.0)
   ============================================================ */
.condition-gate-section {
  padding: 8px 0 4px;
}
.condition-gate-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}
.condition-gate-label {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}
.condition-gate-config {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 0 4px 24px;
}
.condition-gate-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  padding: 5px 8px;
  min-width: 120px;
}
.condition-gate-select--narrow {
  min-width: 55px;
}
.condition-gate-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  padding: 5px 8px;
  width: 70px;
}
.condition-gate-debounce-label {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-left: 4px;
}

/* ============================================================
   APPROVAL RADIO GROUP (v3.0)
   ============================================================ */
.launch-approval-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}
.launch-approval-radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.launch-approval-radio-row:hover {
  background: rgba(255,255,255,0.04);
}
.launch-approval-radio-row--active {
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.06);
}
.launch-approval-radio {
  margin-top: 3px;
  accent-color: #6366f1;
}
.launch-approval-radio-text {
  flex: 1;
}
.launch-approval-radio-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
}
.launch-approval-radio-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
}

/* ============================================================
   STEP REVERSIBILITY WARNING (v3.0)
   ============================================================ */
.launch-step-irreversible {
  font-size: 11px;
  color: #fbbf24;
  padding: 4px 8px;
  background: rgba(251,191,36,0.06);
  border-radius: 4px;
  margin-top: 4px;
}
