:root {
    --primary-color: #3b82f6; /* Blue-500 */
    --primary-hover-color: #2563eb; /* Blue-600 */
    --text-primary-color: #1f2937; /* Gray-800 */
    --text-secondary-color: #6b7280; /* Gray-500 */
    --background-color: #f9fafb; /* Gray-50 */
    --card-background-color: #ffffff;
    --border-color: #e5e7eb; /* Gray-200 */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary-color);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out;
}

.btn-primary:hover {
    background-color: var(--primary-hover-color);
}

.btn-secondary {
    background-color: var(--card-background-color);
    color: var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-hover-color);
}

.section-title {
    font-size: 2.25rem; /* 36px */
    font-weight: 700;
    color: var(--text-primary-color);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.25rem; /* 20px */
    color: var(--text-secondary-color);
    max-width: 42rem; /* 672px */
    margin-left: auto;
    margin-right: auto;
}

.fake-browser-ui {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.fake-browser-ui .header {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: #f3f4f6; /* Gray-100 */
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.fake-browser-ui .buttons {
    display: flex;
    gap: 0.5rem;
}

.fake-browser-ui .dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 9999px;
}

.fake-browser-ui .red { background-color: #f87171; } /* Red-400 */
.fake-browser-ui .yellow { background-color: #fbbf24; } /* Amber-400 */
.fake-browser-ui .green { background-color: #4ade80; } /* Green-400 */

.fake-browser-ui .title {
    color: var(--text-secondary-color);
    font-size: 0.875rem;
    margin: 0 auto;
}

.fake-browser-ui .content {
    padding: 2rem;
    min-height: 10rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    font-family: 'Inter', sans-serif;
}

.typing-container {
    display: flex;
    align-items: center;
    width: 100%;
}

.prompt {
    font-size: 1.25rem;
    color: var(--text-secondary-color);
    margin-right: 0.5rem;
}

.typing {
    font-size: 1.25rem;
    color: var(--text-primary-color);
    border-right: 2px solid var(--primary-color);
    animation: blink 0.7s steps(1) infinite;
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.analyzing {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    color: var(--text-secondary-color);
}

.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.report-ready {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: left;
}

.mini-report {
    background-color: #f9fafb; /* Gray-50 */
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    width: 100%;
}

.report-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.report-label {
    font-weight: bold;
    color: var(--text-secondary-color);
}

.report-value {
    color: var(--text-primary-color);
    text-align: right;
}

.urgency-high {
    color: #ef4444; /* Red-500 */
    font-weight: bold;
}

.urgency-medium {
    color: #f59e0b; /* Amber-500 */
    font-weight: bold;
}

.urgency-low {
    color: #22c55e; /* Green-500 */
    font-weight: bold;
}

/* Sample Report Card Styles */
.sample-report-card {
    background-color: var(--card-background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background-color: #f9fafb; /* Gray-50 */
    border-bottom: 1px solid var(--border-color);
}

.confidence-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-body {
    padding: 1.5rem;
}

.report-section {
    margin-bottom: 1.5rem;
}

.report-section:last-child {
    margin-bottom: 0;
}

.section-heading {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary-color);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.issue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.issue-name {
    font-weight: 500;
}

.urgency-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.urgency-badge.urgency-high {
    background-color: #ef4444; /* Red-500 */
}

.issue-description, .recommendation-text {
    color: var(--text-secondary-color);
}

.cost-grid {
    display: grid;
    gap: 0.5rem;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.cost-item:last-child {
    border-bottom: none;
}

.cost-item.total {
    font-weight: bold;
    color: var(--text-primary-color);
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.cost-label {
    color: var(--text-secondary-color);
}

.cost-value {
    font-weight: 500;
}

/* Multi-Step Form Styles */
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 80px;
}

.step-circle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: var(--border-color);
    color: var(--text-secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
}

.step-label {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary-color);
    transition: all 0.3s ease;
}

.progress-line {
    flex-grow: 1;
    height: 2px;
    background-color: var(--border-color);
    margin: 0 -1rem;
}

.progress-step.active .step-circle {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.progress-step.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.form-step {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Report Content Formatting */
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: var(--text-primary-color);
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.prose h1 { font-size: 2.25rem; }
.prose h2 { font-size: 1.875rem; }
.prose h3 { font-size: 1.5rem; }
.prose h4 { font-size: 1.25rem; }

.prose p {
    margin-bottom: 1.25em;
    line-height: 1.6;
}

.prose ul {
    list-style-type: disc;
    padding-left: 1.5em;
    margin-bottom: 1.25em;
}

.prose ol {
    list-style-type: decimal;
    padding-left: 1.5em;
    margin-bottom: 1.25em;
}

.prose li {
    margin-bottom: 0.5em;
}

.prose strong {
    font-weight: 600;
    color: var(--text-primary-color);
}

.prose a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.prose a:hover {
    color: var(--primary-hover-color);
    text-decoration: underline;
}

/* Slideshow Styles */
#slideshow-container {
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

.slide {
    animation: fadeIn 0.5s ease-in-out;
}

/* Table Styles */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25em;
}

.prose th, .prose td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.prose th {
    background-color: #f9fafb; /* Gray-50 */
    font-weight: 600;
}

/* Dashboard overlay & premium visuals */
#severity-center-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: none; /* hide DOM overlay; canvas plugin draws center text now */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    gap: 0.125rem;
}

#severity-center-health {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

#severity-center-cost {
    font-size: 0.875rem;
    color: var(--text-secondary-color);
    line-height: 1;
}

/* Confidence gauge sizing */
#confidence-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    text-align: center;
    display: none; /* hide DOM overlay; canvas plugin draws gauge text now */
}
#confidence-gauge {
    width: 100% !important;
    height: 100% !important;
}

/* Top issues cards */
#top-issues-cards .issue-card,
#top-issues-cards .issue-card .urgency-badge {
    border-radius: 0.5rem;
}

#top-issues-cards .issue-card {
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    box-shadow: 0 4px 8px rgba(15, 23, 42, 0.03);
}

#top-issues-cards .issue-card .issue-title {
    font-weight: 600;
    color: var(--text-primary-color);
}

#top-issues-cards .issue-card .issue-meta {
    color: var(--text-secondary-color);
    font-size: 0.875rem;
}

/* Small responsive tweaks for charts */
canvas {
    display: block;
    max-width: 100%;
}

/* Utility for small chips inside cards */
.small-chip {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

/* Reuse urgency colors */
.small-chip.urgency-high { background-color: #ef4444; }
.small-chip.urgency-medium { background-color: #f59e0b; color: white; }
.small-chip.urgency-low { background-color: #22c55e; }

/* Mobile-first responsive tweaks */
@media (max-width: 640px) {
  .section-title {
    font-size: 1.75rem; /* down from 2.25rem on small screens */
    line-height: 1.2;
  }
  .section-subtitle {
    font-size: 1rem; /* down from 1.25rem */
  }

  .fake-browser-ui .content {
    padding: 1rem; /* tighter on small screens */
  }

  .typing-container {
    flex-wrap: wrap;
  }
  .prompt {
    font-size: 1rem;
    margin-right: 0.25rem;
  }
  .typing {
    font-size: 1rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; /* keep single line with ellipsis on tiny screens */
  }

  /* Stack label/value rows */
  .report-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  .report-value {
    text-align: left;
    width: 100%;
  }

  /* Single-column cost grid on small screens */
  .cost-grid {
    grid-template-columns: 1fr;
  }
}

/* Enhance grids and headings on ≥640px if needed */
@media (min-width: 640px) {
  .cost-grid {
    grid-template-columns: 1fr 1fr;
  }
  .section-title {
    font-size: 2.25rem;
  }
  .section-subtitle {
    font-size: 1.25rem;
  }
}

/* Make Markdown tables scrollable on small screens */
@media (max-width: 640px) {
  .prose table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .prose th, .prose td {
    white-space: nowrap;
  }
}

/* Mobile expandable card layout for analysis matrix tables */
@media (max-width: 640px) {
  table.responsive-matrix.prose {
    display: block !important;
    width: 100% !important;
    border: 0 !important;
    overflow-x: visible !important; /* override generic scroll wrapper */
    -webkit-overflow-scrolling: auto !important;
  }
  table.responsive-matrix.prose thead {
    display: none !important;
  }
  table.responsive-matrix.prose tbody {
    display: block !important;
  }
  table.responsive-matrix.prose tr {
    display: block !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.75rem !important;
    margin-bottom: 1rem !important;
    overflow: hidden !important;
    background: #ffffff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    transition: box-shadow 0.2s ease !important;
  }
  table.responsive-matrix.prose tr:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
  }

  /* Card header - always visible */
  table.responsive-matrix.prose tr .card-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1rem 1.25rem !important;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%) !important;
    border-bottom: 1px solid var(--border-color) !important;
    cursor: pointer !important;
  }
  table.responsive-matrix.prose tr .card-header:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #ffffff 100%) !important;
  }

  table.responsive-matrix.prose tr .card-summary {
    flex: 1 !important;
  }
  table.responsive-matrix.prose tr .issue-name {
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    color: var(--text-primary-color) !important;
    margin-bottom: 0.25rem !important;
  }
  table.responsive-matrix.prose tr .issue-meta {
    display: flex !important;
    gap: 0.75rem !important;
    font-size: 0.9rem !important;
    color: var(--text-secondary-color) !important;
  }
  table.responsive-matrix.prose tr .safety-badge {
    padding: 0.2rem 0.5rem !important;
    border-radius: 0.375rem !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
  }
  table.responsive-matrix.prose tr .safety-badge.critical {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
  }
  table.responsive-matrix.prose tr .safety-badge.high {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
  }
  table.responsive-matrix.prose tr .safety-badge.medium {
    background-color: #fffbeb !important;
    color: #d97706 !important;
  }
  table.responsive-matrix.prose tr .safety-badge.low {
    background-color: #f0fdf4 !important;
    color: #16a34a !important;
  }

  table.responsive-matrix.prose tr .expand-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    border-radius: 50% !important;
    background-color: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }
  table.responsive-matrix.prose tr .expand-btn:hover {
    background-color: var(--primary-hover-color) !important;
    transform: scale(1.05) !important;
  }
  table.responsive-matrix.prose tr .expand-btn svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    transition: transform 0.2s ease !important;
  }
  table.responsive-matrix.prose tr.expanded .expand-btn svg {
    transform: rotate(180deg) !important;
  }

  /* Card details - expandable */
  table.responsive-matrix.prose tr .card-details {
    display: none !important;
    padding: 1rem 1.25rem !important;
    background: #ffffff !important;
  }
  table.responsive-matrix.prose tr.expanded .card-details {
    display: block !important;
  }

  table.responsive-matrix.prose tr .detail-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.5rem 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
  }
  table.responsive-matrix.prose tr .detail-row:last-child {
    border-bottom: none !important;
  }
  table.responsive-matrix.prose tr .detail-label {
    font-weight: 600 !important;
    color: var(--text-secondary-color) !important;
    font-size: 0.9rem !important;
  }
  table.responsive-matrix.prose tr .detail-value {
    color: var(--text-primary-color) !important;
    font-size: 0.9rem !important;
    text-align: right !important;
    flex: 1 !important;
    margin-left: 1rem !important;
  }

  /* Hide original td elements - we'll reconstruct in JS */
  table.responsive-matrix.prose td {
    display: none !important;
  }
}

/* Force card styles for testing when responsive-matrix class is present */
.responsive-matrix.prose {
  display: block !important;
  width: 100% !important;
  border: 0 !important;
  overflow-x: visible !important;
  -webkit-overflow-scrolling: auto !important;
  table-layout: auto !important;
}
.responsive-matrix.prose thead {
  display: none !important;
}
.responsive-matrix.prose tbody {
  display: block !important;
}
.responsive-matrix.prose tr {
  display: block !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 0.75rem !important;
  margin-bottom: 1rem !important;
  overflow: hidden !important;
  background: #ffffff !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  transition: box-shadow 0.2s ease !important;
}
.responsive-matrix.prose tr:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Card header - always visible */
table.responsive-matrix.prose tr .card-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 1rem 1.25rem !important;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%) !important;
  border-bottom: 1px solid var(--border-color) !important;
  cursor: pointer !important;
}
table.responsive-matrix.prose tr .card-header:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #ffffff 100%) !important;
}

table.responsive-matrix.prose tr .card-summary {
  flex: 1 !important;
}
table.responsive-matrix.prose tr .issue-name {
  font-weight: 600 !important;
  font-size: 1.1rem !important;
  color: var(--text-primary-color) !important;
  margin-bottom: 0.25rem !important;
}
table.responsive-matrix.prose tr .issue-meta {
  display: flex !important;
  gap: 0.75rem !important;
  font-size: 0.9rem !important;
  color: var(--text-secondary-color) !important;
}
table.responsive-matrix.prose tr .safety-badge {
  padding: 0.2rem 0.5rem !important;
  border-radius: 0.375rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
}
table.responsive-matrix.prose tr .safety-badge.critical {
  background-color: #fef2f2 !important;
  color: #dc2626 !important;
}
table.responsive-matrix.prose tr .safety-badge.high {
  background-color: #fef2f2 !important;
  color: #dc2626 !important;
}
table.responsive-matrix.prose tr .safety-badge.medium {
  background-color: #fffbeb !important;
  color: #d97706 !important;
}
table.responsive-matrix.prose tr .safety-badge.low {
  background-color: #f0fdf4 !important;
  color: #16a34a !important;
}

table.responsive-matrix.prose tr .expand-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 50% !important;
  background-color: var(--primary-color) !important;
  color: white !important;
  border: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}
table.responsive-matrix.prose tr .expand-btn:hover {
  background-color: var(--primary-hover-color) !important;
  transform: scale(1.05) !important;
}
table.responsive-matrix.prose tr .expand-btn svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  transition: transform 0.2s ease !important;
}
table.responsive-matrix.prose tr.expanded .expand-btn svg {
  transform: rotate(180deg) !important;
}

/* Card details - expandable */
table.responsive-matrix.prose tr .card-details {
  display: none !important;
  padding: 1rem 1.25rem !important;
  background: #ffffff !important;
}
table.responsive-matrix.prose tr.expanded .card-details {
  display: block !important;
}

table.responsive-matrix.prose tr .detail-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 0.5rem 0 !important;
  border-bottom: 1px solid #f1f5f9 !important;
}
table.responsive-matrix.prose tr .detail-row:last-child {
  border-bottom: none !important;
}
table.responsive-matrix.prose tr .detail-label {
  font-weight: 600 !important;
  color: var(--text-secondary-color) !important;
  font-size: 0.9rem !important;
}
table.responsive-matrix.prose tr .detail-value {
  color: var(--text-primary-color) !important;
  font-size: 0.9rem !important;
  text-align: right !important;
  flex: 1 !important;
  margin-left: 1rem !important;
}

/* Hide original td elements - we'll reconstruct in JS */
table.responsive-matrix.prose td {
  display: none !important;
}

/* Test page styles - apply card styles on desktop for testing */
table.responsive-matrix {
  display: block;
  width: 100%;
  border: 0;
  overflow-x: visible;
}
table.responsive-matrix thead {
  display: none;
}
table.responsive-matrix tbody {
  display: block;
}
table.responsive-matrix tr {
  display: block;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}
table.responsive-matrix tr:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Card header - always visible */
table.responsive-matrix tr .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}
table.responsive-matrix tr .card-header:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #ffffff 100%);
}

table.responsive-matrix tr .card-summary {
  flex: 1;
}
table.responsive-matrix tr .issue-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary-color);
  margin-bottom: 0.25rem;
}
table.responsive-matrix tr .issue-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary-color);
}
table.responsive-matrix tr .safety-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}
table.responsive-matrix tr .safety-badge.critical {
  background-color: #fef2f2;
  color: #dc2626;
}
table.responsive-matrix tr .safety-badge.high {
  background-color: #fef2f2;
  color: #dc2626;
}
table.responsive-matrix tr .safety-badge.medium {
  background-color: #fffbeb;
  color: #d97706;
}
table.responsive-matrix tr .safety-badge.low {
  background-color: #f0fdf4;
  color: #16a34a;
}

table.responsive-matrix tr .expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
table.responsive-matrix tr .expand-btn:hover {
  background-color: var(--primary-hover-color);
  transform: scale(1.05);
}
table.responsive-matrix tr .expand-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.2s ease;
}
table.responsive-matrix tr.expanded .expand-btn svg {
  transform: rotate(180deg);
}

/* Card details - expandable */
table.responsive-matrix tr .card-details {
  display: none;
  padding: 1rem 1.25rem;
  background: #ffffff;
}
table.responsive-matrix tr.expanded .card-details {
  display: block;
}

table.responsive-matrix tr .detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}
table.responsive-matrix tr .detail-row:last-child {
  border-bottom: none;
}
table.responsive-matrix tr .detail-label {
  font-weight: 600;
  color: var(--text-secondary-color);
  font-size: 0.9rem;
}
table.responsive-matrix tr .detail-value {
  color: var(--text-primary-color);
  font-size: 0.9rem;
  text-align: right;
  flex: 1;
  margin-left: 1rem;
}

/* Hide original td elements - we'll reconstruct in JS */
table.responsive-matrix td {
  display: none;
}

/* ASCII diagrams on mobile */
@media (max-width: 640px) {
  pre.ascii-diagram {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.15;
    white-space: pre; /* preserve ASCII layout */
    overflow-x: auto;
    position: relative;
    padding-top: 2rem; /* room for toggle control */
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
  }
  pre.ascii-diagram.ascii-zoom {
    font-size: 14px;
    line-height: 1.2;
  }
  pre.ascii-diagram .ascii-toggle {
    position: absolute;
    top: 6px;
    right: 8px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 12px;
    padding: 2px 6px;
  }
}

/* Print Styles */
@media print {
    body.printing #header,
    body.printing #slideshow-nav,
    body.printing #print-btn,
    body.printing #back-to-reports-btn,
    body.printing footer {
        display: none;
    }

    body.printing #report-container {
        display: block !important;
        position: static;
        box-shadow: none;
        border: none;
    }

    body.printing .slide {
        display: block !important;
        page-break-after: always;
    }

    body.printing .prose table {
        font-size: 10px;
        overflow-x: auto;
        display: block;
    }
}
