/* ============================================
   Spec Viewer Page Specific Styles - Specifys.ai
   ============================================
   Styles specific to the spec-viewer.html page
*/

/* Prevent horizontal overflow on spec-viewer page */
body.spec-viewer-page,
html:has(body.spec-viewer-page) {
  overflow-x: hidden;
  overflow-y: auto; /* Always allow vertical scrolling */
  width: 100%;
  max-width: 100vw;
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  height: auto; /* Allow content to determine height */
  min-height: 100vh; /* At least full viewport height */
}

/* Fix header display - using same approach as demo-spec-page */
.spec-viewer-page .thematic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  min-height: 60px;
  padding: 15px 20px;
  overflow-x: hidden;
}

/* Ensure header-right doesn't take 100% width on spec-viewer page */
.spec-viewer-page .thematic-header .header-right {
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  width: auto;
  max-width: 100%;
}

/* Alternative: if spec-viewer-page class is not available, use body specificity */
body:has(.side-menu) .thematic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  min-height: 60px;
  padding: 15px 20px;
  overflow-x: hidden;
}

body:has(.side-menu) .thematic-header .header-right {
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  width: auto;
  max-width: 100%;
}

/* Orange icons for generated tabs */
/* Using higher specificity instead of !important */
.tab-button.generated .fa {
  color: #FF6B35;
}

/* Mindmap container specific styles */
#mindmap-container {
  width: 100%;
  height: 800px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-color);
}

/* Mockup generate section styles */
.mockup-generate-content {
  text-align: center;
  padding: 40px 20px;
}

.mockup-icon {
  font-size: 64px;
  color: #FF6B35;
  margin-bottom: 20px;
}

.mockup-generate-content h3 {
  margin-bottom: 10px;
}

.mockup-description {
  color: #666;
  margin-bottom: 30px;
}

.mockup-checkbox-container {
  margin-bottom: 20px;
}

.mockup-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}

.mockup-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.mockup-checkbox-label span {
  font-size: 14px;
  color: #333;
}

.mockup-generate-btn {
  padding: 12px 32px;
  font-size: 16px;
}

/* Chat container styles */
.chat-container {
  height: 600px;
  display: flex;
  flex-direction: column;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.chat-header {
  padding: 15px 20px;
  background: white;
  color: #333;
  border-bottom: 2px solid #ff6b35;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.chat-header h2 .fa {
  color: #ff6b35;
}

.chat-subtitle {
  margin: 5px 0 0 0;
  color: #666;
  font-size: 13px;
}

#reset-chat-btn {
  padding: 6px 12px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  color: #666;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

#reset-chat-btn .fa {
  color: #666;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f9f9f9;
}

.chat-welcome {
  text-align: center;
  padding: 30px 20px;
  color: #666;
}

.chat-welcome .fa {
  font-size: 48px;
  color: #ff6b35;
  margin-bottom: 15px;
  display: block;
}

.chat-welcome h3 {
  margin: 0 0 10px 0;
  color: #333;
}

.chat-welcome p {
  margin: 0;
  color: #666;
}

.chat-input-container {
  padding: 15px 20px;
  border-top: 1px solid #e0e0e0;
  background: white;
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
}

.chat-send-btn {
  padding: 10px 20px;
  background: #ff6b35;
  border: none;
  color: white;
  border-radius: 4px;
  white-space: nowrap;
  cursor: pointer;
}

.chat-send-btn .fa {
  color: white !important;
}

/* Brain Dump - site orange accent (#FF6B35) */
.brain-dump-container {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  border: 1px solid #ffd4c4;
  border-radius: 8px;
  overflow: hidden;
  background: #fff8f5;
  padding-bottom: 20px;
}
.brain-dump-input-section {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.brain-dump-result {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brain-dump-result.hidden {
  display: none;
}
.brain-dump-result-block {
  background: white;
  border: 1px solid #ffd4c4;
  border-radius: 8px;
  padding: 16px;
}
.brain-dump-mermaid-wrap {
  min-height: 120px;
}
.brain-dump-mermaid-wrap.hidden {
  display: none;
}
.brain-dump-context-wrap.hidden {
  display: none;
}
.brain-dump-context-header {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}
.brain-dump-context-header .fa {
  margin-right: 8px;
  color: #FF6B35;
}
.brain-dump-context-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px 0 0 0;
  color: #333;
}
.brain-dump-prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.brain-dump-prompt-header h3 {
  margin: 0;
  font-size: 16px;
  color: #333;
}
.brain-dump-full-prompt {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}
.brain-dump-apply-wrap.hidden {
  display: none;
}
.brain-dump-apply-btn {
  padding: 10px 20px;
  background: #FF6B35;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.brain-dump-apply-btn:hover {
  background: #e55a2b;
}
.brain-dump-apply-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.brain-dump-loading-block {
  padding: 24px;
  text-align: center;
  color: #333;
}
.brain-dump-loading-block.hidden {
  display: none;
}
.brain-dump-loading-block .fa-spinner {
  margin-right: 8px;
}

.brain-dump-header {
  padding: 15px 20px;
  background: linear-gradient(135deg, #fff0eb 0%, #fff 100%);
  color: #333;
  border-bottom: 2px solid #FF6B35;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brain-dump-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.brain-dump-header h2 .fa {
  color: #FF6B35;
}

.brain-dump-subtitle {
  margin: 5px 0 0 0;
  color: #555;
  font-size: 13px;
}

.brain-dump-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fff8f5;
}

.brain-dump-welcome {
  text-align: center;
  padding: 30px 20px;
  color: #555;
}

.brain-dump-welcome .fa {
  font-size: 48px;
  color: #FF6B35;
  margin-bottom: 15px;
  display: block;
}

.brain-dump-welcome h3 {
  margin: 0 0 10px 0;
  color: #333;
}

.brain-dump-welcome p {
  margin: 0;
  color: #555;
}

.brain-dump-message-wrap {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.brain-dump-message-wrap.user {
  align-items: flex-end;
}

.brain-dump-message-wrap.assistant {
  align-items: flex-start;
}

.brain-dump-message-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 8px;
  word-wrap: break-word;
  background: white;
  border: 1px solid #ffd4c4;
  color: #333;
}

.brain-dump-message-wrap.user .brain-dump-message-bubble {
  background: #fff0eb;
  border-color: #FF6B35;
}

.brain-dump-create-prompt-btn {
  margin-top: 8px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
  background: #FF6B35;
  color: white;
  border: none;
  cursor: pointer;
}

.brain-dump-create-prompt-btn:hover {
  background: #e55a2b;
}

.brain-dump-create-prompt-btn .fa {
  margin-right: 4px;
  color: white;
}

.brain-dump-loading {
  padding: 12px 16px;
  background: white;
  border: 1px solid #ffd4c4;
  border-radius: 8px;
  color: #555;
}

.brain-dump-input-container {
  padding: 15px 20px;
  border-top: 1px solid #ffd4c4;
  background: white;
  display: flex;
  gap: 10px;
}

.brain-dump-input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ffd4c4;
  border-radius: 4px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
}

.brain-dump-input:focus {
  outline: none;
  border-color: #FF6B35;
}

.brain-dump-send-btn {
  padding: 10px 20px;
  background: #FF6B35;
  border: none;
  color: white;
  border-radius: 4px;
  white-space: nowrap;
  cursor: pointer;
}

.brain-dump-send-btn .fa {
  color: white;
}

.brain-dump-prompt-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.brain-dump-prompt-modal.hidden {
  display: none;
}

.brain-dump-prompt-modal-content {
  background: white;
  border-radius: 8px;
  max-width: 90vw;
  width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border: 1px solid #ffd4c4;
}

.brain-dump-prompt-modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brain-dump-prompt-modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: #333;
}

.brain-dump-prompt-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 0 4px;
}

.brain-dump-prompt-modal-body {
  padding: 16px;
  overflow: auto;
  flex: 1;
}

.brain-dump-prompt-text {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
  resize: vertical;
  margin-bottom: 12px;
}

.brain-dump-prompt-modal-body .btn {
  padding: 8px 16px;
  background: #FF6B35;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Page intro section spacing and centering */
.page-intro-section {
  margin-top: 140px;
  margin-bottom: 6px;
  text-align: center;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  overflow-x: hidden;
  padding-left: 20px;
  padding-right: 20px;
}

.page-intro-section .page-description {
  max-width: 800px;
  margin: 8px auto 0;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

/* Content spacing from header */
.container {
  margin-top: 30px;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  overflow-x: hidden;
  padding-left: 20px;
  padding-right: 20px;
}

/* Approval container styling */
.approval-container {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  overflow-x: hidden;
  min-width: 0;
}

.approval-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #666;
  font-size: 15px;
  line-height: 1.6;
  flex: 1;
  min-width: 300px;
}

.approval-message i {
  color: #FF6B35;
  font-size: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}

.approval-actions {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.stage-recovery-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #fff8f3;
  border: 1px solid #f0d9c8;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 0 auto 24px;
  max-width: 1200px;
  width: 100%;
  box-sizing: border-box;
}

.stage-recovery-banner.hidden,
.stage-recovery-banner[hidden] {
  display: none;
}

.stage-recovery-copy {
  flex: 1;
  min-width: 220px;
}

.stage-recovery-copy strong {
  display: block;
  color: #1a1510;
  margin-bottom: 4px;
}

.stage-recovery-copy p {
  margin: 0;
  color: #6b5e54;
  font-size: 0.92rem;
  line-height: 1.45;
}

.stage-recovery-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.prompts-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff8f3 0%, #f7f3ef 100%);
  border: 1px solid #f0d9c8;
  border-radius: 12px;
}

.prompts-next-actions-label {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #a65a2e;
  width: 100%;
  margin: 0 0 2px;
}

.prompts-next-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.prompts-next-actions .btn-primary {
  background: #ff6b35;
  color: #fff;
}

.prompts-next-actions .btn-primary:hover {
  background: #e55a2b;
}

.prompts-next-actions .btn-secondary {
  background: #fff;
  color: #2a221c;
  border: 1px solid #d9d0c8;
}

.prompts-next-actions .btn-secondary:hover {
  background: #f7f3ef;
}

.prompts-activation-checklist {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompts-activation-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.92rem;
  color: #2a221c;
  line-height: 1.4;
}

.prompts-activation-checklist li i {
  color: #ff6b35;
  margin-top: 2px;
}
}

/* Specification content white background */
.tab-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 30px;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  overflow-x: hidden;
  scroll-margin-top: 140px;
}

.tab-content .content-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f0f0f0;
}

.tab-content .content-header h2 {
  margin: 0;
  color: #FF6B35;
  font-size: 1.8rem;
  font-weight: 700;
}

.tab-content .content-body {
  color: #333;
  line-height: 1.8;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}

/* Ensure all child elements within content-body respect container width */
.tab-content .content-body > * {
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

/* Tables - make them responsive */
.tab-content .content-body table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 16px;
  box-sizing: border-box;
  table-layout: auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.tab-content .content-body table th,
.tab-content .content-body table td {
  padding: 12px;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 0; /* Force table cells to respect width */
}

/* Pre and code blocks - allow horizontal scroll within them */
.tab-content .content-body pre {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  box-sizing: border-box;
  word-wrap: normal;
  overflow-wrap: normal;
  white-space: pre;
}

.tab-content .content-body code {
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

/* Images - make them responsive */
.tab-content .content-body img {
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
}

/* Divs and other block elements */
.tab-content .content-body div {
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

/* Lists */
.tab-content .content-body ul,
.tab-content .content-body ol {
  max-width: 100%;
  box-sizing: border-box;
  padding-left: 20px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Paragraphs */
.tab-content .content-body p {
  max-width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Headings */
.tab-content .content-body h1,
.tab-content .content-body h2,
.tab-content .content-body h3,
.tab-content .content-body h4,
.tab-content .content-body h5,
.tab-content .content-body h6 {
  max-width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Ensure body can scroll on mobile */
  body.spec-viewer-page,
  html:has(body.spec-viewer-page) {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }
  
  .page-intro-section {
    margin-top: 80px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    padding-left: 15px;
    padding-right: 15px;
    min-width: 0;
  }
  
  .container {
    margin-top: 20px;
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    padding-left: 15px;
    padding-right: 15px;
    min-width: 0;
  }
  
  .approval-container {
    padding: 20px;
    margin-bottom: 20px;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    min-width: 0;
  }
  
  .tab-content {
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
  }
  
  /* Content body mobile adjustments */
  .tab-content .content-body {
    padding: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    min-width: 0;
  }
  
  /* Tables on mobile - make them scrollable within container */
  .tab-content .content-body table {
    width: 100%;
    max-width: 100%;
    font-size: 14px;
    table-layout: fixed; /* Force table to respect width */
  }
  
  .tab-content .content-body table th,
  .tab-content .content-body table td {
    padding: 8px;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  
  /* Pre blocks on mobile - allow scroll within them */
  .tab-content .content-body pre {
    font-size: 12px;
    padding: 15px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .approval-message {
    min-width: auto;
  }
  
  .approval-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .approval-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================
   Complexity Score Section Styles
   ============================================ */

.complexity-score-section {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 16px;
  padding: 32px;
  margin: 30px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
}

.complexity-header {
  margin-bottom: 32px;
  text-align: center;
}

.complexity-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.complexity-header h3 .fa {
  color: #FF6B35;
  font-size: 28px;
}

/* Main Display - Circular Chart */
.complexity-main-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-bottom: 40px;
  padding: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.total-score-circle {
  position: relative;
  width: 180px;
  height: 180px;
}

.circular-chart {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: #e9ecef;
  stroke-width: 8;
}

.circle-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-in-out;
  animation: progressAnimation 1.5s ease-out;
}

@keyframes progressAnimation {
  from {
    stroke-dashoffset: 283;
  }
}

.circle-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.circle-score {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.circle-score.score-low {
  color: #10B981;
}

.circle-score.score-medium {
  color: #F59E0B;
}

.circle-score.score-high {
  color: #EF4444;
}

.circle-label {
  font-size: 18px;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 8px;
}

.circle-level {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 12px;
  display: inline-block;
}

.circle-level.score-low {
  color: #10B981;
  background: #d1fae5;
}

.circle-level.score-medium {
  color: #F59E0B;
  background: #fef3c7;
}

.circle-level.score-high {
  color: #EF4444;
  background: #fee2e2;
}

/* Legend */
.complexity-legend {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-block;
}

.legend-color.score-low {
  background: #10B981;
}

.legend-color.score-medium {
  background: #F59E0B;
}

.legend-color.score-high {
  background: #EF4444;
}

.legend-text {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* Metrics */
.complexity-metrics {
  display: grid;
  gap: 20px;
}

.metric-item {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid #e9ecef;
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #374151;
  font-size: 16px;
}

.metric-label .fa {
  color: #FF6B35;
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.metric-value-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  min-width: 50px;
  text-align: right;
}

.metric-value.score-low {
  color: #10B981;
}

.metric-value.score-medium {
  color: #F59E0B;
}

.metric-value.score-high {
  color: #EF4444;
}

.metric-level {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.metric-level.score-low {
  color: #10B981;
  background: #d1fae5;
}

.metric-level.score-medium {
  color: #F59E0B;
  background: #fef3c7;
}

.metric-level.score-high {
  color: #EF4444;
  background: #fee2e2;
}

.metric-bar-container {
  margin-top: 8px;
}

.metric-bar {
  width: 100%;
  height: 12px;
  background: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.metric-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 1s ease-out;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metric-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.metric-fill.score-low {
  background: linear-gradient(90deg, #10B981, #34d399);
}

.metric-fill.score-medium {
  background: linear-gradient(90deg, #F59E0B, #fbbf24);
}

.metric-fill.score-high {
  background: linear-gradient(90deg, #EF4444, #f87171);
}

/* Responsive Design */
@media (max-width: 768px) {
  .complexity-score-section {
    padding: 24px 20px;
    margin: 20px 0;
  }
  
  .complexity-main-display {
    padding: 20px;
  }
  
  .total-score-circle {
    width: 150px;
    height: 150px;
  }
  
  .circle-score {
    font-size: 40px;
  }
  
  .complexity-legend {
    gap: 16px;
  }
  
  .metric-item {
    padding: 16px;
  }
  
  .metric-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .metric-value-wrapper {
    width: 100%;
    justify-content: space-between;
  }
}

/* ===== BUTTON LOADING SPINNER ===== */
/* Make buttons with spinners use flexbox for perfect alignment */
.btn:has(.loading-spinner) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn .loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: buttonSpinnerRotate 0.8s linear infinite;
  margin-right: 0;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Spinner animation for buttons (separate from general spin animation) */
@keyframes buttonSpinnerRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===== MERMAID DIAGRAM STYLES ===== */
.mermaid-rendered {
  width: 100%;
  overflow: auto;
  text-align: center;
  padding: 20px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.mermaid-rendered svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.diagram-content {
  width: 100%;
}

.diagram-loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-style: italic;
}

/* Diagram Container */
.diagram-container {
  margin-bottom: 30px;
  padding: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
}

/* Diagram Header and Controls */
.diagram-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e0e0e0;
}

.diagram-header-content {
  flex: 1;
}

.diagram-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.5rem;
  font-weight: 600;
}

.diagram-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.diagram-controls .btn-icon.diagram-fullscreen-btn {
  background: transparent;
  border: none;
  color: #666;
  padding: 8px;
  width: auto;
  height: auto;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.diagram-controls .btn-icon.diagram-fullscreen-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #333;
  transform: none;
  box-shadow: none;
  outline: none;
}

.diagram-controls .btn-icon.diagram-fullscreen-btn:active {
  transform: none;
  background: rgba(0, 0, 0, 0.1);
}

.diagram-controls .btn-icon.diagram-fullscreen-btn:focus {
  outline: 2px solid rgba(0, 0, 0, 0.1);
  outline-offset: 2px;
}

.diagram-controls .btn-icon.diagram-fullscreen-btn i {
  color: inherit;
  font-size: 18px;
}

/* Fullscreen Modal */
.fullscreen-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  flex-direction: column;
}

.fullscreen-modal.hidden {
  display: none;
}

.fullscreen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.fullscreen-header h3 {
  margin: 0;
  color: white;
  font-size: 1.5rem;
}

.fullscreen-controls {
  display: flex;
  gap: 8px;
}

.fullscreen-content {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mermaid-fullscreen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mermaid-fullscreen svg {
  max-width: 100%;
  max-height: 100%;
}

/* ============================================
   Export Specification Tab Styles
   ============================================ */

/* Inner Tabs Navigation */
.export-inner-tabs {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 32px;
  padding-bottom: 0;
}

.export-inner-tab {
  padding: 12px 24px;
  background: transparent;
  border: none;
  color: var(--text-secondary, #666);
  font-size: var(--font-size-base, 1rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family-primary, 'Montserrat', sans-serif);
  position: relative;
  border-radius: 8px;
}

.export-inner-tab:hover {
  color: var(--primary-color, #FF6B35);
  background: var(--primary-light, #FFF4F0);
}

.export-inner-tab.active {
  color: var(--primary-color, #FF6B35);
  background: var(--primary-light, #FFF4F0);
}

.export-inner-tab:focus {
  outline: 2px solid var(--primary-color, #FF6B35);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Export Inner Content */
.export-inner-content {
  display: none;
}

.export-inner-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Export Container */
.export-container {
  background: var(--bg-primary, #ffffff);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-light, #e9ecef);
}

/* Export Intro */
.export-intro {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light, #e9ecef);
}

.export-intro p {
  margin: 0;
  color: var(--text-color, #333);
  font-size: var(--font-size-base, 1rem);
  line-height: 1.6;
}

.export-intro p:first-child {
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-color, #333);
}

.export-intro p i {
  color: var(--primary-color, #FF6B35);
  margin-right: 8px;
}

.export-intro p strong {
  color: var(--text-color, #333);
  font-weight: 600;
}

/* Export Options Section */
.export-options {
  margin-bottom: 32px;
}

.export-section-header {
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-light, #e9ecef);
  border-radius: 8px;
}

.export-section-header .export-checkbox-label {
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.export-section-header .export-checkbox-label:hover {
  background: transparent;
  border: none;
  transform: none;
  box-shadow: none;
}

.export-section-header .export-checkbox-label:has(input:checked) {
  background: transparent;
  border: none;
}

.export-section-header .export-checkbox-label:has(input:checked) span {
  color: #FF6B35;
}

.export-section-header .export-checkbox-label:has(input:checked) span strong {
  color: #FF6B35;
}

.export-section-header .export-checkbox-label:has(input:checked) span i {
  color: var(--text-secondary, #666);
}

.export-section-header .export-checkbox-label span {
  font-size: var(--font-size-lg, 1.125rem);
  color: #FF6B35;
}

.export-section-header .export-checkbox-label span strong {
  color: #FF6B35;
  font-weight: 600;
}

/* Export Checkbox Labels */
.export-checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s ease;
  font-size: var(--font-size-base, 1rem);
  color: var(--text-color, #333);
}

.export-checkbox-label:hover {
  border-color: var(--primary-color, #FF6B35);
}

.export-checkbox-label:has(input:checked) {
  background: var(--primary-color, #FF6B35);
  border-color: transparent;
}

.export-checkbox-label:has(input:checked) span {
  color: var(--text-white, #ffffff);
}

.export-checkbox-label span {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.export-checkbox-label span i {
  color: var(--text-secondary, #666);
  font-size: var(--font-size-lg, 1.125rem);
  width: 20px;
  text-align: center;
  transition: color 0.2s ease;
}

.export-checkbox-label:has(input:checked) span i {
  color: var(--text-white, #ffffff);
}

.export-checkbox-label span strong {
  font-weight: 600;
  color: var(--text-color, #333);
  transition: color 0.2s ease;
}

.export-checkbox-label:has(input:checked) span strong {
  color: var(--text-white, #ffffff);
}

/* Export Checkbox Input */
.export-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  cursor: pointer;
  accent-color: var(--primary-color, #FF6B35);
  flex-shrink: 0;
  margin: 0;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 2px solid var(--border-color, #dee2e6);
  border-radius: 4px;
  background-color: var(--bg-primary, #ffffff);
  transition: all 0.2s ease;
}

.export-checkbox:checked {
  background-color: var(--primary-color, #FF6B35);
  border-color: transparent;
}

/* White checkmark when checked */
.export-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

.export-checkbox:focus {
  outline: 2px solid var(--primary-color, #FF6B35);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Export Sections List */
.export-sections-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

@media (max-width: 768px) {
  .export-sections-list {
    grid-template-columns: 1fr;
  }
}

/* Export Actions */
.export-actions {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light, #e9ecef);
}

.export-generate-btn {
  padding: 12px 32px;
  font-size: var(--font-size-base, 1rem);
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.export-generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.export-generate-btn:active {
  transform: translateY(0);
}

.export-generate-btn i {
  margin-right: 8px;
  color: var(--text-white, #ffffff);
}

/* Export Progress */
.export-progress {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 8px;
  border: 1px solid var(--border-light, #e9ecef);
}

.export-progress.hidden {
  display: none;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--light-gray, #e9ecef);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color, #FF6B35), #FF8551);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  margin: 0;
  color: var(--text-secondary, #666);
  font-size: var(--font-size-sm, 0.875rem);
  text-align: center;
}

/* ============================================
   Jira Export Styles
   ============================================ */

.jira-export-options {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

.jira-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jira-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-color, #333);
  font-size: var(--font-size-base, 1rem);
  font-family: var(--font-family-primary, 'Montserrat', sans-serif);
}

.jira-label i {
  color: var(--primary-color, #FF6B35);
  font-size: var(--font-size-lg, 1.125rem);
}

.jira-label .required {
  color: var(--danger-color, #dc3545);
  margin-left: 4px;
}

/* Jira Input & Select */
.jira-input,
.jira-select {
  padding: 12px 16px;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 8px;
  font-size: var(--font-size-base, 1rem);
  font-family: var(--font-family-secondary, 'Inter', sans-serif);
  color: var(--text-color, #333);
  background: var(--bg-primary, #ffffff);
  transition: all 0.2s ease;
  width: 100%;
}

.jira-input:focus,
.jira-select:focus {
  outline: none;
  border-color: var(--primary-color, #FF6B35);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.jira-input::placeholder {
  color: var(--text-muted, #999);
}

.jira-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.jira-select:hover {
  border-color: var(--primary-color, #FF6B35);
}

.jira-help {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--text-secondary, #666);
  line-height: 1.4;
}

/* Responsive Design for Export Section */
@media (max-width: 768px) {
  .export-container {
    padding: 24px 20px;
  }

  .export-inner-tabs {
    flex-direction: column;
    gap: 0;
    border-bottom: none;
    margin-top: 20px;
  }

  .export-inner-tab {
    border: none;
    border-radius: 8px;
    bottom: 0;
    text-align: left;
  }

  .export-inner-tab.active {
    background: var(--primary-light, #FFF4F0);
  }

  .export-actions {
    flex-direction: column;
  }

  .export-generate-btn {
    width: 100%;
    justify-content: center;
  }

  .jira-export-options {
    gap: 20px;
  }
}

/* ============================================
   Detailed User Flow — journey rail
   ============================================ */

.detailed-user-flow-section {
  margin: 20px 0 28px;
}

.user-flow-rail-heading {
  margin-bottom: 16px;
}

.user-flow-rail {
  list-style: none;
  margin: 0;
  padding: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.user-flow-rail-step {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

.user-flow-rail-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.user-flow-rail-node {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ff6b35;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px #fff8f0;
  z-index: 1;
}

.user-flow-rail-index {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
}

.user-flow-rail-line {
  flex: 1 1 auto;
  width: 2px;
  min-height: 16px;
  margin: 4px 0 0;
  background: linear-gradient(180deg, #ff6b35 0%, rgba(255, 107, 53, 0.25) 100%);
  border-radius: 2px;
}

.user-flow-rail-content {
  min-width: 0;
  padding: 2px 0 20px;
}

.user-flow-rail-step.is-last .user-flow-rail-content {
  padding-bottom: 4px;
}

.user-flow-rail-title {
  margin: 4px 0 6px;
  font-size: 1.02rem;
  font-weight: 650;
  color: #1b1b1e;
  line-height: 1.35;
}

.user-flow-rail-detail {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #4a4a4f;
}

/* Wide screens: horizontal journey when few steps fit */
@media (min-width: 900px) {
  .user-flow-rail {
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .user-flow-rail-step {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    flex: 1 1 0;
    min-width: 140px;
    max-width: 220px;
  }

  .user-flow-rail-track {
    flex-direction: row;
    width: 100%;
    height: 32px;
    margin-bottom: 12px;
  }

  .user-flow-rail-line {
    flex: 1 1 auto;
    width: auto;
    height: 2px;
    min-height: 0;
    margin: 0 0 0 4px;
    background: linear-gradient(90deg, #ff6b35 0%, rgba(255, 107, 53, 0.25) 100%);
  }

  .user-flow-rail-step.is-last .user-flow-rail-line {
    display: none;
  }

  .user-flow-rail-content {
    padding: 0;
    text-align: left;
  }
}

/* Legacy flow-box styles kept for any cached HTML; prefer .user-flow-rail */
.user-flow-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin: 20px 0;
  padding: 20px 0;
  width: 100%;
  max-width: 100%;
}

.flow-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: min(100%, 360px);
  gap: 10px;
}

.flow-box {
  background: #fff;
  color: #333;
  border: 1px solid #e0e0e0;
  padding: 15px 20px;
  border-radius: 8px;
  width: 100%;
  max-width: min(100%, 360px);
  box-sizing: border-box;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.flow-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border-color: #ccc;
}

.flow-step-number {
  font-weight: bold;
  margin-bottom: 8px;
  font-size: 0.9em;
  color: #666;
}

.flow-step-text {
  font-size: 0.95em;
  line-height: 1.5;
  color: #333;
}

.flow-arrow {
  color: #666;
  font-size: 28px;
  margin: 5px 0;
  font-weight: bold;
}

@media (max-width: 768px) {
  .user-flow-diagram {
    gap: 15px;
  }

  .flow-item {
    max-width: min(100%, 320px);
  }

  .flow-box {
    max-width: min(100%, 320px);
    padding: 12px 16px;
  }

  .flow-arrow {
    font-size: 24px;
  }
}

/* ============================================
   Screen Descriptions Grid Styles
   ============================================ */

.screens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.screen-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.screen-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.screen-card h5 {
  margin: 0 0 12px 0;
  color: var(--primary-color, #0078d4);
  font-size: 1.1em;
  border-bottom: 2px solid var(--primary-color, #0078d4);
  padding-bottom: 8px;
}

.screen-card p {
  margin: 0 0 15px 0;
  color: #333;
  line-height: 1.6;
}

.screen-card ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.screen-card li {
  margin-bottom: 6px;
  color: #666;
  font-size: 0.9em;
  line-height: 1.5;
}

/* Responsive adjustments for screens grid */
@media (max-width: 768px) {
  .screens-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .screen-card {
    padding: 16px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .screens-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1025px) {
  .screens-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   Spec Generation Progress Bar
   ============================================ */
.spec-generation-progress {
  margin: 20px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.spec-generation-progress.hidden {
  display: none;
}

.progress-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.9em;
  color: #333;
}

.progress-bar-stage {
  font-weight: 600;
  color: #333;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar-percent {
  font-weight: 700;
  color: #FF6B35;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FF6B35, #FF8551, #FF6B35);
  background-size: 200% 100%;
  animation: progress-shimmer 2s infinite;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes progress-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.progress-message {
  text-align: center;
  color: #666;
  font-size: 0.95em;
  font-weight: 500;
  animation: fade-in-out 3.5s infinite;
}

@keyframes fade-in-out {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* ============================================
   Skeleton UI for Loading States
   ============================================ */
.skeleton-container {
  padding: 20px 0;
}

.skeleton-line {
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  margin: 10px 0;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.medium {
  width: 80%;
}

.skeleton-line.long {
  width: 100%;
}

.skeleton-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.skeleton-header .skeleton-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #f0f0f0;
  border-top-color: #FF6B35;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.skeleton-header .skeleton-text {
  height: 24px;
  width: 200px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.section-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #666;
  font-size: 0.9em;
  margin-bottom: 15px;
}

.section-loading .loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #f0f0f0;
  border-top-color: #FF6B35;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ============================================
   Rich Loading State (initial spec page load)
   ============================================ */
.spec-loading-rich {
  display: block;
  max-width: 900px;
  margin: 30px auto;
  padding: 0 20px;
  text-align: left;
}

.spec-loading-rich .spec-loading-progress {
  margin: 0 0 28px 0;
  padding: 22px 24px;
  background: linear-gradient(135deg, #fff5f0 0%, #fff 100%);
  border: 1px solid #ffd9c4;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(255, 107, 53, 0.06);
}

.spec-loading-rich .progress-bar-container {
  width: 100%;
  height: 6px;
  background: #f1e3d8;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}

.spec-loading-rich .progress-bar-fill {
  height: 100%;
  /* Restore full-width shimmer for the initial pre-content loading skeleton.
     The default `.progress-bar-fill` rule starts at width: 0% for the percentage
     progress bar; this override keeps the loading skeleton unchanged. */
  width: 100%;
  background: linear-gradient(90deg, #FF6B35, #FF8551, #FF6B35);
  background-size: 200% 100%;
  animation: progress-shimmer 2s infinite;
  border-radius: 3px;
}

.spec-loading-rich .progress-message {
  text-align: center;
  color: #444;
  font-size: 1em;
  font-weight: 600;
  letter-spacing: 0.2px;
  animation: fade-in-out 3.5s infinite;
}

.spec-loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.spec-loading-skeleton-card {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.spec-loading-skeleton-card .skeleton-header {
  margin-bottom: 18px;
}

.spec-loading-skeleton-card .skeleton-line {
  height: 14px;
  margin: 12px 0;
}

.spec-loading-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.spec-loading-skeleton-tile {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.spec-loading-skeleton-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff5f0;
  color: #FF6B35;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 4px;
}

.spec-loading-skeleton-tile .skeleton-line {
  height: 12px;
  margin: 6px 0;
}

.spec-loading-tip {
  margin-top: 24px;
  padding: 14px 18px;
  background: #fffaf3;
  border: 1px dashed #f0c8a8;
  border-radius: 10px;
  color: #6b4527;
  font-size: 0.92em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.spec-loading-tip i {
  color: #FF6B35;
  font-size: 1.1em;
}

@media (max-width: 640px) {
  .spec-loading-skeleton-grid {
    grid-template-columns: 1fr;
  }

  .spec-loading-rich {
    padding: 0 12px;
  }

  .spec-loading-rich .spec-loading-progress {
    padding: 16px 18px;
  }
}

/* ============================================
   Chat Bubbles (Micro-Content)
   ============================================ */
.chat-bubbles-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  display: none; /* Hidden by default, shown during generation */
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.chat-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FF6B35;
  color: white;
  padding: 12px 16px;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
  transition: all 0.3s ease;
  pointer-events: auto;
  min-width: 120px;
  max-width: 200px;
}

.chat-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
  background: #FF8551;
}

.chat-bubble-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.chat-bubble-text {
  font-size: 0.9em;
  font-weight: 500;
  white-space: nowrap;
}

.chat-bubble-card {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 320px;
  max-width: calc(100vw - 40px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  z-index: 1001;
  animation: slide-up 0.3s ease;
  margin-bottom: 80px;
}

.chat-bubble-card.hidden {
  display: none;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-bubble-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
}

.chat-bubble-card-header h3 {
  margin: 0;
  font-size: 1em;
  color: #333;
  font-weight: 600;
}

.chat-bubble-close {
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.chat-bubble-close:hover {
  background: #f0f0f0;
  color: #333;
}

.chat-bubble-card-content {
  padding: 16px;
}

.chat-bubble-card-content ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.chat-bubble-card-content li {
  margin-bottom: 10px;
  color: #666;
  font-size: 0.9em;
  line-height: 1.5;
}

/* Responsive adjustments for chat bubbles */
@media (max-width: 768px) {
  .chat-bubbles-container {
    bottom: 15px;
    left: 15px;
  }
  
  .chat-bubble {
    padding: 10px 14px;
    min-width: 100px;
    max-width: 160px;
  }
  
  .chat-bubble-card {
    width: calc(100vw - 30px);
    margin-bottom: 70px;
  }
  
  .chat-bubble-text {
    font-size: 0.85em;
  }
}

/* ===== Overview Suggestions (הצעות) ===== */
/* Hidden until feature is ready for release – remove the line below to show */
.overview-suggestions-block {
  display: none;
}
.overview-suggestions-block {
  margin-top: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.suggestions-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.suggestions-heading .fa {
  color: #FF6B35;
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  background: #fafafa;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 2.5rem;
}

.suggestion-item:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.suggestion-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  transition: border-color 0.15s, background 0.15s;
}

.suggestion-item.suggestion-selected .suggestion-check {
  background: #FF6B35;
  border-color: #FF6B35;
}

.suggestion-item.suggestion-selected .suggestion-check .fa-check {
  font-size: 10px;
}

.suggestion-text {
  font-size: 0.9rem;
  line-height: 1.4;
  color: #444;
  flex: 1;
}

/* Spec title edit button (pencil next to page title) - always visible */
.page-title .spec-title-edit {
  margin-left: 0.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  color: var(--text-color, #333);
  background: transparent;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.page-title .spec-title-edit i {
  color: inherit;
}
.page-title .spec-title-edit:hover {
  background: var(--border-color, #eee);
  border-color: #ccc;
  color: #222;
}
.page-title .spec-title-edit.hidden {
  display: none;
}

/* Spec Engine v3 indicator – shown when spec was generated with the enriched system */
.spec-v2-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-color, #FF6B35);
  background: rgba(255, 107, 53, 0.12);
  border: 1px solid rgba(255, 107, 53, 0.35);
  border-radius: 4px;
  vertical-align: middle;
}
.spec-v2-badge.hidden {
  display: none;
}

/* Rename spec modal */
#rename-spec-modal.modal {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
}
#rename-spec-modal.modal:not(.hidden) {
  display: flex;
}
.rename-spec-modal-content {
  max-width: 420px;
  width: 90%;
}
.rename-spec-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
}
.rename-spec-input:focus {
  outline: none;
  border-color: #FF6B35;
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}
.rename-spec-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.rename-spec-actions .btn {
  min-width: 80px;
}
.rename-spec-spinner.hidden {
  display: none;
}
.rename-spec-save-text.hidden {
  display: none;
}

/* ---- Generate Architecture button ---- */
.locked-tab-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted, #888);
}

.locked-tab-message p {
  max-width: 480px;
  margin: 0 0 4px;
  line-height: 1.5;
}

.btn-generate-arch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 28px;
  background: #ff6b35;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s;
}

.btn-generate-arch:hover {
  background: #e05520;
  transform: translateY(-1px);
}

.btn-generate-arch:active {
  transform: translateY(0);
}

.btn-generate-arch:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* ---- Export tab: admin advanced row data (debug) ---- */
.export-admin-advanced-raw {
  margin-top: 28px;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #ddd);
  background: #fafafa;
}
.export-admin-advanced-raw-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: #333;
}
.export-admin-advanced-raw-desc {
  margin: 0 0 14px;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}
.export-admin-advanced-raw-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.advanced-raw-modal-content {
  max-width: min(92vw, 960px);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.advanced-raw-modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.advanced-raw-modal-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: #666;
  line-height: 1.45;
}
.advanced-raw-modal-actions {
  margin-bottom: 10px;
}
.advanced-raw-json-pre {
  flex: 1;
  min-height: 200px;
  max-height: min(65vh, 560px);
  overflow: auto;
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
  padding: 12px;
  background: #1e1e1e;
  color: #e0e0e0;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Section Clarification UI ===== */
.tab-content .content-body .content-section .clarify-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
}

.clarify-trigger {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 107, 53, 0.35);
  background: rgba(255, 107, 53, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.tab-content .content-body .content-section .clarify-heading .clarify-trigger {
  margin-left: auto;
  flex-shrink: 0;
}

.content-section:hover .clarify-trigger,
.content-section:focus-within .clarify-trigger {
  opacity: 1;
}

.clarify-trigger:hover {
  transform: translateY(-1px);
  background: rgba(255, 107, 53, 0.16);
}

.clarify-trigger svg {
  width: 16px;
  height: 16px;
  fill: #FF6B35;
}

.clarify-inline-panel {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid #f0d5c9;
  border-radius: 10px;
  background: #fffaf7;
  clear: both;
}

.clarify-inline-panel.hidden {
  display: none;
}

.clarify-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.clarify-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  min-height: 38px;
}

.clarify-input:focus {
  outline: none;
  border-color: #FF6B35;
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.12);
}

.clarify-submit {
  min-width: 74px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: #FF6B35;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.clarify-cancel {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #e4cfc3;
  background: #fff;
  color: #777;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.clarify-submit:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.clarify-submit-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: clarifySpin 0.8s linear infinite;
}

.clarify-submit.is-loading .clarify-submit-spinner {
  display: inline-block;
}

.clarify-answer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0d5c9;
}

.clarify-answer-text.clarify-answer-placeholder {
  color: #888;
  font-style: italic;
}

.clarify-answer-loading {
  color: #666;
}

.clarify-answer-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

.clarify-answer-text {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  min-height: 2.5em;
}

@keyframes clarifySpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .clarify-trigger {
    opacity: 1;
  }

  .clarify-input {
    min-width: 0;
    width: 100%;
    flex: 1 1 100%;
  }

  .clarify-submit {
    flex: 1 1 auto;
  }
}

/* ===== Visibility Engine (GEO & SEO) ===== */
.visibility-readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 16px 0 20px;
}

.visibility-readiness-card {
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}

.visibility-score-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.visibility-score-value {
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  color: #FF6B35;
}

.visibility-score-unit {
  color: #777;
  font-size: 13px;
}

.visibility-score-level {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #6f4d3f;
  background: #fff3ec;
  border-radius: 999px;
  padding: 3px 8px;
}

.visibility-score-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #f1f1f1;
  margin: 10px 0;
  overflow: hidden;
}

.visibility-score-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FF6B35, #ff8e68);
}

.visibility-source-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  margin-right: 6px;
  font-size: 12px;
  font-weight: 600;
}

.visibility-source-pill.derived {
  background: #fff3ec;
  color: #b94f20;
}

.visibility-source-pill.template {
  background: #eef6ff;
  color: #1e5ca8;
}

.visibility-source-pill.live {
  background: #f5f5f5;
  color: #666;
}

.visibility-jsonld-preview {
  margin-top: 10px;
  background: #f8f8f8;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
}

.visibility-locked-preview {
  color: #666;
  font-size: 14px;
}

.visibility-breakdown-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  border-top: 1px dashed #ececec;
}

.visibility-breakdown-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.visibility-breakdown-label {
  color: #555;
}

.visibility-breakdown-score {
  color: #222;
  font-weight: 700;
}

.visibility-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.visibility-two-col h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #333;
}

.visibility-two-col ul {
  margin: 0;
}

.visibility-programmatic-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.visibility-programmatic-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 14px;
}

.visibility-programmatic-table th,
.visibility-programmatic-table td {
  border: 1px solid #e8e8e8;
  padding: 10px;
  vertical-align: top;
}

.visibility-programmatic-table th {
  background: #faf8f7;
  font-weight: 700;
  color: #333;
}

/* ============================================
   Enriched stage visuals (personas, design tokens, ADRs, etc.)
   ============================================ */

.enriched-stage-block {
  margin: 0 0 28px;
  padding: 0 0 8px;
  border-bottom: 1px solid rgba(27, 27, 30, 0.08);
}

.enriched-heading {
  font-size: 1.15rem;
  margin: 0 0 12px;
  color: #1b1b1e;
}

.enriched-block {
  margin-bottom: 22px;
}

.persona-card-grid,
.screen-state-grid,
.component-gallery,
.adr-card-grid,
.severity-card-grid,
.competitor-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.persona-card,
.screen-state-card,
.component-card,
.adr-card,
.severity-card,
.competitor-card,
.story-card,
.runbook-card,
.prompt-ticket-card {
  background: #fff;
  border: 1px solid rgba(27, 27, 30, 0.1);
  border-radius: 10px;
  padding: 14px 16px;
}

.persona-role {
  color: #ff6b35;
  font-weight: 600;
  margin: 0 0 6px;
}

.persona-jtbd {
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.persona-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 0.9rem;
}

.persona-pains {
  color: #8a4b2e;
}

.journey-stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.journey-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  background: #fff8f0;
  border-radius: 8px;
  border-left: 3px solid #ff6b35;
}

.journey-index {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  background: #ff6b35;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Prefer the journey rail for Detailed User Flow; keep legacy stepper classes for safety */

.kpi-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.kpi-tile {
  background: #fff;
  border: 1px solid rgba(27, 27, 30, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-tile.kpi-north {
  border-color: #ff6b35;
  background: #fff8f0;
}

.kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
}

.kpi-value {
  font-weight: 600;
  color: #1b1b1e;
  font-size: 0.95rem;
}

.kpi-sub {
  font-size: 0.8rem;
  color: #6c757d;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: #fff8f0;
  border: 1px solid rgba(232, 93, 4, 0.25);
  font-size: 0.82rem;
  color: #1b1b1e;
}

.chip-muted {
  background: #f4f4f5;
  border-color: rgba(27, 27, 30, 0.12);
}

.chip-file {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
}

.stories-accordion {
  border: 1px solid rgba(27, 27, 30, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: #fff;
}

.stories-accordion summary {
  cursor: pointer;
  font-weight: 600;
}

.ac-checklist {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.ac-checklist li {
  margin: 4px 0;
  font-size: 0.9rem;
}

.permissions-matrix {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.permissions-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: start;
}

.permissions-role {
  font-weight: 700;
  color: #ff6b35;
}

.state-chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

.state-empty { background: #e8f5e9; color: #2e7d32; }
.state-error { background: #fdecea; color: #c62828; }
.state-edge { background: #fff3e0; color: #e65100; }

.glossary-list dt {
  font-weight: 700;
  margin-top: 8px;
}

.glossary-list dd {
  margin: 2px 0 0;
  color: #444;
}

.design-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.design-swatch-card {
  border: 1px solid rgba(27, 27, 30, 0.1);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.design-swatch {
  height: 64px;
}

.design-swatch-meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.contrast-badge {
  display: inline-block;
  width: fit-content;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.contrast-pass { background: #e8f5e9; color: #1b5e20; }
.contrast-large { background: #fff8e1; color: #f57f17; }
.contrast-fail { background: #fdecea; color: #b71c1c; }
.contrast-unknown { background: #eee; color: #666; }

.theme-preview-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.theme-toggle-btn {
  border: 1px solid rgba(27, 27, 30, 0.15);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
}

.theme-preview-panel {
  border: 1px solid;
  border-radius: 12px;
  padding: 16px;
}

.theme-preview-surface {
  border: 1px solid;
  border-radius: 10px;
  padding: 14px;
}

.type-specimen-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.type-specimen {
  padding: 8px 0;
  border-bottom: 1px dashed rgba(27, 27, 30, 0.12);
}

.type-label {
  display: inline-block;
  min-width: 72px;
  font-size: 0.75rem;
  color: #6c757d;
  margin-right: 10px;
  font-family: IBM Plex Sans, Helvetica, sans-serif;
  font-weight: 500;
  font-size: 12px;
  line-height: 1.4;
}

.app-icon-preview {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.6rem;
  box-shadow: 0 4px 12px rgba(27, 27, 30, 0.12);
}

.code-panel {
  margin-bottom: 12px;
  border: 1px solid rgba(27, 27, 30, 0.12);
  border-radius: 10px;
  overflow: hidden;
  background: #1b1b1e;
  color: #f5f5f5;
}

.code-panel-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #2a2a2e;
  font-size: 0.85rem;
}

.copy-code-btn {
  background: #ff6b35;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
}

.code-panel-body {
  margin: 0;
  padding: 12px;
  overflow: auto;
  max-height: 240px;
  font-size: 0.78rem;
  white-space: pre-wrap;
}

.stack-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack-badge {
  background: #fff;
  border: 1px solid rgba(27, 27, 30, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
}

.security-alert-card {
  background: #fff5f5;
  border-left: 3px solid #e63946;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
}

.api-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.api-row {
  border: 1px solid rgba(27, 27, 30, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.method-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 8px;
  color: #fff;
}

.method-get { background: #2a9d8f; }
.method-post { background: #e85d04; }
.method-put { background: #457b9d; }
.method-patch { background: #f4a261; }
.method-delete { background: #e63946; }

.api-path {
  font-weight: 600;
}

.api-meta {
  margin-top: 6px;
}

.api-errors {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: #6c757d;
}

.swot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.swot-cell {
  background: #fff;
  border: 1px solid rgba(27, 27, 30, 0.1);
  border-radius: 10px;
  padding: 12px;
}

.swot-cell h4 {
  margin: 0 0 8px;
  color: #ff6b35;
}

.score-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) 1fr 36px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.score-bar {
  height: 8px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f48c06, #e85d04);
}

.gtm-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.gtm-phase {
  border-top: 3px solid #ff6b35;
  background: #fff;
  border-radius: 0 0 10px 10px;
  padding: 12px;
  border: 1px solid rgba(27, 27, 30, 0.1);
}

.gtm-days {
  font-weight: 800;
  color: #e85d04;
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.calendar-cell {
  background: #fff8f0;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.cal-week {
  font-weight: 700;
  color: #e85d04;
}

.checklist-progress {
  height: 8px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.checklist-fill {
  height: 100%;
  background: #2a9d8f;
}

.arch-document .arch-section {
  margin-bottom: 28px;
}

.arch-narrative {
  margin-top: 10px;
  border: 1px solid rgba(27, 27, 30, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fafafa;
}

.arch-repo-pre {
  background: #1b1b1e;
  color: #f5f5f5;
  padding: 14px;
  border-radius: 10px;
  overflow: auto;
  font-size: 0.85rem;
}

.adr-decision {
  color: #1b5e20;
}

.adr-revisit {
  font-size: 0.9rem;
  color: #6c757d;
}

.severity-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.severity-high .severity-badge { background: #fdecea; color: #b71c1c; }
.severity-medium .severity-badge { background: #fff3e0; color: #e65100; }
.severity-low .severity-badge { background: #e8f5e9; color: #1b5e20; }

.arch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.arch-table th,
.arch-table td {
  border: 1px solid rgba(27, 27, 30, 0.1);
  padding: 8px 10px;
  text-align: left;
}

.arch-table th {
  background: #fff8f0;
}

.prompt-pipeline-stepper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.pipeline-step {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(27, 27, 30, 0.1);
  background: #fff;
}

.pipeline-step.is-active {
  border-color: #ff6b35;
  background: #fff8f0;
}

.pipeline-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ff6b35;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.prompt-ticket-card {
  margin-bottom: 12px;
}

.prompt-ticket-card header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.prompt-ticket-card h4 {
  margin: 0;
}

.ticket-goal {
  margin: 0 0 8px;
}

.ticket-variants {
  margin-top: 8px;
}

.method-note,
.positioning-onepager {
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .swot-grid {
    grid-template-columns: 1fr;
  }

  .permissions-row,
  .score-bar-row {
    grid-template-columns: 1fr;
  }
}

/* Spec jargon hover tips (GTM, Positioning, ICP, ADR, Personas & JTBD, …) */
.enriched-block:has(.spec-term),
.enriched-heading:has(.spec-term),
h2:has(.spec-term),
h3:has(.spec-term),
h4:has(.spec-term) {
  position: relative;
  overflow: visible;
}

.enriched-block:has(.spec-term:hover),
.enriched-block:has(.spec-term:focus-visible),
.enriched-heading:has(.spec-term:hover),
.enriched-heading:has(.spec-term:focus-visible),
h2:has(.spec-term:hover),
h3:has(.spec-term:hover),
h4:has(.spec-term:hover) {
  z-index: 10040;
}

.spec-term {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.15em;
  cursor: help;
  z-index: 1;
}

.spec-term:hover,
.spec-term:focus,
.spec-term:focus-visible {
  z-index: 10050;
}

.spec-term-icon {
  font-size: 0.75em;
  opacity: 0.45;
  margin-inline-start: 0.15em;
  vertical-align: baseline;
  color: #6b6b73;
}

.spec-term:hover .spec-term-icon,
.spec-term:focus .spec-term-icon,
.spec-term:focus-visible .spec-term-icon {
  opacity: 0.85;
  color: #e85d04;
}

.spec-term[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  bottom: auto;
  z-index: 10060;
  width: max-content;
  max-width: min(320px, 70vw);
  padding: 10px 12px;
  border-radius: 8px;
  background: #1b1b1e;
  color: #faf8f7;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-align: left;
  white-space: normal;
  box-shadow: 0 10px 28px rgba(27, 27, 30, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.spec-term[data-tooltip]::before {
  content: '';
  position: absolute;
  left: 16px;
  top: calc(100% + 4px);
  bottom: auto;
  border: 6px solid transparent;
  border-bottom-color: #1b1b1e;
  border-top-color: transparent;
  z-index: 10061;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.spec-term[data-tooltip]:hover::after,
.spec-term[data-tooltip]:hover::before,
.spec-term[data-tooltip]:focus::after,
.spec-term[data-tooltip]:focus::before,
.spec-term[data-tooltip]:focus-visible::after,
.spec-term[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.kpi-label.spec-term {
  display: inline-flex;
}
