/* ==========================================================================
   ColorLab - Hoja de estilos del mezclador de colores y paleta interactiva
   Fijate Tools • fijate.com
   ========================================================================== */

:root {
  /* Paleta base de la aplicación (Tema Oscuro por defecto) */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1f242d;
  --bg-card-hover: #262c37;
  --bg-input: #12161c;
  --border-subtle: #2d333b;
  --border-focus: #388bfd;
  
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #a3acb6; /* Contraste accesible sobre fondos oscuros */
  
  --accent-primary: #1f6feb;
  --accent-primary-hover: #388bfd;
  --accent-success: #238636;
  --accent-danger: #da3633;
  --accent-danger-hover: #f85149;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Tema Claro */
[data-theme="light"] {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f4f6;
  --bg-input: #f6f8fa;
  --border-subtle: #d0d7de;
  --border-focus: #0969da;
  
  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #656d76; /* Contraste legible sobre fondo blanco */
  
  --accent-primary: #0969da;
  --accent-primary-hover: #218bff;
  --accent-success: #1a7f37;
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12);
}

/* Base y contención */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1rem;
  width: 100%;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tarjetas y secciones */
.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.section-heading {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.section-subheading {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Botones principales */
.btn-action-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 42px;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-action-primary:hover {
  background-color: var(--accent-primary-hover);
}

.btn-action-primary:active {
  transform: scale(0.98);
}

.btn-tool-subtle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.2s ease;
}

.btn-tool-subtle:hover {
  border-color: var(--border-focus);
  background-color: var(--bg-card-hover);
}

.btn-tool-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-tool-header:hover {
  border-color: var(--border-focus);
}

.btn-icon-square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-square:hover {
  border-color: var(--border-focus);
  color: var(--accent-primary-hover);
}

/* ==========================================================================
   SECCIÓN 1: PALETA AL ÓLEO INTERACTIVA
   ========================================================================== */

.palette-studio-card {
  overflow: hidden;
}

.palette-toolbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-group-actions {
  margin-left: auto;
}

.group-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-group-toggle {
  display: flex;
  background-color: var(--bg-primary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.btn-canvas-tool,
.btn-knife-size {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 34px;
  transition: all 0.15s ease;
}

.btn-canvas-tool.active,
.btn-knife-size.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.select-surface-input {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  min-height: 36px;
  cursor: pointer;
  max-width: 210px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-custom-color-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: var(--bg-secondary);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  height: 40px;
}

.btn-custom-color-picker input[type="color"] {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: none;
}

/* Lienzo de paleta */
.palette-canvas-wrapper {
  position: relative;
  width: 100%;
  background-color: #0b0e14;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
  touch-action: none;
}

#palette-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 600;
}

.palette-footer-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Toast de muestreo */
.sample-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background-color: rgba(22, 27, 34, 0.95);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.sample-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   SECCIÓN 2: DOSIFICADOR DE RECETAS POR PARTES
   ========================================================================== */

.recipe-mixer-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.recipe-mixer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.recipe-title {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.recipe-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

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

/* Tubos de la receta */
.tubes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tube-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  transition: border-color 0.2s ease;
}

.tube-item:hover {
  border-color: var(--border-focus);
}

.tube-color-indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.tube-info {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tube-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.tube-pigment-select {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  font-size: 0.88rem;
  font-weight: 600;
  width: 100%;
  max-width: 320px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.tube-percent {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.tube-slider-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-step-part {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}

.btn-step-part:hover {
  border-color: var(--border-focus);
}

.tube-range-slider {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.tube-parts-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 68px;
}

.tube-parts-val small {
  color: var(--text-muted);
  font-weight: 400;
}

.btn-remove-tube {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.btn-remove-tube:hover {
  color: var(--accent-danger-hover);
  background-color: rgba(218, 54, 51, 0.12);
}

/* Comparativa científica cara a cara */
.comparison-section {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.comparison-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.comparison-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
}

.badge-high-diff {
  background-color: rgba(218, 54, 51, 0.18);
  color: #ff7b72;
  border: 1px solid rgba(218, 54, 51, 0.4);
}

.badge-medium-diff {
  background-color: rgba(210, 153, 34, 0.18);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.4);
}

.badge-low-diff {
  background-color: rgba(35, 134, 54, 0.18);
  color: #3fb950;
  border: 1px solid rgba(35, 134, 54, 0.4);
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.comparison-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}

.comparison-card.active {
  border-color: #3fb950;
  box-shadow: 0 0 0 1px #3fb950;
}

.model-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.color-preview-block {
  width: 100%;
  height: 64px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.25);
}

.model-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.model-name {
  font-size: 0.88rem;
  font-weight: 700;
}

.model-hex {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.model-artistic,
.model-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Rampa tonal */
.tonal-ramp-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ramp-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ramp-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.ramp-tabs {
  display: flex;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
}

.btn-ramp-tab {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 32px;
}

.btn-ramp-tab.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
}

.ramp-swatches-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}

.ramp-swatch {
  height: 54px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: flex-end;
  padding: 0.35rem;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ramp-swatch:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ramp-swatch.copied::after {
  content: '✓ Copiado';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}

.ramp-swatch-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  background-color: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.1;
}

/* ==========================================================================
   SECCIÓN 3: INSPECTOR COLORIMÉTRICO
   ========================================================================== */

.inspector-layout-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
}

.inspector-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.inspector-big-swatch {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.inspector-names {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.inspector-tone-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.inspector-artistic-name {
  font-size: 1.25rem;
}

.inspector-data-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.data-rows-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.copyable-data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.copyable-data-row:hover {
  border-color: var(--border-focus);
}

.copyable-data-row.copied .copy-badge {
  background-color: var(--accent-success);
  color: #ffffff;
}

.data-key {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.code-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.copy-badge {
  font-size: 0.7rem;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.spectral-curve-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.curve-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

#canvas-spectral-curve {
  display: block;
  width: 100%;
  height: 90px;
  border-radius: var(--radius-sm);
}

.spectral-scale-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ==========================================================================
   SECCIÓN 4: IGUALADOR INVERSO DE COLOR
   ========================================================================== */

.reverse-matcher-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: flex-start;
}

.input-target-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.input-field-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.target-input-row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.target-color-box {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

.target-hex-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  min-height: 42px;
}

.target-hex-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.reference-image-dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-secondary);
  transition: all 0.2s ease;
}

.reference-image-dropzone:hover,
.reference-image-dropzone.drag-active {
  border-color: var(--border-focus);
  background-color: var(--bg-card-hover);
}

.dropzone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

#reference-image-canvas {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  cursor: crosshair;
}

/* Resultados de coincidencia */
.matched-results-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.matched-comparison-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.matched-swatch-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.swatch-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.swatch-preview {
  width: 100%;
  height: 70px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.matched-divider-icon {
  color: var(--text-muted);
}

.matched-hex {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.matched-recipe-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.matched-metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.metric-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #3fb950;
}

.matched-recipe-formula {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.formula-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.formula-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ==========================================================================
   SECCIÓN 5: FAQ Y CIENCIA
   ========================================================================== */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.faq-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
}

.faq-question {
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-primary);
}

.faq-answer {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.formula-box {
  margin-top: 0.5rem;
  background-color: var(--bg-primary);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  color: #ff7b72;
}

/* ==========================================================================
   MODALES NATIVOS
   ========================================================================== */

.modal-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-dialog.active {
  opacity: 1;
  visibility: visible;
}

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

.modal-container {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-container-wide {
  max-width: 680px;
}

.modal-dialog.active .modal-container {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-scrollable {
  max-height: 55vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-action-danger {
  background-color: var(--accent-danger);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.btn-action-danger:hover {
  background-color: var(--accent-danger-hover);
}

.export-tabs-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.btn-export-tab {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-export-tab.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.export-textarea {
  width: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.85rem;
  resize: vertical;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   ADAPTACIÓN RESPONSIVE Y MÓVIL
   ========================================================================== */

@media (max-width: 900px) {
  .inspector-layout-grid {
    grid-template-columns: 1fr;
  }
  
  .reverse-matcher-grid {
    grid-template-columns: 1fr;
  }
  
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  
  .ramp-swatches-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tool-layout {
    padding: 0 0.5rem;
    margin: 1rem auto 2rem;
  }
  
  .card-main {
    padding: 1.1rem;
  }
  
  .palette-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .toolbar-group {
    justify-content: space-between;
    width: 100%;
  }
  
  .toolbar-group-actions {
    margin-left: 0;
    justify-content: space-between;
  }
  
  .select-surface-input {
    max-width: 100%;
    width: 100%;
  }
  
  .tube-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .tube-title-row {
    width: 100%;
  }
  
  .tube-pigment-select {
    max-width: 100%;
  }
  
  .tube-slider-row {
    width: 100%;
  }
  
  .data-rows-grid {
    grid-template-columns: 1fr;
  }
  
  .btn-action-primary,
  .btn-tool-subtle,
  .btn-action-danger {
    width: 100%;
    min-height: 44px;
  }
  
  .target-input-row {
    flex-wrap: wrap;
  }
  
  .target-hex-input {
    width: 100%;
  }
  
  .modal-actions {
    flex-direction: column;
  }
}
