/* ==========================================================================
   AGENTOPS IDEATION STUDIO // LIVE VISUAL PREVIEW DRAWER (GOOGLE STITCH)
   frontend/voice-discovery-stitch.css
   ========================================================================== */

#vd-stitch-preview-dock[hidden],
#vd-stitch-dock-body[hidden],
#vd-stitch-loading[hidden],
#vd-stitch-empty[hidden],
#vd-stitch-modal[hidden],
#btn-vd-stitch-cancel[hidden],
#vd-stitch-tabs[hidden],
#btn-vd-stitch-pull-tab[hidden],
#vd-stitch-pull-tab-spinner[hidden],
#vd-stitch-generating-strip[hidden],
#btn-vd-generate-stitch[hidden],
#vd-stitch-inline-error[hidden],
#vd-stitch-refine-bar[hidden],
#vd-stitch-plan-panel[hidden],
#vd-stitch-add-screen-bar[hidden],
#btn-vd-stitch-plan-prd[hidden],
#btn-vd-stitch-add-screen-toggle[hidden] { display: none !important; }

.vd-stitch-dock,
#vd-stitch-preview-dock {
  position: fixed;
  top: 12px;
  bottom: 12px;
  right: 0;
  z-index: 80;
  width: min(max(60vw, 760px), calc(100vw - 56px));
  max-width: calc(100vw - 56px);
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: visible;
  pointer-events: none;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

#vd-stitch-preview-dock.is-open,
#vd-stitch-preview-dock[data-drawer-open="true"] {
  transform: translateX(0);
}

/* Inner Panel (clips contents cleanly while outer drawer keeps pull-tab visible) */
.vd-stitch-drawer-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  background-color: var(--vd-surface-card, #111827);
  border: 1px solid var(--vd-border-subtle, #1F2937);
  border-right: 0;
  border-radius: var(--vd-radius-lg, 12px) 0 0 var(--vd-radius-lg, 12px);
  box-shadow: -14px 8px 36px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.28s;
}

#vd-stitch-preview-dock.is-open .vd-stitch-drawer-panel,
#vd-stitch-preview-dock[data-drawer-open="true"] .vd-stitch-drawer-panel {
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s linear 0s;
}

/* Persistent Right-Edge Pull-Tab */
.vd-stitch-pull-tab {
  position: absolute;
  top: min(calc(var(--vd-header-height, 95px) + 6px), 160px);
  right: 100%;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 12px 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: auto;
  cursor: pointer;
  background-color: var(--vd-surface-elevated, #161F30);
  color: var(--vd-text-primary, #F9FAFB);
  border: 1px solid rgba(59, 130, 246, 0.55);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  box-shadow: -6px 4px 20px rgba(0, 0, 0, 0.45);
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.2s ease, color 0.16s ease;
}

.vd-stitch-pull-tab:hover {
  background-color: #1E293B;
  border-color: rgba(96, 165, 250, 0.85);
}

.vd-stitch-pull-tab:focus-visible {
  outline: 2px solid var(--vd-border-focus, #60A5FA);
  outline-offset: 2px;
}

.vd-stitch-pull-tab-chevron {
  flex-shrink: 0;
  color: #93C5FD;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

#vd-stitch-preview-dock.is-open .vd-stitch-pull-tab-chevron,
#vd-stitch-preview-dock[data-drawer-open="true"] .vd-stitch-pull-tab-chevron,
.vd-stitch-pull-tab.is-open .vd-stitch-pull-tab-chevron {
  transform: rotate(180deg);
}

.vd-stitch-pull-tab-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  background-color: rgba(11, 15, 23, 0.75);
  border: 1px solid currentColor;
  box-shadow: 0 0 10px currentColor;
  flex-shrink: 0;
}

.vd-stitch-pull-tab-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--vd-font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
}

.vd-stitch-pull-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 5px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  background-color: rgba(59, 130, 246, 0.24);
  border: 1px solid rgba(96, 165, 250, 0.5);
  color: #DBEAFE;
}

.vd-stitch-pull-tab[data-status="queued"] {
  background-color: #0F1E2E;
  color: #CFFAFE;
  border-color: rgba(34, 211, 238, 0.9);
  box-shadow: -6px 0 22px rgba(6, 182, 212, 0.45), inset 0 0 0 1px rgba(103, 232, 249, 0.28);
  animation: vd-stitch-pulse-cyan 1.8s ease-in-out infinite;
}

.vd-stitch-pull-tab[data-status="queued"] .vd-stitch-pull-tab-spinner,
.vd-stitch-pull-tab[data-status="queued"] .vd-stitch-spinner-svg {
  color: #22D3EE;
}

.vd-stitch-pull-tab[data-status="synthesizing"],
.vd-stitch-pull-tab.is-generating[data-status="synthesizing"] {
  background-color: #1E1B12;
  color: #FEF3C7;
  border-color: rgba(245, 158, 11, 0.92);
  box-shadow: -6px 0 24px rgba(245, 158, 11, 0.48), inset 0 0 0 1px rgba(252, 211, 77, 0.32);
  animation: vd-stitch-pulse-amber 1.6s ease-in-out infinite;
}

.vd-stitch-pull-tab[data-status="synthesizing"] .vd-stitch-pull-tab-spinner,
.vd-stitch-pull-tab[data-status="synthesizing"] .vd-stitch-spinner-svg {
  color: #FBBF24;
}

.vd-stitch-pull-tab[data-status="ready"] {
  border-color: rgba(16, 185, 129, 0.7);
  color: #ECFDF5;
}

.vd-stitch-pull-tab[data-status="failed"] {
  border-color: rgba(239, 68, 68, 0.8);
  background-color: #251318;
  color: #FEE2E2;
}

.vd-stitch-pull-tab[data-status="cancelled"] {
  border-color: rgba(148, 163, 184, 0.6);
  color: #E2E8F0;
}

/* Cabinet Header */
.vd-stitch-dock-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px; min-width: 0; padding: 12px 14px;
  background-color: var(--vd-surface-elevated, #161F30);
  border-bottom: 1px solid var(--vd-border-subtle, #1F2937);
  flex-shrink: 0;
}

.vd-stitch-dock-title-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }

.vd-stitch-dock-title {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font-family: var(--vd-font-mono, monospace); font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--vd-text-primary, #F9FAFB);
}

.vd-stitch-dock-icon { color: var(--vd-accent-primary, #3B82F6); display: inline-flex; align-items: center; flex-shrink: 0; }

.vd-stitch-status-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 9999px;
  font-family: var(--vd-font-mono, monospace); font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  border: 1px solid var(--vd-border-subtle, #1F2937);
  background-color: rgba(15, 23, 42, 0.75); color: var(--vd-text-secondary, #D1D5DB); white-space: nowrap;
}

.vd-stitch-status-badge[data-status="queued"]::before,
.vd-stitch-status-badge[data-status="synthesizing"]::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: vd-stitch-dot-pulse 1.15s ease-in-out infinite;
  flex-shrink: 0;
}

#vd-stitch-preview-dock[data-stitch-status="idle"] .vd-stitch-status-badge,
.vd-stitch-status-badge[data-status="idle"] {
  color: var(--vd-text-secondary, #D1D5DB); border-color: var(--vd-border-subtle, #1F2937); background-color: rgba(17, 24, 39, 0.85);
}

#vd-stitch-preview-dock[data-stitch-status="queued"] .vd-stitch-status-badge,
.vd-stitch-status-badge[data-status="queued"] {
  color: #67E8F9; border-color: rgba(6, 182, 212, 0.55); background-color: rgba(6, 182, 212, 0.16);
}

#vd-stitch-preview-dock[data-stitch-status="synthesizing"] .vd-stitch-status-badge,
.vd-stitch-status-badge[data-status="synthesizing"] {
  color: #FCD34D; border-color: rgba(245, 158, 11, 0.65); background-color: rgba(245, 158, 11, 0.18);
}

#vd-stitch-preview-dock[data-stitch-status="ready"] .vd-stitch-status-badge,
.vd-stitch-status-badge[data-status="ready"] {
  color: #34D399; border-color: rgba(16, 185, 129, 0.5); background-color: rgba(16, 185, 129, 0.16);
}

#vd-stitch-preview-dock[data-stitch-status="failed"] .vd-stitch-status-badge,
.vd-stitch-status-badge[data-status="failed"] {
  color: #FCA5A5; border-color: rgba(239, 68, 68, 0.6); background-color: rgba(239, 68, 68, 0.18);
}

#vd-stitch-preview-dock[data-stitch-status="cancelled"] .vd-stitch-status-badge,
.vd-stitch-status-badge[data-status="cancelled"] {
  color: #CBD5E1; border-color: rgba(148, 163, 184, 0.5); background-color: rgba(148, 163, 184, 0.16);
}

.vd-stitch-screen-counter {
  font-family: var(--vd-font-mono, monospace); font-size: 11px; font-weight: 600;
  color: var(--vd-text-secondary, #D1D5DB); background-color: var(--vd-bg-primary, #0B0F17);
  border: 1px solid var(--vd-border-subtle, #1F2937); padding: 2px 8px;
  border-radius: var(--vd-radius-sm, 4px); white-space: nowrap;
}

.vd-stitch-dock-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.vd-stitch-action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 8px 11px; border-radius: 6px;
  font-family: var(--vd-font-sans, sans-serif); font-size: 12px; font-weight: 600;
  color: var(--vd-text-primary, #F9FAFB); background-color: var(--vd-surface-card, #111827);
  border: 1px solid var(--vd-border-subtle, #1F2937); cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.vd-stitch-action-btn:hover:not(:disabled) {
  background-color: rgba(59, 130, 246, 0.16); border-color: rgba(59, 130, 246, 0.55);
}

.vd-stitch-action-btn:focus-visible,
.vd-stitch-tab:focus-visible { outline: 2px solid var(--vd-border-focus, #60A5FA); outline-offset: 2px; }
.vd-stitch-action-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.vd-stitch-action-btn.vd-stitch-btn-cancel {
  color: #FCA5A5; border-color: rgba(239, 68, 68, 0.5); background-color: rgba(239, 68, 68, 0.14);
}

.vd-stitch-action-btn.vd-stitch-btn-cancel:hover:not(:disabled) {
  background-color: rgba(239, 68, 68, 0.26); border-color: #EF4444;
}

.vd-stitch-toggle-chevron {
  transition: transform 0.22s ease;
}
#vd-stitch-preview-dock:not(.is-open) .vd-stitch-toggle-chevron {
  transform: rotate(180deg);
}

/* Body & Non-Blocking Top Shimmer/Progress Strip */
.vd-stitch-dock-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.vd-stitch-generating-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 14px 10px;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.14), rgba(245, 158, 11, 0.14));
  border-bottom: 1px solid rgba(245, 158, 11, 0.4);
  flex-shrink: 0;
}

.vd-stitch-generating-strip[data-status="queued"] {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.18), rgba(59, 130, 246, 0.16));
  border-bottom-color: rgba(6, 182, 212, 0.45);
}

.vd-stitch-generating-strip-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.vd-stitch-strip-spinner {
  color: #FCD34D;
  flex-shrink: 0;
}

.vd-stitch-generating-strip[data-status="queued"] .vd-stitch-strip-spinner {
  color: #67E8F9;
}

.vd-stitch-generating-label {
  font-family: var(--vd-font-mono, monospace);
  font-size: 11.5px;
  font-weight: 700;
  color: #FEF3C7;
  white-space: nowrap;
}

.vd-stitch-generating-strip[data-status="queued"] .vd-stitch-generating-label {
  color: #CFFAFE;
}

.vd-stitch-generating-detail {
  font-family: var(--vd-font-sans, sans-serif);
  font-size: 11.5px;
  color: #E5E7EB;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.vd-stitch-progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 9999px;
  background-color: rgba(15, 23, 42, 0.9);
  overflow: hidden;
}

.vd-stitch-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #06B6D4, #F59E0B, #3B82F6);
  animation: vd-stitch-shimmer-slide 1.4s ease-in-out infinite;
}

/* Tabs & Stage */
#vd-stitch-tabs {
  display: flex; align-items: stretch; flex-wrap: nowrap; gap: 6px;
  max-width: 100%; padding: 8px 12px; box-sizing: border-box;
  background-color: rgba(11, 15, 23, 0.92);
  border-bottom: 1px solid var(--vd-border-subtle, #1F2937);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.vd-stitch-tab {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; min-width: 44px; padding: 8px 14px; border-radius: var(--vd-radius-md, 8px);
  border: 1px solid var(--vd-border-subtle, #1F2937);
  background-color: var(--vd-surface-card, #111827); color: var(--vd-text-secondary, #D1D5DB);
  font-family: var(--vd-font-sans, sans-serif); font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.vd-stitch-tab:hover {
  color: var(--vd-text-primary, #F9FAFB); border-color: var(--vd-border-hover, #374151);
  background-color: var(--vd-surface-elevated, #161F30);
}

.vd-stitch-tab.active,
.vd-stitch-tab[aria-selected="true"] {
  color: var(--vd-text-primary, #F9FAFB);
  background-color: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.7);
}

.vd-stitch-tab.active::after,
.vd-stitch-tab[aria-selected="true"]::after {
  content: ""; position: absolute; inset: auto 8px 0 8px;
  border-block-end: 3px solid var(--vd-accent-primary, #3B82F6); border-radius: 2px;
}

.vd-stitch-tab-index {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 5px; background-color: rgba(59, 130, 246, 0.24); color: #BFDBFE;
  font-family: var(--vd-font-mono, monospace); font-size: 11px; font-weight: 700;
}

.vd-stitch-tab-type {
  font-family: var(--vd-font-mono, monospace); font-size: 10.5px;
  color: var(--vd-text-secondary, #CBD5E1); text-transform: uppercase;
}

.btn-vd-generate-stitch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  color: #BFDBFE;
  border-color: rgba(59, 130, 246, 0.5);
  background-color: rgba(59, 130, 246, 0.16);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-vd-generate-stitch:hover:not(:disabled) {
  background-color: rgba(59, 130, 246, 0.28);
  border-color: #60A5FA;
  color: #EFF6FF;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.btn-vd-generate-stitch:focus-visible {
  outline: 2px solid var(--vd-border-focus, #60A5FA);
  outline-offset: 2px;
}

.btn-vd-generate-stitch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-vd-stitch-plan-prd {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  min-width: 30px;
  padding: 0 12px;
  color: #A5F3FC;
  border-color: rgba(34, 211, 238, 0.48);
  background-color: rgba(6, 182, 212, 0.14);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-vd-stitch-plan-prd:hover:not(:disabled) {
  background-color: rgba(6, 182, 212, 0.26);
  border-color: #22D3EE;
  color: #ECFEFF;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.btn-vd-stitch-plan-prd:focus-visible {
  outline: 2px solid var(--vd-border-focus, #60A5FA);
  outline-offset: 2px;
}

.btn-vd-stitch-plan-prd:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vd-stitch-btn-add-screen {
  color: #A5F3FC;
  background-color: rgba(6, 182, 212, 0.14);
  border-color: rgba(34, 211, 238, 0.48);
}

.vd-stitch-btn-add-screen:hover:not(:disabled),
.vd-stitch-btn-add-screen[aria-expanded="true"] {
  background-color: rgba(6, 182, 212, 0.26);
  border-color: #22D3EE;
  color: #ECFEFF;
}

.vd-stitch-inline-error {
  padding: 9px 14px;
  background-color: #2D1218;
  border-bottom: 1px solid rgba(239, 68, 68, 0.6);
  color: #FEE2E2;
  font-family: var(--vd-font-sans, sans-serif);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  flex-shrink: 0;
}

.vd-stitch-refine-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--vd-border-subtle, #1F2937);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.vd-stitch-refine-input {
  flex: 1 1 200px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid var(--vd-border-subtle, #334155);
  background-color: var(--vd-bg-primary, #0B0F17);
  color: var(--vd-text-primary, #F9FAFB);
  font-family: var(--vd-font-sans, sans-serif);
  font-size: 13px;
}

.vd-stitch-refine-input::placeholder {
  color: #9CA3AF;
}

.vd-stitch-refine-scope {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 10px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid var(--vd-border-subtle, #334155);
  background-color: var(--vd-surface-elevated, #161F30);
  color: var(--vd-text-primary, #F9FAFB);
  font-family: var(--vd-font-sans, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.vd-stitch-refine-input:focus-visible,
.vd-stitch-refine-scope:focus-visible {
  outline: 2px solid var(--vd-border-focus, #60A5FA);
  outline-offset: 2px;
}

.vd-stitch-refine-input:disabled,
.vd-stitch-refine-scope:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vd-stitch-btn-refine {
  flex: 0 0 auto;
  color: #EFF6FF;
  background-color: rgba(59, 130, 246, 0.24);
  border-color: rgba(96, 165, 250, 0.55);
}

.vd-stitch-btn-refine:hover:not(:disabled) {
  background-color: rgba(59, 130, 246, 0.36);
  border-color: #60A5FA;
}

/* PRD Screen Plan Confirmation Panel */
.vd-stitch-plan-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background-color: rgba(15, 23, 42, 0.96);
  border-bottom: 1px solid var(--vd-border-subtle, #1F2937);
  flex-shrink: 0;
}

.vd-stitch-plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.vd-stitch-plan-title {
  font-family: var(--vd-font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--vd-text-primary, #F9FAFB);
}

.vd-stitch-plan-summary {
  font-family: var(--vd-font-mono, monospace);
  font-size: 11.5px;
  font-weight: 600;
  color: #CBD5E1;
}

.vd-stitch-plan-quick-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.vd-stitch-plan-quick-actions .vd-stitch-action-btn {
  min-height: 32px;
  min-width: 32px;
  padding: 4px 10px;
  font-size: 11.5px;
}

.vd-stitch-plan-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.vd-stitch-plan-item {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 9px 10px;
  border-radius: var(--vd-radius-md, 8px);
  background-color: var(--vd-surface-card, #111827);
  border: 1px solid var(--vd-border-subtle, #1F2937);
  color: var(--vd-text-primary, #F9FAFB);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.vd-stitch-plan-item:hover {
  background-color: var(--vd-surface-elevated, #161F30);
  border-color: var(--vd-border-hover, #374151);
}

.vd-stitch-plan-item:has(input[type="checkbox"]:checked) {
  background-color: rgba(59, 130, 246, 0.12);
  border-color: rgba(96, 165, 250, 0.55);
}

.vd-stitch-plan-item:focus-within {
  outline: 2px solid var(--vd-border-focus, #60A5FA);
  outline-offset: 2px;
}

.vd-stitch-plan-item input[type="checkbox"] {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  margin: 0;
  accent-color: var(--vd-accent-primary, #3B82F6);
  cursor: pointer;
}

.vd-stitch-plan-item-main,
.vd-stitch-plan-item-body {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vd-stitch-plan-item-top,
.vd-stitch-plan-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.vd-stitch-plan-item-title {
  font-family: var(--vd-font-sans, sans-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--vd-text-primary, #F9FAFB);
  line-height: 1.35;
}

.vd-stitch-plan-item-type,
.vd-stitch-plan-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-family: var(--vd-font-mono, monospace);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #BFDBFE;
  background-color: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.45);
  white-space: nowrap;
}

.vd-stitch-plan-item-sub,
.vd-stitch-plan-item-subtitle,
.vd-stitch-plan-item-viz {
  font-family: var(--vd-font-sans, sans-serif);
  font-size: 12px;
  color: #CBD5E1;
  line-height: 1.45;
}

.vd-stitch-plan-item > .vd-stitch-plan-item-sub,
.vd-stitch-plan-item > .vd-stitch-plan-item-subtitle,
.vd-stitch-plan-item > .vd-stitch-plan-item-viz {
  flex: 1 0 100%;
  padding-left: 34px;
  box-sizing: border-box;
}

.vd-stitch-plan-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(31, 41, 55, 0.75);
}

/* Add Custom Screen Bar */
.vd-stitch-add-screen-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: rgba(15, 23, 42, 0.94);
  border-bottom: 1px solid var(--vd-border-subtle, #1F2937);
  flex-wrap: wrap;
  flex-shrink: 0;
}

#vd-stitch-add-screen-prompt {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid var(--vd-border-subtle, #334155);
  background-color: var(--vd-bg-primary, #0B0F17);
  color: var(--vd-text-primary, #F9FAFB);
  font-family: var(--vd-font-sans, sans-serif);
  font-size: 13px;
}

#vd-stitch-add-screen-prompt::placeholder {
  color: #9CA3AF;
}

#vd-stitch-add-screen-type {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 10px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid var(--vd-border-subtle, #334155);
  background-color: var(--vd-surface-elevated, #161F30);
  color: var(--vd-text-primary, #F9FAFB);
  font-family: var(--vd-font-sans, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

#vd-stitch-add-screen-prompt:focus-visible,
#vd-stitch-add-screen-type:focus-visible,
#btn-vd-stitch-add-screen-submit:focus-visible,
#btn-vd-stitch-add-screen-cancel:focus-visible {
  outline: 2px solid var(--vd-border-focus, #60A5FA);
  outline-offset: 2px;
}

#vd-stitch-add-screen-prompt:disabled,
#vd-stitch-add-screen-type:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#btn-vd-stitch-add-screen-submit,
#btn-vd-stitch-add-screen-cancel {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
}

#btn-vd-stitch-add-screen-cancel {
  color: #E2E8F0;
  background-color: var(--vd-surface-card, #111827);
  border-color: #334155;
}

#btn-vd-stitch-add-screen-cancel:hover:not(:disabled) {
  background-color: var(--vd-surface-elevated, #161F30);
  border-color: #64748B;
}

#vd-stitch-stage {
  position: relative; flex: 1; width: 100%; max-width: 100%; height: auto; min-height: 240px;
  background-color: var(--vd-bg-primary, #0B0F17); overflow: hidden;
}

#vd-stitch-iframe,
#vd-stitch-modal-iframe {
  display: block; width: 100%; height: 100%; border: 0; background-color: var(--vd-bg-primary, #0B0F17);
}

#vd-stitch-loading,
#vd-stitch-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center;
  background-color: rgba(11, 15, 23, 0.94); color: var(--vd-text-primary, #F9FAFB);
}

.vd-stitch-loading-title {
  font-family: var(--vd-font-sans, sans-serif); font-size: 13.5px; font-weight: 600;
  color: var(--vd-text-primary, #F9FAFB);
}

.vd-stitch-loading-sub,
.vd-stitch-empty-text {
  font-family: var(--vd-font-sans, sans-serif); font-size: 12.5px;
  color: var(--vd-text-secondary, #D1D5DB); max-width: 480px; line-height: 1.5;
}

.vd-stitch-spinner-svg { color: var(--vd-accent-primary, #3B82F6); animation: vd-stitch-spin 0.95s linear infinite; }
#vd-stitch-empty.is-error .vd-stitch-empty-text { color: #FCA5A5; }

#vd-stitch-modal .vd-stitch-modal-window {
  width: min(1440px, 100%); max-width: 100%; height: min(92dvh, 960px); max-height: 92dvh;
}

.vd-stitch-modal-body {
  padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column;
  background-color: var(--vd-bg-primary, #0B0F17);
}

#vd-stitch-modal-iframe { flex: 1; }

@keyframes vd-stitch-spin { to { transform: rotate(360deg); } }

@keyframes vd-stitch-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.78); }
}

@keyframes vd-stitch-pulse-cyan {
  0%, 100% { box-shadow: -6px 0 18px rgba(6, 182, 212, 0.35), inset 0 0 0 1px rgba(103, 232, 249, 0.25); }
  50% { box-shadow: -8px 0 28px rgba(34, 211, 238, 0.65), inset 0 0 0 1px rgba(103, 232, 249, 0.55); }
}

@keyframes vd-stitch-pulse-amber {
  0%, 100% { box-shadow: -6px 0 18px rgba(245, 158, 11, 0.38), inset 0 0 0 1px rgba(252, 211, 77, 0.28); }
  50% { box-shadow: -8px 0 28px rgba(251, 191, 36, 0.72), inset 0 0 0 1px rgba(252, 211, 77, 0.6); }
}

@keyframes vd-stitch-shimmer-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

@media (max-width: 768px) {
  .vd-stitch-dock,
  #vd-stitch-preview-dock {
    width: calc(100vw - 44px);
    max-width: calc(100vw - 44px);
    top: 10px;
    bottom: 10px;
    z-index: 80;
  }
  .vd-stitch-pull-tab {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .vd-stitch-dock-header { padding: 10px 12px; gap: 8px; }
  .vd-stitch-dock-actions { width: 100%; justify-content: flex-start; }
  .vd-stitch-action-btn { min-height: 44px; min-width: 44px; padding: 8px 10px; font-size: 11.5px; }
  .btn-vd-generate-stitch,
  .btn-vd-stitch-plan-prd { min-height: 44px; min-width: 44px; padding: 8px 12px; }
  .vd-stitch-btn-add-screen { min-height: 44px; min-width: 44px; }
  .vd-stitch-plan-panel { padding: 10px; gap: 8px; }
  .vd-stitch-plan-quick-actions .vd-stitch-action-btn,
  .vd-stitch-plan-footer .vd-stitch-action-btn { min-height: 44px; min-width: 44px; flex: 1 1 auto; }
  .vd-stitch-plan-list { max-height: 200px; }
  .vd-stitch-plan-item { min-height: 44px; padding: 10px; }
  .vd-stitch-add-screen-bar { padding: 8px; gap: 6px; }
  #vd-stitch-add-screen-prompt { flex: 1 1 100%; min-height: 44px; }
  #vd-stitch-add-screen-type,
  #btn-vd-stitch-add-screen-submit,
  #btn-vd-stitch-add-screen-cancel { flex: 1 1 auto; min-height: 44px; min-width: 44px; }
  .vd-stitch-refine-bar { padding: 8px; gap: 6px; }
  .vd-stitch-refine-input { flex: 1 1 100%; }
  #vd-stitch-tabs { padding: 8px; }
  #vd-stitch-stage { flex: 1; min-height: 200px; height: auto; }
  #vd-stitch-modal { padding: 8px; }
  #vd-stitch-modal .vd-stitch-modal-window { width: 100%; height: 92dvh; max-height: 92dvh; border-radius: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .vd-stitch-dock,
  #vd-stitch-preview-dock,
  .vd-stitch-drawer-panel,
  .vd-stitch-pull-tab,
  .vd-stitch-pull-tab-chevron,
  .vd-stitch-toggle-chevron,
  .vd-stitch-action-btn,
  .btn-vd-generate-stitch,
  .btn-vd-stitch-plan-prd,
  .vd-stitch-btn-add-screen,
  .vd-stitch-plan-item,
  .vd-stitch-tab {
    transition: none !important;
  }
  .vd-stitch-spinner-svg,
  .vd-stitch-pull-tab[data-status="queued"],
  .vd-stitch-pull-tab[data-status="synthesizing"],
  .vd-stitch-status-badge[data-status="queued"]::before,
  .vd-stitch-status-badge[data-status="synthesizing"]::before,
  .vd-stitch-progress-bar {
    animation: none !important;
  }
}
