/* --- CRISPR data analysis portal stylesheet --- */

:root {
  --primary-color: #0f4c81; /* Deep Slate Blue */
  --primary-hover: #0a3d69;
  --secondary-color: #008b8b; /* Dark Cyan/Teal */
  --accent-color: #d11a5b; /* Monash Rose/Pink */
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
  --bg-card: #ffffff;
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --border-color: #dcdde1;
  --border-radius: 12px;
  --border-radius-sm: 6px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.12);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Status Colors */
  --status-started-bg: #e3f2fd;
  --status-started-text: #1e88e5;
  --status-started-border: #90caf9;

  --status-running-bg: #ede9fe;
  --status-running-text: #6d28d9;
  --status-running-border: #c4b5fd;
  
  --status-finished-bg: #e8f5e9;
  --status-finished-text: #2e7d32;
  --status-finished-border: #a5d6a7;
  
  --status-error-bg: #ffebee;
  --status-error-text: #c62828;
  --status-error-border: #ef9a9a;
  
  /* Dashboard section border color for grouping */
  --group-border: 2px dashed #a5d6a7; /* Soft Green Dashed Border */
  --group-bg: #f8faf8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* --- Layout Components --- */

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
}

.app-header {
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-logo {
  width: 68.25px;
  height: 68.25px;
  flex: 0 0 68.25px;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.1;
  padding-bottom: 5px;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(to right, var(--primary-color), var(--secondary-color)) 1;
}

.brand-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

@media (max-width: 768px) {
  .app-header {
    padding: 10px 0;
  }

  .nav-container {
    padding: 0 14px;
    gap: 12px;
  }

  .brand {
    gap: 8px;
    min-width: 0;
  }

  .portal-logo {
    width: 58.5px;
    height: 58.5px;
    flex-basis: 58.5px;
  }

  .brand-text h1 {
    font-size: 1.1rem;
  }

  .brand-text span {
    font-size: 0.65rem;
    line-height: 1.25;
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Header Buttons */
.nav-btn {
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn.home-btn {
  background-color: var(--primary-color);
  color: white;
}

.nav-btn.home-btn:hover {
  background-color: var(--primary-hover);
}

.nav-btn.project-btn {
  background-color: var(--accent-color);
  color: white;
  position: relative;
}

.nav-btn.project-btn:hover {
  background-color: #a81043;
}

.nav-btn.project-btn i {
  font-size: 0.85rem;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: none;
  flex-direction: column;
  min-width: 180px;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}

.dropdown-menu.active {
  display: flex;
}

.dropdown-item {
  padding: 10px 16px;
  color: var(--text-main);
  text-align: left;
  background: none;
  border: none;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover {
  background-color: #f5f7fa;
  color: var(--primary-color);
}

/* Footer styling */
.app-footer {
  background-color: var(--bg-card);
  padding: 24px 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  font-size: calc(0.85rem - 1px);
  color: var(--text-muted);
}

.footer-link {
  font-weight: 500;
  text-decoration: underline;
}

.contact-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 35, 60, 0.48);
}

.contact-modal {
  position: relative;
  width: min(100%, 540px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 30px;
  border-radius: var(--border-radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
}

.contact-modal h2 {
  color: var(--primary-color);
  margin-bottom: 4px;
}

.contact-modal > p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.contact-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.contact-message-input {
  min-height: 150px;
  resize: vertical;
}

.contact-captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-captcha-row img {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  cursor: pointer;
}

.contact-captcha-row .captcha-code-input {
  flex: 0 0 146px;
  width: 146px;
}

.contact-submit-button {
  width: 100%;
  min-height: 48px;
}

.contact-form-feedback {
  min-height: 1.5em;
  margin: -6px 0 12px;
  font-size: 0.9rem;
}

.contact-form-feedback.success { color: var(--status-finished-text); }
.contact-form-feedback.error { color: var(--status-error-text); }

.citation-modal {
  width: min(100%, 720px);
  text-align: center;
}

.citation-content {
  margin: 20px 4px 8px;
  color: var(--text-main);
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.55;
}

.citation-content p {
  margin: 0 0 10px;
}

.citation-content ol {
  margin: 0;
  padding-left: 1.35rem;
}

.citation-content li + li {
  margin-top: 12px;
}

.citation-tool-heading {
  margin: 22px 0 8px !important;
}

.citation-tool-links {
  margin: 0;
  padding-left: 1.35rem;
  list-style: disc;
}

.citation-tool-links a {
  color: var(--primary-color);
}

.citation-tool-links li + li {
  margin-top: 5px;
}

.citation-tool-links a:hover,
.citation-tool-links a:focus-visible {
  color: var(--primary-hover);
}

.citation-content a {
  overflow-wrap: anywhere;
}

.declaration-content {
  margin-top: 18px;
  text-align: left;
  color: var(--text-main);
  font-size: 0.92rem;
}

.declaration-content p {
  margin-bottom: 12px;
}

.declaration-content ul {
  margin: 0 0 0 20px;
}

.declaration-content li {
  margin-bottom: 10px;
}

.app-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 32px auto;
  padding: 0 24px;
}

/* Loader Spinner */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
}

.spinner {
  border: 4px solid rgba(15, 76, 129, 0.1);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border-left-color: var(--primary-color);
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

/* --- Views & Containers --- */

.view-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: 32px;
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease-out forwards;
}

.view-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 12px;
  border-bottom: 2px solid #eef2f5;
  padding-bottom: 12px;
}

.view-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* --- Project Landing & Success Page --- */

.landing-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
}

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

.landing-info h2 {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-info p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 24px;
}

.features-list {
  list-style: none;
}

.features-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 500;
}

.features-list li i {
  color: var(--secondary-color);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background-color: #fafbfc;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.15);
}

/* A compact, single-field OTP treatment: six underlined positions still allow
   ordinary typing and paste, without the focus/accessibility problems of six
   separate inputs. */
.captcha-code-input {
  /* One 21px cell per character. With a monospace glyph (1ch), the left
     inset and letter spacing place each glyph exactly at the line centre. */
  --captcha-cell: 21px;
  border: 0;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  padding: 6px 0 5px 4.75px;
  background-color: transparent;
  /* Draw exactly six visible cells; the remaining input width is reserved for
     the caret after character six, preventing the browser from scrolling it. */
  background-image: repeating-linear-gradient(to right, #94a3b8 0 16px, transparent 16px var(--captcha-cell));
  background-position: 2.5px bottom;
  background-repeat: no-repeat;
  background-size: 126px 1px;
  box-shadow: none;
  color: #0f4c81;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: calc(var(--captcha-cell) - 1ch);
  text-transform: uppercase;
  overflow: hidden;
}

/* Safari can add an autofill/user decoration inside a text field. It occupies
   the sixth character cell and causes the value to scroll after five chars;
   CAPTCHA fields are not account or contact fields, so suppress that control. */
.captcha-code-input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  display: none;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.captcha-code-input::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  display: none;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.captcha-code-input:focus {
  border: 0;
  background-color: transparent;
  box-shadow: none;
}

.captcha-code-input::placeholder {
  color: #cbd5e1;
  opacity: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 6px rgba(15, 76, 129, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(15, 76, 129, 0.3);
}

.btn-accent {
  background-color: var(--accent-color);
  color: white;
  box-shadow: 0 4px 6px rgba(209, 26, 91, 0.2);
}

.btn-accent:hover {
  background-color: #b5124b;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(209, 26, 91, 0.3);
}

.btn-secondary {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

/* Result actions mix links and buttons; normalise their inherited line height. */
.result-action-button {
  line-height: 1.2;
}

/* Success Mock Email Area */
.email-mock {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  margin: 24px 0;
  box-shadow: var(--shadow-sm);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.email-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.email-row {
  margin-bottom: 6px;
  display: flex;
}

.email-label {
  font-weight: 700;
  width: 80px;
  color: var(--text-muted);
}

.email-subject {
  font-weight: 600;
  color: var(--text-main);
}

.email-body {
  font-size: 0.95rem;
  color: #334155;
}

.email-body p {
  margin-bottom: 16px;
}

.email-cta {
  text-align: center;
  margin: 24px 0;
}

/* --- Project Dashboard Elements --- */

.dashboard-header-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.project-details-tag {
  background-color: #f1f5f9;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
}

.project-details-tag strong {
  color: var(--text-main);
}

.dashboard-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  gap: 8px;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--primary-color);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Grid layout for Dashboard Tab */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-icon.total { background: #f1f5f9; color: var(--text-main); }
.stat-icon.started { background: #e3f2fd; color: #1e88e5; }
.stat-icon.finished { background: #e8f5e9; color: #2e7d32; }
.stat-icon.error { background: #ffebee; color: #c62828; }

.stat-info h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-info span {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

/* Home / Selection Grid */
.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.selection-card {
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  background-color: var(--bg-card);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.selection-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.selection-icon {
  font-size: 2rem;
  color: var(--primary-color);
}

.selection-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
}

.selection-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
}

/* --- Parameter Group Container (Dashed border as in screenshot) --- */
.param-group {
  border: var(--group-border);
  border-radius: var(--border-radius);
  background-color: var(--group-bg);
  padding: 24px;
  margin-bottom: 24px;
  transition: border-color 0.25s;
}

.collapsible-panel {
  overflow: hidden;
  will-change: max-height, opacity, transform, padding, margin-bottom, border-width;
  transition:
    max-height 0.4s ease,
    opacity 0.4s ease,
    transform 0.4s ease,
    padding 0.4s ease,
    margin-bottom 0.4s ease,
    border-width 0.4s ease,
    background-color 0.4s ease;
}

.collapsible-panel.is-collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  border-width: 0;
  background-color: transparent;
  pointer-events: none;
}

.param-group-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1b5e20; /* Dark green matching Monash green tone */
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px dashed #c8e6c9;
  padding-bottom: 8px;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* The .param-grid display rule otherwise overrides the browser's [hidden]
   default, causing inactive mode-specific parameter groups to remain visible. */
.param-grid[hidden],
.amp-adapter-fields[hidden] {
  display: none !important;
}

/* Code layout / Textarea layouts */
.textarea-help {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.single-end-upload-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: fit-content;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: var(--border-radius-sm);
  background: #eff6ff;
  color: #334155;
  font-size: 0.82rem;
  line-height: 1.4;
  cursor: pointer;
}

.single-end-upload-option input {
  margin-top: 3px;
  accent-color: var(--primary-color);
}

.single-end-upload-option small {
  color: var(--text-muted);
}

.single-end-upload-option code {
  font-family: 'Courier New', Courier, monospace;
}

.single-end-upload-option.is-disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.grna-format-help p {
  margin: 0 0 4px;
}

.grna-format-help ul {
  margin: 0;
  padding-left: 1.25rem;
}

.grna-format-help li {
  margin: 4px 0;
}

.grna-format-help code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
}

.monospace-textarea {
  width: 100%;
  height: 120px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  padding: 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: #fafafa;
  resize: vertical;
  line-height: 1.4;
}

.monospace-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: white;
}

.textarea-example {
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  padding: 8px 12px;
  margin-top: 8px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  color: #475569;
  white-space: pre-wrap;
  max-height: 100px;
  overflow-y: auto;
}

/* Upload Container Drag and Drop */
.upload-container {
  border: 2px dashed #94a3b8;
  border-radius: var(--border-radius);
  background-color: #f8fafc;
  padding: 32px;
  text-align: center;
  transition: all 0.25s ease;
  position: relative;
  cursor: pointer;
}

.upload-container:hover, .upload-container.drag-over {
  border-color: var(--primary-color);
  background-color: #f1f5f9;
}

.upload-icon-box {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.upload-container h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.upload-container p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.grna-upload-summary,
.grna-tail-examples,
.grna-tail-examples-heading,
.grna-tail-example {
  display: block;
}

.grna-tail-examples {
  margin-top: 6px;
}

.grna-tail-examples-heading {
  font-weight: 600;
}

.grna-tail-example {
  overflow-wrap: anywhere;
}

.upload-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: white;
  padding: 4px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
}

.upload-control-btn {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #475569;
  cursor: pointer;
  transition: background-color 0.2s;
}

.upload-control-btn.upload-control-btn-wide {
  width: auto;
  min-width: 88px;
  height: 32px;
  padding: 0 12px;
  border-radius: 14px;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.upload-control-btn.upload-control-btn-wide span {
  white-space: nowrap;
}

.upload-control-btn:hover {
  background-color: #f1f5f9;
  color: var(--primary-color);
}

/* File explorer mock view after upload */
.file-list-preview {
  margin-top: 16px;
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  background-color: white;
  text-align: left;
  overflow: hidden;
}

.file-list-header {
  background-color: #f1f5f9;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
}

#reads-file-items,
#grna-file-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}

.file-item {
  padding: 10px 12px;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
}

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

#reads-file-items .file-item,
#grna-file-items .file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 5px 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

#reads-file-items .file-info,
#grna-file-items .file-info {
  min-width: 0;
}

.file-name {
  min-width: 0;
}

#reads-file-items .file-name,
#grna-file-items .file-name {
  flex: 1 1 auto;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#reads-file-items .file-name-recent,
#grna-file-items .file-name-recent {
  color: #dc2626;
}

.file-item i {
  color: var(--primary-color);
}

.file-size {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 4px 8px;
  min-width: 0;
}

/* Keep filenames legible; only the secondary upload metadata is one step smaller. */
.file-meta .file-size {
  font-size: 0.6875rem;
}

.grna-tail-preview {
  grid-column: 1 / -1;
  width: 100%;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.grna-tail-preview summary {
  cursor: pointer;
  color: var(--primary-color);
  font-weight: 600;
}

.grna-tail-preview-heading,
.grna-tail-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 0.7fr);
  gap: 6px;
  margin-top: 4px;
}

.grna-tail-preview-heading {
  font-weight: 600;
}

.grna-tail-preview-row code,
.grna-tail-preview-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-time-compact {
  display: none;
}

.remove-file-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
}

#reads-file-items .remove-file-btn,
#grna-file-items .remove-file-btn {
  flex: 0 0 auto;
  font-size: 0.75rem;
  line-height: 1;
}

.remove-file-btn:hover {
  color: var(--accent-color);
}

.upload-progress-row {
  width: 100%;
}

#reads-file-items .upload-progress-row,
#grna-file-items .upload-progress-row {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.upload-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  transition: width 0.2s linear;
}

.demultiplexing-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #f59e0b;
  border-radius: var(--border-radius-sm);
  background: #fffbeb;
  color: #92400e;
  font-size: 0.9rem;
  line-height: 1.5;
}

.demultiplexing-warning > i {
  flex: 0 0 auto;
  margin-top: 3px;
  color: #d97706;
}

.de-filtering-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: var(--text-main);
  font-size: 0.9rem;
  line-height: 1.5;
}

.de-filtering-info-container {
  border-color: #93c5fd;
  background: #eff6ff;
}

.de-filtering-info-container .visuals-card-heading {
  border-bottom-color: #bfdbfe;
}

.de-filtering-info-container .visuals-card-heading h4 {
  color: var(--text-main);
}

.de-filtering-info-container .de-filtering-info {
  padding-top: 4px;
  border-radius: var(--border-radius-sm);
}

.de-filtering-info-note {
  margin-top: 4px;
}

.de-filtering-info > i {
  flex: 0 0 auto;
  margin-top: 3px;
  color: #2563eb;
}

@media (max-width: 1150px) {
  .upload-time-full {
    display: none;
  }

  .upload-time-compact {
    display: inline;
  }
}

@media (max-width: 950px) {
  #reads-file-items,
  #grna-file-items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #reads-file-items,
  #grna-file-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  #reads-file-items,
  #grna-file-items {
    grid-template-columns: 1fr;
  }
}

/* Drag-Drop Box for guide RNA */
.drop-box-grna {
  background-color: #f0fdf4;
  border: 2px dashed #86efac;
  border-radius: var(--border-radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.drop-box-grna:hover {
  background-color: #dcfce7;
  border-color: #22c55e;
}

.upload-feedback {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.upload-notice {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.upload-notice.success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.upload-notice.error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.drop-box-grna.active {
  background-color: #dcfce7;
  border-color: #22c55e;
  font-weight: 600;
}

/* Form Action Buttons Container */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid #eef2f5;
  padding-top: 20px;
}

/* Differential Comparison side-by-side */
.comparison-layout {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.comparison-pane {
  display: flex;
  flex-direction: column;
}

.comparison-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  text-align: center;
}

.comparison-label.treated { color: #d97706; }
.comparison-label.control { color: #2563eb; }

.comparison-vs {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-muted);
  text-align: center;
  align-self: center;
}

@media (max-width: 600px) {
  .comparison-layout {
    grid-template-columns: 1fr;
  }
  .comparison-vs {
    margin: 8px 0;
  }
}

/* --- Analysis Dashboard & Details Area --- */

.analysis-table-container {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  background-color: white;
  margin-bottom: 24px;
}

.analysis-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.analysis-table th {
  background-color: #f8fafc;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid #e2e8f0;
}

.analysis-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.analysis-table tr:last-child td {
  border-bottom: none;
}

.analysis-table tr:hover td {
  background-color: #f8fafc;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.status-badge.started {
  background-color: var(--status-started-bg);
  color: var(--status-started-text);
  border-color: var(--status-started-border);
}

.status-badge.running {
  background-color: var(--status-running-bg);
  color: var(--status-running-text);
  border-color: var(--status-running-border);
}

.status-badge.finished {
  background-color: var(--status-finished-bg);
  color: var(--status-finished-text);
  border-color: var(--status-finished-border);
}

.status-badge.error {
  background-color: var(--status-error-bg);
  color: var(--status-error-text);
  border-color: var(--status-error-border);
}

.status-badge.cancelled {
  background-color: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.status-badge.running i {
  animation: spin 1s linear infinite;
}

/* Detailed view panel */
.details-panel {
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius);
  background-color: white;
  padding: 24px;
  margin-top: 24px;
  animation: slideUp 0.3s ease;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
}

.details-title h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
}

.details-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Running/Started state log interface */
.run-log-box {
  background-color: #0f172a;
  color: #38bdf8;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6625rem;
  padding: 16px;
  border-radius: var(--border-radius-sm);
  height: 420px;
  min-height: 260px;
  max-height: 75vh;
  resize: vertical;
  overflow: auto;
  margin: 16px 0;
  border: 1px solid #1e293b;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

/* Kept for the active execution-log selector used by the auto-scroll logic. */
.execution-log-box {
  height: 220px;
  min-height: 220px;
  max-height: 220px;
  resize: none;
  scroll-behavior: auto;
}

.analysis-progress-tracker {
  margin: 0 0 20px;
  padding: 14px 16px 12px;
  background: #fff;
  border: 1px solid #dbe5f0;
  border-radius: var(--border-radius-sm);
}

.analysis-progress-steps {
  display: flex;
  align-items: flex-start;
  min-width: max-content;
}

.analysis-progress-tracker {
  overflow-x: auto;
}

.analysis-progress-step {
  position: relative;
  display: flex;
  flex: 1 1 125px;
  flex-direction: column;
  align-items: center;
  min-width: 112px;
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: center;
}

.analysis-progress-step:not(:last-child)::after {
  position: absolute;
  top: 12px;
  left: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 2px;
  background: #dbe5f0;
  content: '';
}

.analysis-progress-marker {
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-bottom: 6px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.analysis-progress-label {
  max-width: 135px;
}

.analysis-progress-step.completed,
.analysis-progress-step.current {
  color: #1e5f9f;
}

.analysis-progress-step.completed .analysis-progress-marker {
  border-color: #198754;
  background: #198754;
  color: #fff;
}

.analysis-progress-step.completed:not(:last-child)::after {
  background: #198754;
}

.analysis-progress-step.current .analysis-progress-marker {
  border-color: #1e88e5;
  background: #e8f3ff;
  color: #1e88e5;
}

.analysis-progress-step.error {
  color: #b91c1c;
}

.analysis-progress-step.error .analysis-progress-marker {
  border-color: #dc2626;
  background: #fee2e2;
  color: #dc2626;
}

.analysis-progress-step.cancelled {
  color: #475569;
}

.analysis-progress-step.cancelled .analysis-progress-marker {
  border-color: #64748b;
  background: #f1f5f9;
  color: #475569;
}

.analysis-progress-current {
  margin-top: 12px;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
}

.analysis-progress-current-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analysis-progress-current i {
  margin-right: 5px;
  color: #1e88e5;
}

.analysis-progress-cancel {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-color: #fecaca;
  background-color: #ffebee;
  color: #c62828;
  font-size: 0.78rem;
}

.analysis-progress-queue {
  color: #475569;
  font-size: 0.78rem;
  font-weight: 400;
}

@media (max-width: 640px) {
  .analysis-progress-tracker {
    padding: 12px;
  }

  .analysis-progress-step {
    min-width: 100px;
    font-size: 0.68rem;
  }

  .analysis-progress-current-row {
    align-items: flex-start;
  }
}

.run-log-line {
  margin-bottom: 4px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.run-log-line.timestamp {
  color: #64748b;
}

.run-log-line.success {
  color: #4ade80;
}

.run-log-line.error {
  color: #f87171;
}

.run-log-line.cancelled {
  color: #cbd5e1;
}

/* Visualisation layouts */
.visuals-section + .visuals-section {
  margin-top: 32px;
}

.result-downloads-section {
  margin-top: 32px;
}

.result-download-list {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}

.result-download-file {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 13px 16px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fafc;
}

.result-download-icon {
  display: inline-grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #ffffff;
  color: var(--primary-color);
  font-size: 1.05rem;
}

.result-download-icon:hover,
.result-download-icon:focus-visible {
  border-color: var(--primary-color);
  background: #eaf1f8;
  color: var(--primary-hover);
}

.result-download-details {
  min-width: 0;
}

.result-download-name {
  display: inline-block;
  color: var(--primary-color);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.result-download-name:hover,
.result-download-name:focus-visible {
  color: var(--primary-hover);
  text-decoration: underline;
}

.result-download-details p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .result-download-file {
    align-items: flex-start;
  }
}

.visuals-section-title {
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-size: 1.15rem;
  font-weight: 700;
}

.visuals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Per-sample quality plots are deliberately compact so a typical desktop
   dashboard can compare four FASTQ files side by side. Other result cards
   retain the wider default grid above. */
.visuals-section[data-visualization-section="Sequencing Quality"] .visuals-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .visuals-section[data-visualization-section="Sequencing Quality"] .visuals-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .visuals-section[data-visualization-section="Sequencing Quality"] .visuals-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .visuals-section[data-visualization-section="Sequencing Quality"] .visuals-grid {
    grid-template-columns: 1fr;
  }
}

.differential-summary-table-wrap {
  overflow-x: auto;
}

.differential-summary-table {
  width: min(100%, 720px);
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.differential-summary-table th,
.differential-summary-table td {
  padding: 9px 12px;
  border: 1px solid #dbe3ef;
  text-align: right;
}

.differential-summary-table th:first-child,
.differential-summary-table td:first-child {
  text-align: left;
}

.differential-summary-table th {
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 700;
}

.visuals-card {
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  padding: 16px;
  background-color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.visuals-card-wide {
  grid-column: span 2;
}

/* Large MDS and correlation panels must occupy a row of their own. */
.visuals-card-full-row {
  grid-column: 1 / -1;
}

.analysis-summary-card {
  padding: 18px;
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #f8fbff 0%, #eff6ff 100%);
}

.analysis-summary-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #bfdbfe;
}

.analysis-summary-heading h4 {
  margin: 0;
  padding: 0;
  border: 0;
  text-align: left;
  color: #1e3a8a;
  font-size: 1rem;
}

.analysis-summary-heading h4 i {
  margin-right: 6px;
}

.analysis-summary-heading p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.82rem;
}

.analysis-summary-rerun {
  white-space: nowrap;
}

.analysis-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.analysis-summary-stats > div {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
}

.analysis-summary-stats dt {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.analysis-summary-stats dd {
  margin: 4px 0 0;
  color: #1e3a8a;
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.analysis-summary-configuration {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.analysis-summary-configuration-label {
  flex: 0 0 auto;
  padding-top: 5px;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 700;
}

.analysis-summary-tags {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
}

.analysis-summary-tags span {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 0.78rem;
  line-height: 1.35;
}

.analysis-retention-footer {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.4;
}

.analysis-retention-footer strong {
  color: #475569;
  font-weight: 600;
}

.analysis-summary-grna-libraries {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #bfdbfe;
}

.analysis-summary-grna-libraries h5 {
  margin: 0 0 9px;
  color: #1e3a8a;
  font-size: 0.84rem;
}

.analysis-summary-grna-libraries h5 i {
  margin-right: 6px;
}

.analysis-summary-grna-table-wrap {
  overflow-x: auto;
}

.analysis-summary-grna-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  color: #334155;
  font-size: 0.78rem;
}

.analysis-summary-grna-table th,
.analysis-summary-grna-table td {
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  text-align: right;
  white-space: nowrap;
}

.analysis-summary-grna-table th:first-child,
.analysis-summary-grna-table td:first-child {
  max-width: 360px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.analysis-summary-grna-table thead th {
  background: #eff6ff;
  color: #475569;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.analysis-summary-grna-table tfoot th,
.analysis-summary-grna-table tfoot td {
  background: #f8fbff;
  color: #1e3a8a;
  font-weight: 700;
}

@media (max-width: 760px) {
  .visuals-card-wide {
    grid-column: span 1;
  }

  .analysis-summary-stats {
    grid-template-columns: 1fr;
  }

  .analysis-summary-configuration {
    display: block;
  }

  .analysis-summary-configuration-label {
    display: block;
    margin-bottom: 6px;
    padding-top: 0;
  }
}

.visuals-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 6px;
}

.visuals-card.quality-card h4 {
  font-size: calc(0.95rem - 4px);
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.visuals-card.quality-card {
  padding: 10px;
}

/* Keep the controls on their own line so the sample title can use the full
   card width instead of wrapping narrowly beside the toolbar. */
.visuals-card.quality-card .visuals-card-heading {
  display: grid;
  grid-template-areas:
    "toolbar"
    "title";
  justify-items: end;
  margin-bottom: 8px;
}

.visuals-card.quality-card .visuals-card-heading h4 {
  grid-area: title;
  width: 100%;
  margin-top: 3px;
}

.visuals-card.quality-card .chart-toolbar {
  grid-area: toolbar;
}

.visuals-card-heading {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.visuals-card-heading h4 {
  flex: 1 1 auto;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.chart-export-status {
  margin-left: 5px;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.chart-tool-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.chart-tool-button {
  width: 25px;
  height: 25px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 0.73rem;
}

.chart-tool-button:hover,
.chart-tool-button.is-active {
  border-color: var(--primary-color);
  background: #eaf1f8;
  color: var(--primary-color);
}

.visuals-card-body {
  height: 250px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chart-view-layer {
  width: 100%;
  height: 100%;
  position: relative;
}

.plotly-vector-chart {
  width: 100%;
  height: 100%;
}

.visuals-card-body.is-pan-enabled {
  cursor: grab;
  touch-action: none;
}

.visuals-card-body.is-pan-enabled.is-panning {
  cursor: grabbing;
  user-select: none;
}

.visuals-card-body.heatmap-card-body {
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

.heatmap-card-body > .chart-view-layer {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* Keep the MDS plot as tall as the expanded Sample Correlation card. */
.visuals-card-body.mds-card-body,
.visuals-card-body.volcano-card-body,
.visuals-card-body.density-card-body,
.visuals-card-body.voom-mds-card-body {
  height: 500px;
}

.visuals-card-body.variant-card-body {
  height: 300px;
}

/* A full-width stacked allocation chart needs room for rotated sample labels. */
.visuals-card-body.read-allocation-card-body {
  height: 410px;
}

.visuals-card-body.quality-boxplot-body {
  display: block;
  height: 150px;
  overflow: hidden;
}

.quality-boxplot-scroll {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.quality-boxplot {
  display: block;
  min-height: 150px;
}

.quality-boxplot-axis-label,
.quality-boxplot-title {
  fill: #334155;
  font-family: var(--font-sans, Arial, sans-serif);
  font-size: 10px;
}

.quality-boxplot-title {
  font-size: 11px;
}

/* Native SVG heatmap remains sharp during zooming and PDF export. */
.correlation-heatmap {
  display: block;
  flex: 0 0 auto;
}

.heatmap-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 2px;
  transition: all 0.2s;
  cursor: pointer;
}

.heatmap-cell:hover {
  stroke: #111827;
  stroke-width: 1px;
}

.heatmap-tooltip {
  position: absolute;
  z-index: 5;
  max-width: calc(100% - 16px);
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.heatmap-tooltip.is-visible {
  opacity: 1;
}

/* --- Common Keyframe Animations --- */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

/* --- Drag and Drop Samples Styles --- */
.drag-drop-samples-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.samples-pool-container {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: #ffffff;
  padding: 12px;
}

.pool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.pool-actions {
  display: flex;
  gap: 12px;
}

.pool-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--primary-color);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  padding: 0;
}

.pool-btn:hover {
  color: var(--primary-hover);
}

.samples-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
  padding: 8px;
  background-color: #fafbfc;
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-sm);
  min-height: 50px;
}

.sample-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: grab;
  user-select: none;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.sample-item:hover {
  border-color: var(--primary-color);
  background-color: #f0f7ff;
  transform: translateY(-1px);
}

.sample-item.selected {
  border-color: var(--primary-color);
  background-color: #e0f2fe;
  box-shadow: 0 0 0 2px rgba(15, 76, 129, 0.2);
}

.sample-item:active {
  cursor: grabbing;
}

.sample-drag-handle {
  color: var(--text-muted);
  margin-right: 2px;
}

.drag-drop-targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .drag-drop-targets {
    grid-template-columns: 1fr;
  }
}

.drop-target-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drop-target-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.drop-target-title.treated { color: #d97706; }
.drop-target-title.control { color: #2563eb; }

.drop-zone {
  min-height: 140px;
  max-height: 200px;
  overflow-y: auto;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  background-color: #fafbfc;
  transition: all 0.2s ease;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}

.drop-zone.drag-over {
  background-color: #f0fdf4;
  border-color: #22c55e;
}

.drop-zone.treated-zone {
  border-color: #fed7aa;
}

.drop-zone.treated-zone.drag-over {
  background-color: #fff7ed;
  border-color: #f97316;
}

.drop-zone.control-zone {
  border-color: #bfdbfe;
}

.drop-zone.control-zone.drag-over {
  background-color: #eff6ff;
  border-color: #3b82f6;
}

.dropped-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  animation: scaleIn 0.2s ease;
}

.dropped-badge.treated {
  background-color: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.dropped-badge.control {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.remove-badge-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transition: background-color 0.2s;
  padding: 0;
}

.remove-badge-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.drag-instructions {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  font-style: italic;
}

.sample-keyword-modal {
  width: min(100%, 640px);
}

.sample-keyword-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.sample-keyword-matches {
  min-height: 64px;
  max-height: 180px;
  margin-top: 14px;
  padding: 10px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: #fafbfc;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sample-keyword-matches strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-main);
}

.sample-keyword-match-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sample-keyword-match-list span {
  padding: 3px 8px;
  border-radius: 50px;
  background: #e0f2fe;
  color: var(--primary-color);
  font-size: 0.78rem;
}

.sample-keyword-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.maintenance-console {
  display: none;
  position: relative;
  overflow: hidden;
  margin: -8px 0 24px;
  border: 2px solid #18181b;
  border-radius: var(--border-radius-sm);
  background: #18181b;
  box-shadow: 0 7px 16px rgba(24, 24, 27, 0.18);
}

.maintenance-console.is-visible {
  display: block;
}

.maintenance-console-stripes {
  height: 12px;
  background: repeating-linear-gradient(-45deg, #111827 0 12px, #facc15 12px 24px);
}

.maintenance-console-content {
  padding: 14px;
  color: #fefce8;
}

.maintenance-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.maintenance-console-title {
  color: #fde047;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.maintenance-console-close {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #facc15;
  border-radius: 4px;
  background: #18181b;
  color: #fde047;
  cursor: pointer;
}

.maintenance-console-close:hover,
.maintenance-console-close:focus-visible {
  background: #facc15;
  color: #18181b;
}

.maintenance-command-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.maintenance-command-input {
  min-width: 0;
  flex: 1;
  border: 1px solid #facc15;
  border-radius: 4px;
  padding: 9px 10px;
  background: #09090b;
  color: #fef08a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.maintenance-command-submit {
  border: 1px solid #facc15;
  border-radius: 4px;
  padding: 0 14px;
  background: #facc15;
  color: #18181b;
  cursor: pointer;
  font-weight: 800;
}

.maintenance-command-output {
  min-height: 1.4em;
  max-height: 360px;
  margin: 10px 0 0;
  color: #e4e4e7;
  font: 0.6875rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
  overflow: auto;
}

.maintenance-task-link {
  color: #fef08a;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.maintenance-task-link:hover,
.maintenance-task-link:focus-visible {
  color: #ffffff;
}

.log-timezone-note {
  margin: -2px 0 8px;
  color: var(--text-muted);
  font-size: 0.74rem;
}
