/**
 * Regla y calibre virtual milimétrico calibrable en pantalla
 * Fijate Tools - Estilos corporativos y de la herramienta
 */

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

  /* Colores tema claro */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: #eff6ff;

  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  --lcd-bg: #1e293b;
  --lcd-digits: #38bdf8;
  --lcd-glow: rgba(56, 189, 248, 0.25);

  --card-radius: 16px;
  --btn-radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #151d2c;
  --bg-card-alt: #1c273c;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border-color: #24324a;
  --border-focus: #60a5fa;

  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --accent-subtle: #1e293b;

  --lcd-bg: #070d18;
  --lcd-digits: #38bdf8;
  --lcd-glow: rgba(56, 189, 248, 0.35);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
}

/* Reset básico y contención */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  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;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  margin-top: 0;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-main);
}

.font-mono {
  font-family: var(--font-mono);
}

/* Layout canónico con barra lateral AdSense */
.main-wrapper.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

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

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

/* Tarjetas y componentes */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Barra de estado de calibración física */
.calibration-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.status-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.status-indicator-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--warning-color);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.status-indicator-dot.calibrated {
  background-color: var(--success-color);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.status-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.status-subtext {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Pestañas de selección de modo */
.tool-modes-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  -webkit-overflow-scrolling: touch;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--btn-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 40px;
}

.mode-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--accent-color);
  background: var(--bg-card-alt);
}

.mode-tab-btn.active {
  background: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.tab-pane {
  display: none;
}

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

/* Botones estándar */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
  border: 1px solid transparent;
  text-decoration: none;
}

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

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

.btn-secondary {
  background: var(--bg-card-alt);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  min-height: 36px;
}

.btn-danger-soft {
  color: var(--danger-color);
}

.btn-danger-soft:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger-color);
}

/* ========================================================
   MODO 1: REGLA VIRTUAL
   ======================================================== */
.ruler-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

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

.toolbar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pill-selector {
  display: inline-flex;
  background: var(--bg-card-alt);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 32px;
}

.pill-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

/* Cuadro de lectura de cota actual */
.measurement-display-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  margin-bottom: 1.25rem;
}

.display-metric-col, .display-imperial-col {
  display: flex;
  flex-direction: column;
}

.display-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.display-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.display-value .unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.display-subvalue {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.display-divider {
  width: 1px;
  height: 50px;
  background-color: var(--border-color);
}

/* Viewport y escenario interactivo de la regla */
.ruler-viewport-container {
  position: relative;
  width: 100%;
  min-height: 200px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
  touch-action: none;
  user-select: none;
}

.ruler-interactive-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
}

#ruler-canvas {
  display: block;
  width: 100%;
  height: 200px;
  cursor: crosshair;
}

/* Punteros de arrastre A y B */
.ruler-pointer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  transform: translateX(-50%);
  cursor: grab;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  touch-action: none;
}

.ruler-pointer:active {
  cursor: grabbing;
}

.pointer-handle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.ruler-pointer:hover .pointer-handle {
  transform: scale(1.15);
}

.pointer-origin .pointer-handle {
  background: #10b981;
}

.pointer-target .pointer-handle {
  background: #ef4444;
}

.pointer-line {
  flex: 1;
  width: 2px;
  opacity: 0.85;
}

.pointer-origin .pointer-line {
  background: #10b981;
}

.pointer-target .pointer-line {
  background: #ef4444;
}

.ruler-hint-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding: 0.65rem 1rem;
  background: var(--bg-card-alt);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Modo regla vertical */
.ruler-viewport-container.vertical-mode {
  min-height: 500px;
}

.ruler-viewport-container.vertical-mode #ruler-canvas {
  height: 500px;
}

/* ========================================================
   MODO 2: CALIBRE PIE DE REY VIRTUAL
   ======================================================== */
.caliper-lcd-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--lcd-bg);
  border: 3px solid #334155;
  border-radius: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 1.25rem;
}

.lcd-screen {
  position: relative;
  background: #090e17;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: 2px solid #1e293b;
  min-width: 240px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7);
}

.lcd-top-flags {
  display: flex;
  gap: 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.25rem;
}

.lcd-flag.active {
  color: var(--lcd-digits);
  text-shadow: 0 0 6px var(--lcd-glow);
}

.lcd-main-digits {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--lcd-digits);
  text-shadow: 0 0 10px var(--lcd-glow);
  letter-spacing: 0.05em;
  text-align: right;
}

.lcd-fraction-digits {
  font-size: 0.85rem;
  color: #64748b;
  text-align: right;
  min-height: 1.2em;
}

.lcd-keypad {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.lcd-btn {
  background: #1e293b;
  border: 1px solid #475569;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.lcd-btn:hover {
  background: #334155;
  border-color: #64748b;
}

.lcd-btn:active {
  transform: translateY(1px);
}

.lcd-btn.btn-highlight {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

.lcd-btn.btn-highlight:hover {
  background: #0369a1;
}

/* Escenario del calibre */
.caliper-stage-wrapper {
  position: relative;
  width: 100%;
  min-height: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

#caliper-canvas {
  display: block;
  width: 100%;
  height: 260px;
  cursor: ew-resize;
  touch-action: none;
}

.caliper-fine-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card-alt);
  border-radius: var(--card-radius);
  margin-bottom: 1.25rem;
}

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

.control-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.stepper-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.caliper-vernier-card {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  border-radius: 8px;
}

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

.vernier-title {
  font-size: 0.95rem;
  margin: 0;
}

.badge-vernier {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--accent-subtle);
  color: var(--accent-color);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.vernier-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* ========================================================
   MODO 3: PLANTILLA DE TORNILLOS Y DIÁMETROS CIRCULARES
   ======================================================== */
.section-header-compact {
  margin-bottom: 1.25rem;
}

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

.section-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

.circle-tool-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  align-items: flex-start;
}

.circle-viewer-box {
  position: relative;
  width: 340px;
  height: 340px;
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
  touch-action: none;
}

#circle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 340px;
  height: 340px;
  border-radius: 50%;
}

.circle-crosshair {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-color);
  pointer-events: none;
}

.circle-crosshair::before, .circle-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(59, 130, 246, 0.3);
}

.circle-crosshair::before {
  top: -160px;
  left: 4px;
  width: 2px;
  height: 330px;
}

.circle-crosshair::after {
  top: 4px;
  left: -160px;
  height: 2px;
  width: 330px;
}

.circle-data-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.circle-kpis-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.kpi-box {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

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

.kpi-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

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

.metric-threads-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.25rem;
}

.threads-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.thread-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.chip-btn {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

.chip-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

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

.thread-specs-box {
  background: var(--bg-card-alt);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.88rem;
}

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

.spec-name {
  color: var(--text-muted);
}

.text-highlight {
  color: var(--accent-color);
}

/* ========================================================
   MODO 4: CALIBRACIÓN FÍSICA 1:1
   ======================================================== */
.calibration-presets-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.preset-card-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.25rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-card-btn:hover {
  border-color: var(--accent-color);
  background: var(--bg-card-alt);
}

.preset-card-btn.active {
  border-color: var(--accent-color);
  background: var(--accent-subtle);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.preset-icon {
  color: var(--accent-color);
  margin-bottom: 0.65rem;
}

.preset-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.preset-dim {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.calibration-stage-area {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.calibration-instructions-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-card);
  border-left: 4px solid var(--accent-color);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.calibration-target-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  overflow: hidden;
  padding: 1rem;
}

/* Silueta física con esquinas redondeadas y aspecto realista */
.calibration-physical-object {
  position: relative;
  width: 323px; /* 85.60 mm * 3.7795 px/mm aprox */
  height: 204px; /* 53.98 mm * 3.7795 px/mm aprox */
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid #38bdf8;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(56, 189, 248, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  box-sizing: border-box;
  transition: width 0.05s ease, height 0.05s ease;
}

.calib-object-chip {
  width: 44px;
  height: 32px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 6px;
  border: 1px solid #b45309;
}

.calib-object-text {
  font-size: 0.88rem;
  color: #94a3b8;
  text-align: right;
  letter-spacing: 0.05em;
}

/* Modo moneda */
.calibration-physical-object.coin-mode {
  border-radius: 50% !important;
  background: radial-gradient(circle, #e2e8f0 30%, #94a3b8 70%, #64748b 100%);
  border: 3px solid #f59e0b;
  align-items: center;
  justify-content: center;
}

.calibration-physical-object.coin-mode .calib-object-chip {
  display: none;
}

.calibration-physical-object.coin-mode .calib-object-text {
  color: #0f172a;
  font-weight: 800;
  text-align: center;
}

.calib-resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 24px;
  height: 24px;
  background: var(--accent-color);
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: se-resize;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.calibration-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.control-metric {
  font-size: 0.88rem;
  color: var(--accent-color);
  font-weight: 700;
}

.slider-with-steppers {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon-step {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  min-height: 38px;
}

.flex-grow {
  flex: 1;
}

.calib-footer-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.advanced-calib-details {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.advanced-calib-summary {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 0.75rem;
}

.advanced-calib-content {
  padding-top: 0.75rem;
}

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

/* ========================================================
   MODO 5: REGISTRO DE MEDIDAS
   ======================================================== */
.section-header-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

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

.table-responsive {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

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

.table-measures th {
  background: var(--bg-card-alt);
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.table-measures td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

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

.table-measures .badge-instrument {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background: var(--bg-card-alt);
  color: var(--text-muted);
}

/* Form controls */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: border-color 0.2s ease;
  min-height: 40px;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-help {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-unit {
  position: absolute;
  right: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

.form-range {
  width: 100%;
  accent-color: var(--accent-color);
  cursor: pointer;
  height: 6px;
}

.range-stepper-combo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-numeric {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 75px;
  text-align: right;
  color: var(--accent-color);
}

/* Modales accesibles */
.custom-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.custom-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalEnter 0.2s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title {
  font-size: 1.1rem;
  margin: 0;
}

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

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

.modal-body {
  padding: 1.5rem;
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card-alt);
}

/* Toast flotante */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 10001;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* Preguntas frecuentes (FAQ) */
.faq-section {
  margin-top: 2rem;
}

.faq-section-title {
  font-size: 1.35rem;
  margin-bottom: 1.25rem;
}

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

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

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

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.faq-icon {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 0.75rem;
}

.faq-item[open] .faq-icon {
  transform: rotate(180deg);
  color: var(--accent-color);
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.faq-answer p {
  margin: 0;
}

/* Utilidades varias */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

/* Responsive móvil */
@media (max-width: 992px) {
  .circle-tool-layout {
    grid-template-columns: 1fr;
  }

  .circle-viewer-box {
    margin-bottom: 1rem;
  }

  .calibration-presets-selector {
    grid-template-columns: 1fr;
  }

  .inputs-grid-2 {
    grid-template-columns: 1fr;
  }

  .measurement-display-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .display-divider {
    display: none;
  }

  .display-action-col {
    width: 100%;
  }

  .display-action-col .btn-primary {
    width: 100%;
  }
}

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

  .calibration-status-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-actions {
    width: 100%;
  }

  .status-actions button {
    width: 100%;
  }

  .lcd-main-digits {
    font-size: 2.2rem;
  }

  .circle-viewer-box {
    width: 280px;
    height: 280px;
  }

  #circle-canvas {
    width: 280px;
    height: 280px;
  }

  .circle-kpis-grid {
    grid-template-columns: 1fr;
  }
}
