/**
 * Calculadora de Patronaje, Crochet y Muestra de Punto - Fijate Tools
 * Estilos canónicos, tokens corporativos, responsive design y accesibilidad.
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta Tema Claro */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #ec4899;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  /* Acentos textiles y marcas */
  --primary-yarn: #db2777;
  --primary-yarn-light: rgba(219, 39, 119, 0.1);
  --primary-yarn-hover: #be185d;
  --accent-purple: #8b5cf6;
  --accent-purple-light: rgba(139, 92, 246, 0.1);
  --accent-amber: #d97706;
  --accent-amber-light: rgba(217, 119, 6, 0.1);
  --accent-emerald: #059669;
  --accent-emerald-light: rgba(5, 150, 105, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #131b26;
  --bg-card-subtle: #1a2433;
  --bg-input: #0f1722;
  --border-color: #243247;
  --border-focus: #f472b6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary-yarn: #f472b6;
  --primary-yarn-light: rgba(244, 114, 182, 0.15);
  --primary-yarn-hover: #f9a8d4;
  --accent-purple: #a78bfa;
  --accent-purple-light: rgba(167, 139, 250, 0.15);
  --accent-amber: #fbbf24;
  --accent-amber-light: rgba(251, 191, 36, 0.15);
  --accent-emerald: #34d399;
  --accent-emerald-light: rgba(52, 211, 153, 0.15);
}

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

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

/* Suite Nav Strip */
.suite-nav-strip {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
}

.suite-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.suite-nav-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--text-muted);
}

.suite-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.suite-link-item {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s ease;
}

.suite-link-item:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
}

.suite-link-item.active {
  background: var(--primary-yarn-light);
  color: var(--primary-yarn);
  font-weight: 600;
}

/* Layout y Sidebar AdSense */
.tool-layout {
  max-width: 1200px;
  margin: 1.25rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

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

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

.tool-ad-sidebar {
  display: none;
  width: 300px;
  flex-shrink: 0;
}

@media (min-width: 1536px) {
  .tool-ad-sidebar {
    display: block;
  }
}

.ad-sidebar-sticky {
  position: sticky;
  top: 1.5rem;
}

/* Presets rápidos superiores */
.presets-quick-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.presets-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-yarn);
  white-space: nowrap;
}

.presets-chips-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}

.preset-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 34px;
}

.preset-chip-btn:hover {
  border-color: var(--primary-yarn);
  background: var(--primary-yarn-light);
  color: var(--primary-yarn);
  transform: translateY(-1px);
}

/* Tarjeta Principal */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Barra de pestañas */
.tool-tabs-bar {
  display: flex;
  background: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
}

.tool-tabs-bar::-webkit-scrollbar {
  display: none;
}

.tool-tab-btn {
  flex: 1 1 0%;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  white-space: nowrap;
}

.tool-tab-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.02);
}

.tool-tab-btn.active {
  color: var(--primary-yarn);
  border-bottom-color: var(--primary-yarn);
  background: var(--bg-card);
}

/* Paneles de pestaña */
.tool-tab-panel {
  padding: 1.5rem;
}

@media (max-width: 640px) {
  .tool-tab-panel {
    padding: 1rem;
  }
}

.panel-header-intro {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.panel-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 850px;
}

/* Grids de Flujo de Trabajo (Pestaña 1) */
.gauge-workflow-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .gauge-workflow-grid {
    grid-template-columns: 1fr;
  }
}

/* Conmutador de Modo */
.mode-selector-strip {
  display: flex;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  gap: 0.3rem;
}

.mode-pill-option {
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.mode-pill-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.mode-pill-option:has(input:checked) {
  background: var(--bg-card);
  color: var(--primary-yarn);
  box-shadow: var(--shadow-sm);
}

/* Grupos de Formulario */
.form-card-group {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1.15rem;
}

.card-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.group-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-yarn);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.group-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.inputs-inline-dual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 500px) {
  .inputs-inline-dual {
    grid-template-columns: 1fr;
  }
}

.input-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.input-field-wrap label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.input-with-suffix {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 42px;
}

.input-with-suffix:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-yarn-light);
}

.input-with-suffix input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
}

.input-suffix {
  padding: 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-card-subtle);
  border-left: 1px solid var(--border-color);
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* Select Canónico */
.form-select-canonical {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0.55rem 40px 0.55rem 0.75rem;
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select-canonical:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-yarn-light);
}

.field-hint-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* Diagnóstico de Tensión */
.tension-callout-box {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.45;
  border: 1px solid transparent;
}

.tension-callout-box.status-ideal {
  background: var(--accent-emerald-light);
  border-color: var(--accent-emerald);
  color: var(--text-main);
}

.tension-callout-box.status-loose {
  background: var(--accent-amber-light);
  border-color: var(--accent-amber);
  color: var(--text-main);
}

.tension-callout-box.status-tight {
  background: var(--primary-yarn-light);
  border-color: var(--primary-yarn);
  color: var(--text-main);
}

/* Acordeón de Múltiplos */
.pattern-multiple-accordion {
  margin-top: 0.85rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.75rem;
}

.btn-toggle-multiples {
  background: none;
  border: none;
  color: var(--primary-yarn);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
}

.multiple-fields-panel {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

/* Cockpit de Resultados */
.cockpit-results-card {
  background: var(--bg-card);
  border: 2px solid var(--primary-yarn);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
}

.cockpit-header {
  margin-bottom: 1.15rem;
}

.cockpit-badge {
  display: inline-block;
  background: var(--primary-yarn-light);
  color: var(--primary-yarn);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

.cockpit-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

/* KPIs Destacados */
.kpis-hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 480px) {
  .kpis-hero-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-hero-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.kpi-hero-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.kpi-hero-value {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-yarn);
  line-height: 1;
  margin: 0.35rem 0;
}

.kpi-hero-unit {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-hero-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Caja de Múltiplos */
.multiple-result-box {
  background: var(--bg-card-subtle);
  border-left: 3px solid var(--accent-purple);
  padding: 0.75rem 0.9rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.multiple-result-box strong {
  color: var(--accent-purple);
}

/* Visualizador SVG de la Muestra */
.swatch-visualizer-container {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1.25rem;
}

.swatch-vis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.swatch-vis-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.swatch-vis-legend {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.2rem;
}

.dot-patron {
  background: #3b82f6;
}

.dot-user {
  background: var(--primary-yarn);
}

.swatch-svg-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 340px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.swatch-svg-wrapper svg {
  width: 100%;
  height: 100%;
  display: block;
}

.swatch-vis-metrics {
  display: flex;
  justify-content: space-around;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Botones de acción */
.summary-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-action-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 42px;
}

.btn-action-outline:hover {
  border-color: var(--primary-yarn);
  color: var(--primary-yarn);
  background: var(--primary-yarn-light);
}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary-yarn);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.btn-primary-action:hover {
  background: var(--primary-yarn-hover);
  transform: translateY(-1px);
}

/* PESTAÑA 2: OVILLOS Y METRAJE */
.yarn-calculator-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .yarn-calculator-grid {
    grid-template-columns: 1fr;
  }
}

.yarn-form-card, .yarn-results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.yarn-results-card {
  border: 2px solid var(--accent-purple);
  box-shadow: var(--shadow-lg);
}

.group-commercial-skein {
  margin-top: 1.25rem;
  border: 1px solid var(--accent-purple-light);
  background: rgba(139, 92, 246, 0.03);
}

/* Slider Canónico */
.field-label-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.margin-badge-value {
  font-family: var(--font-mono);
  background: var(--accent-purple-light);
  color: var(--accent-purple);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.canonical-slider {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  outline: none;
  margin: 0.75rem 0 0.35rem;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.slider-ticks-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Tarjeta Gigante de Ovillos */
.skeins-giant-card {
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  margin: 1.25rem 0;
  border: 1px solid var(--border-color);
}

.giant-skeins-num {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent-purple);
  line-height: 1;
}

.giant-skeins-label {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.35rem;
}

.giant-skeins-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.yarn-breakdown-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
  font-size: 0.88rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.breakdown-row .row-label {
  color: var(--text-muted);
}

.breakdown-row .row-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

.breakdown-row.row-leftover .row-val {
  color: var(--accent-emerald);
}

.yarn-dye-lot-warning {
  margin-top: 1.15rem;
  background: var(--accent-amber-light);
  border-left: 3px solid var(--accent-amber);
  padding: 0.75rem 0.9rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-main);
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.yarn-dye-lot-warning svg {
  color: var(--accent-amber);
  flex-shrink: 0;
  margin-top: 2px;
}

/* PESTAÑA 3: AUMENTOS Y DISMINUCIONES */
.shaping-dual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (max-width: 800px) {
  .shaping-dual-grid {
    grid-template-columns: 1fr;
  }
}

.shaping-card-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.card-box-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.card-box-tag {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.card-box-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-box-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.shaping-result-display {
  margin-top: 1.25rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.shaping-callout-instruction {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.shaping-meta-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-emerald);
  font-weight: 600;
}

/* PESTAÑA 4: TABLAS Y GLOSARIO */
.glossary-block-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.table-scroll-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

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

.canonical-table th {
  background: var(--bg-card-subtle);
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.canonical-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  vertical-align: middle;
}

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

.canonical-table tr:hover td {
  background: var(--bg-card-subtle);
}

.table-crochet-terms td:nth-child(1),
.table-crochet-terms td:nth-child(2),
.table-crochet-terms td:nth-child(3) {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.table-crochet-terms td:nth-child(3) {
  color: var(--primary-yarn);
}

/* GUÍA EDUCATIVA Y ACORDEONES FAQ */
.educational-guide-section {
  margin-top: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.guide-card-intro {
  margin-bottom: 1.5rem;
}

.guide-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.guide-lead {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.faq-accordion-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.faq-item[open] {
  border-color: var(--primary-yarn);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
  background: var(--bg-card-subtle);
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  transition: transform 0.2s ease;
  color: var(--text-dim);
  flex-shrink: 0;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary-yarn);
}

.faq-answer {
  padding: 1.15rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

.faq-answer p {
  margin-bottom: 0.6rem;
}

.faq-answer ul, .faq-answer ol {
  padding-left: 1.4rem;
  margin-bottom: 0.6rem;
}

.faq-answer li {
  margin-bottom: 0.35rem;
}

/* MODAL ACCESIBLE */
.canonical-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 23, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.canonical-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalPopIn 0.2s ease-out forwards;
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
}

.modal-title-with-icon {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-yarn-light);
  color: var(--primary-yarn);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

.modal-box-body {
  padding: 1.25rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-box-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  background: var(--bg-card-subtle);
}

/* REGLAS DE IMPRESIÓN (@media print) */
@media print {
  .app-header,
  .suite-nav-strip,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .presets-quick-bar,
  .tool-tabs-bar,
  .summary-actions-bar,
  .affiliate-section,
  .educational-guide-section,
  .related-tools-section,
  .fijate-footer,
  .btn-modal-close {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .tool-layout {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card-main, .cockpit-results-card, .yarn-results-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
}
