/* R code/output APA-style boxes */
.code-section .r-block {
  background: #f8fafc !important;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.04);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px 12px 0px !important;
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-size: 1.08em;
  color: #334155;
  margin-bottom: 12px;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

.r-block {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px 12px 0px !important;
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-size: 1.08em;
  color: #334155;
  margin-bottom: 12px;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px; /* Roughly 20 lines */
  overflow-y: auto;
}

.r-label {
  font-weight: 600;
  font-size: 1.08em;
  margin-bottom: 8px;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.code-action-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #64748b;
  padding: 0;
}

.code-action-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
  transform: translateY(-1px);
}

.code-action-btn:active {
  transform: translateY(0);
}

.code-action-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Smaller font for APA table note */
.apa-note-small {
  font-size: 0.92em;
  color: #64748b;
  font-style: italic;
  margin-top: 2px;
  display: block;
}
.apa-table tbody tr.table-result td:first-child {
  color: #475569 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-weight: 500 !important;
  font-size: 0.875rem !important;
  letter-spacing: normal !important;
}

.apa-footnote {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #475569;
  font-style: italic;
}
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@600;700;800&display=swap');

:root {
  --font-size: 16px;
  --background: #F7F9FC;
  --foreground: #0F172A;
  --tsm-blue: #005EE9;
  --tsm-blue-hover: #0067FF;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  min-height: 100vh;
}

/* Header */
.header {
  background: #0051c9;
  color: white;
  padding: 1.5rem 2rem;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.back-button {
  background: transparent; /* match reference */
  border: none;
  color: #ffffff;
  padding: 8px 12px; /* 0.5rem 0.75rem */
  border-radius: 0.375rem; /* rounded-md */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px; /* gap-2 */
  cursor: pointer;
  font-size: 14px; /* 0.875rem */
  line-height: 20px; /* align to 36px total height with padding */
  margin-bottom: 1.5rem;
  transition: background-color 0.2s, opacity 0.2s;
  text-decoration: none;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.header-info {
  display: flex;
  gap: 1rem;
  align-items: flex-start; /* align icon holder top with top of the title */
  flex: 1;
  position: relative;
}

.header-icon {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.75rem;
  border-radius: 0.75rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-icon svg {
  display: block;
}

.header-text {
  flex: 1;
}

.header-text h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.header-text p {
  font-size: 1rem;
  opacity: 0.9;
  line-height: 1.6;
}

.header-version {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.header-version .version-separator {
  opacity: 0.5;
}

/* Main Content */
.main-content {
  /* Match reference: padding 48px vertical, 32px horizontal; margin 0 32px */
  padding: 48px 32px;
  margin: 0 32px;
}

/* Info Banner */
.info-banner {
  background: #F3F7FE;
  border: 1px solid #bae6fd;
  border-radius: 0.75rem;
  padding: 12px 16px; /* py-3 px-4 */
  display: flex;
  gap: 0.75rem;
  /* Fixed width per spec */
  width: 1216px;
  min-height: 90px; /* minimum height, allow expansion for content */
  /* Center within content area */
  margin: 32px auto 32px auto; /* 32px top, 32px bottom */
  /* Align items to the top so icon sits on same line as title */
  align-items: flex-start;
}

.info-icon {
  color: #005EE9;
  flex-shrink: 0;
  margin-top: 0.125rem; /* nudge to align with title baseline */
}

/* Enforce icon size */
.info-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Responsive: let the banner shrink on smaller screens */
@media (max-width: 1280px) {
  .info-banner {
    width: 100%;
    height: auto; /* allow wrap on smaller screens */
  }
}

.info-content {
  color: #64748b; /* match image: #64748B */
  font-size: 0.875rem; /* 14px */
}

.info-content strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #64748b;
  font-weight: 600; /* subtle emphasis per spec */
}

/* Paragraph text in the info banner matches title size and color */
.info-content p {
  color: #64748b;
  font-size: 0.875rem;
}

/* Tab Navigation */
.tab-navigation {
  display: flex;
  background: #e5e7eb; /* updated per spec */
  border-radius: 0.75rem;
  padding: 0.25rem;
  /* Match info banner width and center */
  width: 1216px;
  margin: 0 auto 2rem auto;
}

.tab-button {
  flex: 1;
  background: none;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s;
}

.tab-button.active {
  background: white;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-button:hover:not(.active) {
  color: #475569;
}

/* Disabled tab (e.g., ANOVA coming soon) */
.tab-button.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none; /* block interactions */
}

.soon-badge {
  margin-left: 0.5rem;
  padding: 0.125rem 0.375rem; /* small pill */
  background: #e5e7eb;
  color: #64748b;
  border-radius: 9999px;
  font-size: 0.625rem; /* 10px */
  font-weight: 700;
}

/* Content Wrapper */
.content-wrapper {
  display: grid;
  /* Use adjustable left width and let the right fill remaining space (accounts for grid gap) */
  grid-template-columns: minmax(0, var(--leftWidth, 35%)) minmax(0, 1fr);
  gap: 2rem;
  /* Avoid double horizontal padding; main-content provides it */
  padding: 0 0 2rem 0;
  /* Match info banner width and center */
  width: 1216px;
  margin: 0 auto;
}

/* Left Panel */
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.section {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.section-subtitle {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 1rem; /* 16px */
  line-height: 1.5rem; /* 24px */
  color: rgb(100, 116, 139);
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500; /* Inter 500 */
  margin-bottom: 0.5rem;
  font-size: 0.875rem; /* 14px */
  line-height: 1.25rem; /* 20px */
  color: #0F172A;
}

.info-button {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.125rem;
  border-radius: 0.25rem;
  transition: color 0.2s;
}

.info-button:hover {
  color: #475569;
}

.select-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: white;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Text input to match selects */
.text-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  background: #ffffff;
}

.text-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Custom select (for #testType) to match reference dropdown */
.custom-select { position: relative; }
.custom-select .native-select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 1rem; /* 16px */
  color: #0F172A;
  cursor: pointer;
}
.custom-select-trigger svg { color: #64748b; }

.custom-select-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.06);
  padding: 0.25rem;
  z-index: 20;
  display: none;
}
.custom-select.open .custom-select-list { display: block; }

.custom-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 1rem;
  color: #0F172A;
}
.custom-select-item:hover { background: #f3f4f6; }
.custom-select-item.selected {
  background: #005EE9; /* brand blue */
  color: #ffffff;
}
.custom-select-item .check {
  opacity: 0;
  margin-left: 0.75rem;
}
.custom-select-item.selected .check { opacity: 1; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* (Removed) Null hypothesis pill under Test Type */

/* Slider */
.slider-container {
  position: relative;
}

/* Stepper buttons for sliders */
.stepper-btn {
  width: 28px;
  height: 28px;
  border: 1.5px solid #cbd5e1;
  background: white;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.stepper-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
}

.stepper-btn:active {
  background: #e2e8f0;
  transform: scale(0.95);
}

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

.slider {
  width: 100%;
  height: 10px;
  border-radius: 9999px;
  /* base track and dynamic fill (updated via JS with --fill) */
  background: linear-gradient(#005EE9, #005EE9) 0/var(--fill, 0%) 100% no-repeat, #e5e7eb;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 1rem 0;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #005EE9;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  border: 2px solid #005EE9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Firefox track fill */
.slider::-moz-range-track {
  height: 10px;
  background: #e5e7eb;
  border-radius: 9999px;
}
.slider::-moz-range-progress {
  height: 10px;
  background: #005EE9;
  border-radius: 9999px;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.5rem;
}

.slider-value {
  background: #f97316;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 3.5rem;
  text-align: center;
}

/* Effect size slider row (shorter slider with value on the right) */
.effect-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem 0;
}

.effect-row .slider {
  flex: 1;
}

/* Nav-style segmented groups used for effect size, significance level, and test direction */
.segmented {
  display: flex;
  gap: 0.25rem;
  background: #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.25rem;
  margin-top: 0.5rem;
}

.segment {
  flex: 1;
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.segment:hover:not(.active) {
  color: #475569;
}

.segment.active {
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Effect size calculation toggle & panel */
.calc-toggle {
  margin-top: 0.75rem;
  background: none;
  border: none;
  color: #4f46e5;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}

.calc-toggle .label-compact { display: none; }

.calc-panel {
  margin-top: 0.75rem;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.calc-panel .field {
  flex: 1;
}

.calc-panel .form-row:last-child {
  margin-bottom: 0;
}

.calc-section[hidden] {
  display: none;
}

/* Design parameters header and compact spacing */
.design-params .params-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.design-params .params-header strong {
  font-size: 0.875rem;
  color: #0F172A;
}
.design-params .params-summary {
  flex: 1 1 auto;
  min-width: 200px;
  font-size: 0.8125rem;
  color: #64748b;
}
/* Subtle inline hint pill for params summary */
.summary-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 9999px;
  background: #f1f5f9; /* slate-100 */
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.summary-hint svg { width: 12px; height: 12px; color: #64748b; }
/* Show summary only when panel is collapsed */
.design-params[data-collapsed="false"] .params-summary { display: none; }
.design-params .params-toggle {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px; /* pill */
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.design-params .params-toggle svg { width: 12px; height: 12px; }
.design-params .params-toggle:hover {
  border-color: #cbd5e1;
  color: #334155;
  background: #f8fafc;
}
.design-params .params-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}
.design-params[data-collapsed="true"] .params-toggle {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}
.design-params[data-collapsed="true"] .params-toggle:hover {
  background: #eef2f7;
}
.design-params .params-toggle .chevron { transition: transform 0.2s; }
.design-params[data-collapsed="true"] .params-toggle .chevron { transform: rotate(180deg); }
.design-params[data-collapsed="true"] .params-body { display: none; }

/* Section header row for stratified/cluster/sc params */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0F172A;
  margin: 0;
}

.params-toggle-compact {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #64748b;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.params-toggle-compact:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.params-toggle-compact .chevron {
  transition: transform 0.2s;
}

.params-toggle-compact[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.design-section[data-collapsed="true"] .section-body {
  display: none;
}

/* Make design params more compact */
.design-params .form-row { margin-bottom: 0.5rem; }
.design-params .small-note { margin-top: 0.25rem; }

/* Advanced section toggles inside design params */
.design-params .section-toggle {
  background: none;
  border: none;
  color: #005EE9; /* brand */
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin: 0.25rem 0;
  padding: 0.125rem 0.25rem;
  border-radius: 0.375rem;
  transition: color 0.2s ease, background 0.2s ease;
}
.design-params .section-toggle:hover {
  color: #0067FF;
  background: rgba(0, 94, 233, 0.06);
}
.design-params .section-toggle .chevron { transition: transform 0.2s; }
.design-params .advanced-content[hidden] + .small-note,
.design-params .advanced-content[hidden] { display: none; }
.design-params .section-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

/* Population section toggle (match advanced options style) */
#populationSection .section-toggle {
  background: none;
  border: none;
  color: #005EE9;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin: 0.25rem 0;
  padding: 0.125rem 0.25rem;
  border-radius: 0.375rem;
  transition: color 0.2s ease, background 0.2s ease;
}
#populationSection .section-toggle:hover {
  color: #0067FF;
  background: rgba(0, 94, 233, 0.06);
}
#populationSection .section-toggle .chevron { transition: transform 0.2s; }
#populationSection .section-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.field label.small {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.small-note {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: -0.25rem;
}

.calc-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.calc-error {
  color: #b91c1c;
  font-size: 0.75rem;
}

.power-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.power-slider {
  flex: 1;
  margin: 0;
}

.power-value {
  background: #7c3aed;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 3rem;
  text-align: center;
}

.help-text {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.5rem;
}

/* Sampling Grid */
.sampling-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.sampling-option {
  position: relative;
  border: 2px solid #e2e8f0;
  border-radius: 1rem; /* smoother corners */
  padding: 0.75rem; /* slightly shorter cards */
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  /* Make content stack so the badge can sit at the bottom */
  display: flex;
  flex-direction: column;
}

.sampling-option.active {
  border-color: var(--tsm-blue);
  background: #F3F7FE; /* light blue wash */
}

.sampling-option:hover:not(.active) {
  border-color: #cbd5e1;
}

.sampling-option h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.125rem; /* tighter */
}

.sampling-option p {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.25rem; /* tighter */
}

/* (Removed) White DEFF/Null Hypothesis pill styles */

/* Top-right check icon, shown on active */
.option-check {
  position: absolute;
  top: 10px;
  right: 12px;
  display: none;
}
.sampling-option.active .option-check,
.extraction-option.active .option-check { display: inline-flex; }

/* Heading color accents per design */
.sampling-option[data-design="no-stratification"] h4,
.sampling-option[data-design="stratified"] h4 { color: var(--tsm-blue); }
.sampling-option[data-design="cluster"] h4 { color: #16a34a; }
.sampling-option[data-design="stratified-cluster"] h4 { color: #7c3aed; }

/* Extraction Grid */
.extraction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.extraction-option {
  position: relative;
  border: 2px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.extraction-option.active {
  border-color: var(--tsm-blue);
  background: #F3F7FE;
}

.extraction-option:hover:not(.active) {
  border-color: #cbd5e1;
}

.extraction-option h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.extraction-option p {
  font-size: 0.75rem;
  color: #64748b;
}

/* Right Panel */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.results-card,
.visualization-card,
.code-section {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.results-card {
  background: white;
  border: 2px solid #3b82f6;
  border-radius: 1rem;
  overflow: hidden;
}

.results-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eff6ff;
  padding: 1.5rem 1.5rem 0 1.5rem;
  margin: -1.5rem -1.5rem 0 -1.5rem;
}

.results-card h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2563eb;
  margin: 0; /* let container control spacing */
  background: transparent;
  padding: 0;
}

.results-subtitle {
  color: #64748b;
  font-size: 0.875rem;
  /* Eliminate white line between title and subtitle by avoiding top margin */
  margin-top: 0;
  margin-bottom: 2rem;
  background: #eff6ff;
  padding: 0 1.5rem 0.5rem 1.5rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
}

.clear-button {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}
.clear-button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.clear-button:active {
  transform: translateY(0);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* Match reference spacing between boxes: 16px */
  gap: 1rem;
  margin-bottom: 1.5rem;
  margin-top: 0;
}

.result-item {
  text-align: center;
  background: #F7F9FC; /* per reference */
  padding: 1rem 1rem 1rem 1rem; /* 16px all sides, no extra top */
  margin-bottom: 20px; /* Add 20px space between gauges */
  border-radius: 0.5rem; /* rounded-lg */
  border: 1px solid #E2E8F0; /* per reference */
}

.result-value {
  font-size: 2.25rem; /* 36px per reference */
  font-weight: 500;
  color: #005EE9; /* TSM blue */
  margin-bottom: 0.5rem; /* 8px */
  line-height: 1;
}

.result-value.power {
  color: #7c3aed;
}

.result-value.effect {
  color: #f97316;
}

.result-label {
  font-size: 0.875rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

/* Interpretation */
.interpretation { margin-bottom: 1.5rem; }

.interpretation-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #0F172A;
}

.interpretation .chevron {
  margin-left: auto;
  transition: transform 0.2s;
}

.interpretation.open .chevron { transform: rotate(0deg); }
.interpretation:not(.open) .chevron { transform: rotate(180deg); }

.interpretation-content {
  margin-top: 0.75rem;
}

.interpretation-content p {
  margin: 0 0 0.75rem 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem; /* 14px */
  line-height: 1.25rem; /* 20px */
  font-weight: 400;
  color: rgb(100, 116, 139);
}

.interpretation-content p strong {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem; /* 14px */
  line-height: 1.25rem; /* 20px */
  font-weight: 700; /* title emphasis */
  color: rgb(100, 116, 139);
}

/* Chart Section */
.chart-section {
  margin-top: 10pt;
}

.chart-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0; /* inline with legend */
}

.chart-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem; /* give gauges breathing room below controls */
  flex-wrap: wrap;
}

.curve-style-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.curve-control-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.theme-swatch {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
  background: #0067FF; /* default TSM blue; JS updates live */
}

.curve-control-select {
  padding: 0.375rem 0.625rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  background: #ffffff;
  cursor: pointer;
  color: #475569; /* subtle slate */
  font-weight: 500;
  min-width: 128px; /* keep width stable */
}

.curve-control-select:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.curve-control-select:hover {
  border-color: #cbd5e1;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 0; /* sits in header row */
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

/* Typography for legend labels in Power Analysis Curve */
.chart-legend .legend-item span {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 0.75rem; /* 12px */
  line-height: 1rem;  /* 16px */
  color: rgb(100, 116, 139);
  display: inline-block;
  vertical-align: middle;
}

.chart-legend .legend-item span sup {
  vertical-align: baseline;
  position: relative;
  top: -0.4em;
  font-size: 0.65em;
}

.legend-color {
  width: 12px;
  height: 3px;
  border-radius: 1.5px;
}

.legend-color.statistical {
  background: #a5b4fc;
}

.legend-color.target {
  background: #c7d2fe;
  border: 1px solid #c7d2fe;
}

.chart-container {
  background: white;
  border: 2px solid #cbd5e1; /* 2px gray border around plot, labels, and modebar */
  border-radius: 0;
  padding: 0; /* remove top padding so modebar aligns with header row */
  margin-bottom: 1rem;
  width: 100%;
  overflow: visible;
  position: relative;
  z-index: 3; /* ensure chart stays in front visually */
  min-height: 500px; /* allow expansion beyond minimum */
}

.chart-container #powerChart {
  display: block;
  width: 100%;
  min-height: 480px; /* minimum height, allows growth */
  height: auto; /* allow content to determine height */
}

.chart-container .main-svg {
  margin-top: 10pt;
}

/* Design Info */
.design-info {
  background: #F7F9FC; /* soft panel background */
  border: 1px solid #E2E8F0; /* subtle border */
  border-radius: 0.5rem; /* rounded-lg */
  padding: 0.75rem; /* p-3 => 12px */
}

.design-info p {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem; /* 16px */
  line-height: 1.5rem;  /* 24px */
  color: rgb(100, 116, 139); /* #64748B */
  margin-bottom: 0.5rem;
}

.design-info p strong {
  font-weight: 700;
  color: #0F172A; /* emphasize label */
}

.warning {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #92400e;
}

/* Override warning style within the Design Info panel to match screenshot */
.design-info .warning {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.875rem; /* 14px - slightly smaller */
  line-height: 1.5rem;  /* 24px */
  color: #EF4444; /* red emphasis per spec */
  margin-top: 1rem; /* Add line break between interpretation and warning */
  display: flex;
  align-items: flex-start; /* Align icon with first line of text */
  gap: 0.5rem;
}

.design-info .warning .warning-icon {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0; /* Prevent icon from shrinking */
  margin-top: 0;
}

/* Default warning triangle color */
.warning-triangle {
  fill: #F59E0B;
}

/* Risk level styling - HIGH RISK */
#cr-warning-panel.risk-high,
#cr-warning-panel.risk-high #cr-warning-text {
  color: #EF4444 !important; /* Red for high risk */
}

#cr-warning-panel.risk-high .warning-triangle {
  fill: #EF4444 !important;
}

/* Risk level styling - MEDIUM RISK */
#cr-warning-panel.risk-medium,
#cr-warning-panel.risk-medium #cr-warning-text {
  color: #F97316 !important; /* Orange for medium risk */
}

#cr-warning-panel.risk-medium .warning-triangle {
  fill: #F97316 !important;
}

/* Risk level styling - LOW RISK */
#cr-warning-panel.risk-low,
#cr-warning-panel.risk-low #cr-warning-text {
  color: #16A34A !important; /* Green for low risk */
}

#cr-warning-panel.risk-low .warning-triangle {
  fill: #16A34A !important;
}

/* Make exclamation mark white */
.warning-icon svg path[stroke],
.warning-icon svg circle {
  stroke: #ffffff !important;
  fill: #ffffff !important;
}

.risk-label {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

/* Visualization Card */
.visualization-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.visualization-subtitle {
  color: #64748b;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.population-info {
  display: flex;
  justify-content: flex-start; /* left align like reference */
  align-items: center;
  gap: 0.75rem; /* spacing between pills */
  margin-top: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* Pills for population and sample counts */
.population-badge,
.sample-badge,
.systematic-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px; /* px-2 py-0.5 */
  border-radius: 9999px; /* pill */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.75rem; /* 12px */
  line-height: 1rem;  /* 16px */
  font-weight: 500; /* medium */
}

.population-badge {
  background: #ffffff;
  color: #0F172A;
  border: 1px solid #E2E8F0;
}

.sample-badge {
  background: var(--tsm-blue);
  color: #ffffff;
  border: 1px solid var(--tsm-blue);
}

.systematic-badge {
  background: #F59E0B;
  color: #ffffff;
  border: 1px solid #F59E0B;
}

.visualization-container {
  background: #F7F9FC; /* match reference panel */
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem; /* rounded-lg */
  padding: 1.5rem; /* 24px */
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden; /* ensure mounted grid cannot overflow */
}

/* Mount point for 20×40 inline grid inside the top card */
.pop-grid2-host {
  width: 100%;
}

/* Make sampling canvas responsive with fixed visual height */
.visualization-container canvas#samplingVisualization {
  display: block;
  width: 100%;
  height: 156px; /* as per sizing overlay */
}

/* APA-style table for sample size report */
.visualization-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.visualization-header h3 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #0F172A;
  margin: 0;
}

.download-buttons {
  display: flex;
  gap: 0.5rem;
}

.download-buttons button {
  background: white;
  border: 1px solid #cbd5e1;
  color: #64748b;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.download-buttons button:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #475569;
}

.download-buttons button:active {
  background: #e2e8f0;
}

/* Download dropdown (PNG/PDF) */
.download-dropdown { position: relative; }
.download-dropdown .dropdown-toggle { display: inline-flex; align-items: center; gap: 6px; }
.download-dropdown .dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.06);
  padding: 0.25rem;
  z-index: 10;
  min-width: 140px;
}
.download-dropdown .dropdown-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: #0F172A;
  cursor: pointer;
}
.download-dropdown .dropdown-item:hover { background: #f3f4f6; }

.apa-table-container {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.apa-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Column width tuning for Table 1: widen Parameter/Value, narrow Description */
.apa-table col.col-param { width: 32%; }
.apa-table col.col-value { width: 26%; }
.apa-table col.col-desc  { width: 42%; }

/* Keep first two columns on a single line to avoid double lines */
.apa-table thead th:nth-child(1),
.apa-table thead th:nth-child(2),
.apa-table tbody td:nth-child(1),
.apa-table tbody td:nth-child(2) {
  white-space: nowrap;
}

/* Allow description to wrap naturally */
.apa-table thead th:nth-child(3),
.apa-table tbody td:nth-child(3) {
  white-space: normal;
}

.apa-table caption {
  text-align: left;
  font-style: italic;
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 0.5rem;
  padding-left: 0;
}

.apa-table th,
.apa-table td {
  text-align: left;
  padding: 0.5rem 1rem;
  border: none;
}

.apa-table thead th {
  border-top: 2px solid #0F172A;
  border-bottom: 1px solid #0F172A;
  font-weight: 600;
  color: #0F172A;
}

.apa-table tbody tr:last-child td {
  border-bottom: 2px solid #0F172A;
}

.apa-table tbody tr.divider-above td {
  border-bottom: 2px solid #0F172A !important;
  padding-bottom: 1rem !important;
}

.apa-table tbody tr.table-divider {
  display: none;
}

.apa-table tbody td:first-child {
  font-weight: 500;
  color: #475569;
}

.apa-table tbody td:last-child {
  color: #0F172A;
}

/* Ensure the Required Sample Size value uses the same Inter font and a loaded weight */
.apa-table tbody td strong {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
  color: #0F172A;
}
.apa-table tbody tr.table-result td:first-child {
  color: #475569 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-weight: 500 !important;
  font-size: 0.875rem !important;
  letter-spacing: normal !important;
  font-variant-numeric: normal !important;
}

/* Conditional row display */
.apa-table tr[data-condition="hidden"] {
  display: none;
}

.visualization-legend {
  display: flex;
  gap: 1.5rem;
}

.visualization-legend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.population {
  background: #e2e8f0; /* lighter per reference */
}

.legend-dot.selected {
  background: var(--tsm-blue); /* #005EE9 */
  /* Remove glow for sharper look */
  box-shadow: none;
}

/* Legend label typography for sampling visualization */
.visualization-legend .legend-item span {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 0.75rem; /* 12px */
  line-height: 1rem; /* 16px */
  color: #64748b;
}

/* Initial placeholder overlay for clarity */
.viz-placeholder {
  position: absolute;
  inset: 0.75rem; /* respect container padding visually */
  background: linear-gradient(0deg, rgba(255,255,255,0.9), rgba(255,255,255,0.9));
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  gap: 0.5rem;
}
.viz-placeholder p {
  font-size: 0.875rem;
  color: #475569;
}

/* Temporary visualization options bar */
.viz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}
.viz-options .viz-options-label {
  font-size: 0.75rem;
  color: #64748b;
}
.viz-options .opt {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: #475569;
}
.viz-options #vizViewMode { flex: 1 1 auto; }

/* Visualization interpretation */
  position: relative;
  top: -5px; /* Raise title by 5px */
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.viz-interpretation .viz-options-label {
  font-size: 0.75rem;
  color: #64748b;
}
.viz-interpretation .select-input {
  width: auto;
  min-width: 200px;
}
.viz-interpretation .small-note {
  flex-basis: 100%;
}

/* Visualization Notes Section */
.viz-notes-section {
  margin-top: 0.75rem;
  border-top: 1px solid #E2E8F0;
  padding-top: 0.75rem;
}
.viz-notes-section .viz-notes-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 0.5rem;
}
.viz-notes-section .viz-notes-list {
  margin: 0;
  padding-left: 1.5rem;
  color: #64748b;
  font-size: 0.8125rem;
  line-height: 1.6;
}
.viz-notes-section .viz-notes-list li {
  margin: 0.375rem 0;
}

/* Sample Notes block (legacy, kept for backward compatibility) */
.viz-notes {
  margin-top: 0.75rem;
  border-top: 1px solid #E2E8F0;
  padding-top: 0.75rem;
}
.viz-notes-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 0.25rem;
}
.viz-notes-list {
  margin: 0;
  padding-left: 1.25rem;
  color: #64748b;
  font-size: 0.8125rem;
}
.viz-notes-list li { margin: 0.125rem 0; }

/* Tree diagram */
.tree-section { margin-top: 1rem; }
.tree-section h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.tree-container {
  background: #ffffff;
  border: 1px dashed #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.75rem;
}
.tree-controls .segmented { max-width: 240px; }
.tree { list-style: none; margin: 0; padding-left: 0; }
.tree ul { list-style: none; margin: 0.25rem 0; padding-left: 1rem; position: relative; }
.tree ul::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0;
  bottom: 0;
  border-left: 1px solid #cbd5e1;
}
.tree .node { position: relative; padding-left: 1rem; margin: 0.25rem 0; }
.tree .node::before {
  content: "";
  position: absolute;
  left: 0.35rem; top: 0.9rem;
  width: 0.6rem;
  border-top: 1px solid #cbd5e1;
}
.tree .label { font-size: 0.875rem; color: #0F172A; }
.tree .meta { font-size: 0.75rem; color: #64748b; margin-left: 0.375rem; }
.tag { display: inline-block; font-size: 0.7rem; padding: 0.05rem 0.35rem; border-radius: 0.25rem; margin-left: 0.375rem; }
.tag.sample { background: #005EE9; color: #fff; }
.tag.pop { background: #e2e8f0; color: #334155; }

/* SVG tree container */
.tree-svg-container { padding: 0; overflow: hidden; border-radius: 0.5rem; }
.tree-svg-container svg { display: block; width: 100%; height: auto; }
.tree-svg text { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; fill: #0F172A; font-size: 12px; }
.tree-svg .method-title { font-size: 16px; font-weight: 600; fill: #1e293b; }
.tree-svg .small { fill: #64748b; font-size: 11px; }
/* Default node styles apply only when not explicitly colored via data attribute */
.tree-svg .node:not([data-colored="true"]) { fill: #ffffff; stroke: #cbd5e1; stroke-width: 1; }
.tree-svg .node-header:not([data-colored="true"]) { fill: #f8fafc; }
.tree-svg .link { stroke: #cbd5e1; stroke-width: 1.25; fill: none; }
.tree-svg .bubble:not([data-colored="true"]) { fill: #F3F7FE; stroke: #93c5fd; }
.tree-svg .bubble.selected { fill: #e0f2fe; stroke: #3b82f6; }

/* Contain tree within dashed container */
.tree-container { overflow: hidden; }

/* Code Section */
.code-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.code-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.code-section > p {
  color: #64748b;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.code-tabs {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

/* Make the R/Python segmented toggle stretch wider */
.code-tabs .segmented {
  flex: 1;
}

/* layout-tuner removed */

.code-tab {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4f46e5;
  cursor: pointer;
  padding: 0.5rem 0;
  border-bottom: 2px solid #4f46e5;
}

.learn-badge {
  background: #10b981;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.code-description {
  color: #64748b;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.code-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.code-toggle {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
}

.code-actions {
  display: flex;
  gap: 0.5rem;
}

.code-action {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.code-action:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* Code block display */
.code-block {
  background: #0b1020;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-x: auto;
  border: 1px solid #111827;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  margin-bottom: 1.25rem;
}

/* R Info */
.r-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.r-info-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #0c4a6e;
}

.r-info-list {
  list-style: none;
  font-size: 0.875rem;
  color: #0c4a6e;
}

.r-info-list li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.25rem;
}

.r-info-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #0284c7;
}

.r-info-list code {
  background: rgba(14, 165, 233, 0.1);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.75rem;
}

.learn-more {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #475569;
}

.learn-more > :first-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.learn-link {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 500;
  margin-left: auto;
}

.learn-link:hover {
  text-decoration: underline;
}

/* Info Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  animation: fadeIn 0.2s ease-in-out;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-container {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

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

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #E2E8F0;
  background: #F7F9FC;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1E293B;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: #64748B;
  transition: all 0.2s;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #E2E8F0;
  color: #1E293B;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.modal-body p {
  margin: 0;
  line-height: 1.6;
  color: #475569;
  font-size: 0.9375rem;
}

/* Footer */
.app-footer {
  background: #F7F9FC;
  border-top: 1px solid #E2E8F0;
  padding: 1.5rem 2rem;
  margin-top: 3rem;
}

.footer-content {
  max-width: 1216px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.875rem;
  color: #64748b;
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-brand {
  font-weight: 600;
  color: #0F172A;
}

.footer-version {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.8125rem;
  color: #005EE9;
  font-weight: 600;
}

.footer-build {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.8125rem;
  color: #64748b;
}

.footer-separator {
  color: #cbd5e1;
}

.footer-link {
  color: #64748b;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #005EE9;
}

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    max-width: 768px;
  }

  .header {
    padding: 1rem;
  }

  .header-info {
    flex-direction: column;
    gap: 0.75rem;
  }

  .main-content {
    padding: 1rem;
    margin: 0; /* remove side margins on small screens */
  }

  .content-wrapper {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .results-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .sampling-grid,
  .extraction-grid {
    grid-template-columns: 1fr;
  }

  .form-row { grid-template-columns: 1fr; }

  .tab-navigation {
    width: 100%;
    flex-direction: column;
  }

  .tab-button {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .header-text h1 {
    font-size: 1.5rem;
  }

  .result-value {
    font-size: 2rem;
  }

  .chart-legend,
  .visualization-legend {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* On very small screens, switch to compact math-notation title */
  .calc-toggle .label-full { display: none; }
  .calc-toggle .label-compact { display: inline; }
}

/* Keep constrained widths responsive on smaller desktops */
@media (max-width: 1280px) {
  .tab-navigation,
  .content-wrapper {
    width: 100%;
  }
}

/* ---- Interactive Visualizer Styles (TSM Theme) ---- */
.visualizer-section {
  margin: 40px 32px; /* align with main-content margins */
  background: var(--tsm-bg, #F7F9FC);
  border: 1px solid var(--tsm-border, #E5EAF2);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 0 8px rgba(0,0,0,0.02);
}

.visualizer-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.visualizer-header h2 {
  font-family: Poppins, Inter, sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--tsm-text, #0F172A);
  margin: 0;
}

.visualizer-desc {
  color: #475569;
  font-size: 15px;
  line-height: 1.5;
  max-width: 640px;
}

/* Inline Visualizer Container */
.inline-viz-container {
  margin-top: 20px;
}

.inline-panel {
  background: var(--tsm-panel, #F7F9FC);
  border: 1px solid var(--tsm-border, #E5EAF2);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 18px;
}

.inline-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.inline-btn {
  background: #fff;
  border: 1.5px solid var(--tsm-border, #E5EAF2);
  color: var(--tsm-text, #0F172A);
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: .15s;
  font-size: 0.875rem;
}

.inline-btn:hover {
  transform: translateY(-1px);
  background: #fafbfc;
}

.inline-btn.active {
  background: var(--tsm-blue, #0067FF);
  color: #fff;
  border-color: var(--tsm-blue, #0067FF);
}

.inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.inline-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.inline-control label {
  font-size: 12px;
  color: #334155;
  font-weight: 600;
}

.inline-control input[type="number"],
.inline-control input[type="text"],
.inline-control select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--tsm-border, #E5EAF2);
  border-radius: 10px;
  background: #fff;
  font-size: 0.875rem;
}

.inline-tog {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--tsm-border, #E5EAF2);
  background: #fff;
  border-radius: 12px;
  font-size: 13px;
}

.inline-download {
  margin-left: auto;
}

/* Layout */
.inline-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
}

@media (max-width: 1000px) {
  .inline-layout {
    grid-template-columns: 1fr;
  }
}

.inline-stage {
  background: #fff;
  border: 1px solid var(--tsm-border, #E5EAF2);
  border-radius: 18px;
  padding: 16px;
  position: relative;
  width: 100%;
}

/* When mounted into the top card, strip frame so it blends in */
.inline-stage.mounted-top {
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
}

.inline-grid {
  --cols: 40;
  --gap: 6px;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr); /* stretch to container width */
  gap: var(--gap);
  justify-content: stretch;
  width: 100%;
  max-width: none;
  margin-inline: auto;
  position: relative;
}

.inline-grid .cell {
  width: 100%;
  aspect-ratio: 1 / 1; /* keep squares while filling width */
  border-radius: 6px;
  background: #E6ECF5;
  transition: background .12s, box-shadow .12s, transform .06s;
}

.inline-grid .cell.sampled {
  background: var(--tsm-blue, #0067FF);
  box-shadow: 0 0 0 3px rgba(0, 103, 255, .18) inset;
}

.inline-grid .cell.flash {
  animation: flash .6s ease;
}

@keyframes flash {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 103, 255, 0);
    transform: scale(1);
  }
  40% {
    box-shadow: 0 0 0 6px rgba(0, 103, 255, .15);
    transform: scale(1.15);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 103, 255, 0);
    transform: scale(1);
  }
}

/* Strata background bands (rows) */
.inline-grid .stratum-0 { background: #E7F0FF; }
.inline-grid .stratum-1 { background: #EAFBF3; }
.inline-grid .stratum-2 { background: #FFF6E5; }
.inline-grid .stratum-3 { background: #FDECF0; }

/* Cluster visuals (applied per-cell) */
.inline-grid .cluster-outline { position: relative; }
/* Hide dashed outline rings entirely */
.inline-grid .cluster-outline::after { display: none; }

.inline-grid .cluster-selected .cell {
  background: var(--tsm-accent, #3399FF);
}

.inline-grid .cluster-selected::after {
  border-color: var(--tsm-blue, #0067FF);
}

/* Guideline overlay */
.inline-guides {
  position: absolute;
  inset: 16px;
  pointer-events: none;
}

/* Pills overlay for inline stage (e.g., systematic sampling info) */
.inline-pills {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 18px; /* Increased gap by 10px */
  z-index: 2;
}
.inline-pill {
  background: #fff;
  color: #334155;
  border: 1px solid var(--tsm-border, #E5EAF2);
  border-radius: 9999px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.inline-guides .guide-line {
  position: absolute;
  background: linear-gradient(90deg, rgba(0, 103, 255, .2), rgba(0, 103, 255, .0));
  height: 2px;
}

.inline-guides .guide-label {
  position: absolute;
  background: #fff;
  color: #0f172a;
  border: 1px solid var(--tsm-border, #E5EAF2);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 11px;
}

.inline-info {
  background: #fff;
  border: 1px solid var(--tsm-border, #E5EAF2);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: fit-content;
}

.inline-stat {
  font-size: 13px;
  color: #334155;
}

.inline-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-legend .chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--tsm-border, #E5EAF2);
  border-radius: 12px;
  background: #fff;
  font-size: 12px;
}

.inline-legend .sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #E6ECF5;
  border: 1px solid #dfe6f2;
}

.inline-caption {
  font-size: 14px;
  color: #334155;
  line-height: 1.5;
}

.inline-strong {
  font-weight: 700;
}

.inline-hr {
  height: 1px;
  background: var(--tsm-border, #E5EAF2);
  margin: 4px 0 12px;
}

@media (max-width: 768px) {
  .visualizer-section {
    padding: 16px;
    margin: 24px 16px;
  }
  .visualizer-header h2 {
    font-size: 18px;
  }
  .visualizer-desc {
    font-size: 14px;
  }
}

/* Input Method Selector */
.input-method-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.input-method-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #64748b;
  font-weight: 500;
  font-size: 0.875rem;
  min-height: 108px;
}

.input-method-button svg {
  width: 28px;
  height: 28px;
  color: #64748b;
  transition: color 0.2s ease;
}

.input-method-button:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

.input-method-button:hover svg {
  color: #475569;
}

.input-method-button.active {
  border-color: #0051c9;
  background: #f0f7ff;
  color: #0051c9;
  box-shadow: 0 2px 8px rgba(0, 81, 201, 0.15);
}

.input-method-button.active svg {
  color: #0051c9;
}

/* Section Divider */
.section-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 1.5rem 0;
}

/* Factor Loadings Subsection */
.factor-loadings-section {
  margin-top: 1.5rem;
}

.table-wrapper {
  position: relative;
  margin-bottom: 0.5rem;
  max-width: 100%;
}

.reset-icon-btn-table {
  position: absolute;
  right: 3px;
  top: -5px;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: #0051c9;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  z-index: 10;
}

.reset-header-btn {
  background: #f0f7ff;
  border: 1px solid #cbd5e1;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  color: #0051c9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: all 0.2s ease;
}

.reset-header-btn:hover {
  background: #e0ebff;
  border-color: #0051c9;
}

.reset-icon-btn-table:hover {
  background-color: rgba(0, 81, 201, 0.1);
  color: #0040a0;
}

.reset-icon-btn-table:active {
  transform: scale(0.95);
}

.loadings-form {
  margin: 0;
  padding: 0;
}

.factor-loadings-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #0f172a;
}

/* Loadings Table */
.loadings-table {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #475569;
  font-size: 0.8125rem;
  background: transparent;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0 0.25rem;
  table-layout: auto;
}

.loadings-table thead th {
  padding: 0.4rem 0.25rem;
  text-shadow: none;
  background: transparent;
  font-size: 0.75rem;
  text-align: center;
  vertical-align: middle;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  border-top: none;
  height: auto;
  line-height: 1.4;
}

.loadings-table thead th sup {
  vertical-align: baseline;
  position: relative;
  top: -0.65em;
  left: 0.125em;
  font-size: 0.6em;
}

.loadings-table thead tr {
  border-bottom: none;
}

.loadings-table th.column-item {
  width: 15%;
  min-width: 50px;
}

.loadings-table th.column-loading {
  width: 25%;
  min-width: 80px;
}

.loadings-table th.column-error {
  width: 20%;
  min-width: 60px;
}

.loadings-table th.column-rsquare {
  width: 20%;
  min-width: 60px;
}

.loadings-table th.column-se-loading {
  width: 18%;
  min-width: 70px;
}

.loadings-table th.column-ci-low {
  width: 18%;
  min-width: 70px;
}

.loadings-table th.column-ci-high {
  width: 18%;
  min-width: 70px;
}

.loadings-table .ci-column {
  display: none;
}

.loadings-table .ci-column.visible {
  display: table-cell !important;
}

.loadings-table input.loading-se-input,
.loadings-table input.loading-ci-low-input,
.loadings-table input.loading-ci-high-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}

.loadings-table th.column-action-merged {
  width: 20%;
  min-width: 60px;
}

.loadings-table tbody tr.loading-row {
  height: auto;
  border-top: none;
  border-bottom: none;
  background: transparent;
  transition: background-color 0.15s ease;
  vertical-align: bottom;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.loadings-table tbody tr.loading-row td {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.loadings-table tbody tr.loading-row:hover {
  background: #f8fafc;
}

.loadings-table td.item-column {
  width: 15%;
  min-width: 50px;
  text-align: center;
  padding-left: 0;
  white-space: nowrap;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  vertical-align: bottom;
}

.loadings-table td.error-column {
  width: 20%;
  min-width: 60px;
  vertical-align: middle;
}

.loadings-table td.rsquare-column {
  width: 20%;
  min-width: 60px;
  vertical-align: middle;
}

.loadings-table tbody tr.loading-row td {
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.loadings-table td.action-column,
.loadings-table td.action-column-add {
  width: 10%;
  min-width: 30px;
  padding: 0.2rem 0.25rem;
  vertical-align: middle;
}

.loadings-table td.action-column-delete,
.loadings-table td.extra-column {
  width: 10%;
  min-width: 30px;
  padding: 0.2rem 0.25rem;
  vertical-align: middle;
}

.loadings-table input.loading-input {
  width: 100%;
  padding: 0.25rem 0.375rem;
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  text-align: center;
  font-size: 12.8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #ffffff;
  color: #334155;
  line-height: 1.4;
  vertical-align: middle;
  box-sizing: border-box;
}

.loadings-table input.loading-input::placeholder {
  font-size: 0.75rem;
  color: #94a3b8;
}

.loadings-table input.loading-input:focus {
  outline: none;
  border-color: #0051c9;
  box-shadow: 0 0 0 2px rgba(0, 81, 201, 0.1);
}

/* Calculated output spans */
.loadings-table span.item-output,
.loadings-table span.error-output,
.loadings-table span.rsquare-output {
  display: block;
  text-align: center;
  font-size: 12.8px;
  color: #475569;
  padding: 0.25rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-width: auto;
}

/* Drag handle */
.loadings-table .drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  cursor: move;
  color: #9ca3af;
  font-size: 1.1rem;
  font-weight: bold;
  user-select: none;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.loadings-table tbody tr:hover .drag-handle {
  color: #0051c9;
  background: rgba(0, 81, 201, 0.08);
}

.loadings-table .item-number {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.4;
}

.loadings-table tbody tr.loading-row.dragging {
  opacity: 0.6;
}

.loadings-table tbody tr.loading-row.drag-over {
  outline: 1px dashed #cbd5e1;
}

.loadings-table .action-column-add,
.loadings-table .action-column-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
}

.loadings-table .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0 2px;
  border: none;
  border-radius: 3px;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
}

.loadings-table .icon-btn svg {
  width: 12px;
  height: 12px;
  display: block;
  margin: 0;
  padding: 0;
}

.loadings-table .icon-btn:hover {
  opacity: 1;
  transform: scale(1.08);
}

.loadings-table .icon-btn:active {
  transform: scale(0.92) translateY(1px);
}

.loadings-table .add-row-btn {
  background: #d1fae5;
  border-color: #a7f3d0;
  color: #059669;
}

.loadings-table .add-row-btn:hover {
  background: #a7f3d0;
  border-color: #6ee7b7;
  color: #047857;
}

.loadings-table .delete-row-btn {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

.loadings-table .delete-row-btn:hover {
  background: #fecaca;
  border-color: #fca5a5;
  color: #b91c1c;
}

.loadings-table tfoot tr {
  border-top: none;
  border-bottom: none;
}

.loadings-table tfoot tr:first-child td {
  padding-top: 0.8rem;
  border-top: 1px solid #e2e8f0;
}

.loadings-table tfoot tr td {
  padding: 0.375rem 0.25rem;
  border-top: none;
  border-bottom: none;
  vertical-align: middle;
}

.loadings-table .cr-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  text-align: center;
  white-space: nowrap;
  border-top: none;
  border-bottom: none;
}

.cr-output {
  display: block;
  font-size: 12.8px;
  color: #475569;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-width: auto;
  text-align: center;
}

.loadings-table tbody tr.drag-over {
  opacity: 0.6;
  background: #f0f7ff;
}

.loadings-table tbody tr.table-spacer {
  height: 36px;
  border: none;
  background: transparent;
}

.loadings-table .btn-add-item {
  background: #27ae60;
  color: #ffffff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 28px;
}

.loadings-table .btn-add-item:hover {
  background: #1e8449;
}

.loadings-table .btn-add-item:active {
  transform: translateY(1px);
}

.loadings-table .btn-remove-item {
  background: #e74c3c;
  color: #ffffff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 24px;
  width: 50px;
}

.loadings-table .btn-remove-item:hover {
  background: #c0392b;
}

.loadings-table .btn-remove-item:active {
  transform: translateY(1px);
}

.loadings-table td.cr-label {
  text-align: right;
  font-weight: 600;
  color: #475569;
  padding: 0.5rem 0.25rem;
  font-size: 0.8rem;
}

.loadings-table input.cr-total {
  width: 80%;
  padding: 0.375rem 0.375rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: #ffffff;
  color: #0f172a;
  cursor: default;
}

.loadings-table .btn-reset-form {
  background: #424242;
  color: #ffffff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 28px;
}

.loadings-table .btn-reset-form:hover {
  background: #5b5b5b;
  color: #ff3d3d;
}

.loadings-table .btn-reset-form:active {
  transform: translateY(1px);
}

